Boost logo

Boost-Commit :

From: hartmut.kaiser_at_[hidden]
Date: 2008-07-15 12:13:39


Author: hkaiser
Date: 2008-07-15 12:13:27 EDT (Tue, 15 Jul 2008)
New Revision: 47447
URL: http://svn.boost.org/trac/boost/changeset/47447

Log:
Spirit: merged from trunk
Added:
   branches/release/boost/spirit/home/karma/nonterminal/grammar_fwd.hpp (contents, props changed)
   branches/release/boost/spirit/home/qi/nonterminal/grammar_fwd.hpp (contents, props changed)
   branches/release/libs/spirit/doc/html/images/lexerflow.png (contents, props changed)
   branches/release/libs/spirit/doc/qi_and_karma/employee.qbk (contents, props changed)
   branches/release/libs/spirit/doc/qi_and_karma/mini_xml.qbk (contents, props changed)
   branches/release/libs/spirit/example/qi/mini_xml3.cpp (contents, props changed)
   branches/release/libs/spirit/example/qi/mini_xml_samples/4.toyxml (contents, props changed)
Text files modified:
   branches/release/boost/spirit/home/karma/action/action.hpp | 6
   branches/release/boost/spirit/home/karma/auxiliary/eol.hpp | 4
   branches/release/boost/spirit/home/karma/auxiliary/eps.hpp | 28 +++---
   branches/release/boost/spirit/home/karma/auxiliary/functor_director.hpp | 4
   branches/release/boost/spirit/home/karma/auxiliary/lazy.hpp | 4
   branches/release/boost/spirit/home/karma/auxiliary/none.hpp | 4
   branches/release/boost/spirit/home/karma/binary/binary.hpp | 8
   branches/release/boost/spirit/home/karma/binary/padding.hpp | 4
   branches/release/boost/spirit/home/karma/char/char.hpp | 138 +++++++++++++++---------------
   branches/release/boost/spirit/home/karma/char/space.hpp | 52 +++++-----
   branches/release/boost/spirit/home/karma/directive/center_alignment.hpp | 116 +++++++++++++-------------
   branches/release/boost/spirit/home/karma/directive/delimit.hpp | 60 ++++++------
   branches/release/boost/spirit/home/karma/directive/left_alignment.hpp | 116 +++++++++++++-------------
   branches/release/boost/spirit/home/karma/directive/right_alignment.hpp | 116 +++++++++++++-------------
   branches/release/boost/spirit/home/karma/directive/verbatim.hpp | 6
   branches/release/boost/spirit/home/karma/nonterminal/grammar.hpp | 94 ++++++---------------
   branches/release/boost/spirit/home/karma/nonterminal/nonterminal_director.hpp | 4
   branches/release/boost/spirit/home/karma/nonterminal/rule.hpp | 6
   branches/release/boost/spirit/home/karma/numeric/int.hpp | 74 ++++++++--------
   branches/release/boost/spirit/home/karma/numeric/real.hpp | 80 +++++++++---------
   branches/release/boost/spirit/home/karma/numeric/uint.hpp | 62 +++++++-------
   branches/release/boost/spirit/home/karma/operator/alternative.hpp | 6
   branches/release/boost/spirit/home/karma/operator/kleene.hpp | 6
   branches/release/boost/spirit/home/karma/operator/list.hpp | 8
   branches/release/boost/spirit/home/karma/operator/optional.hpp | 6
   branches/release/boost/spirit/home/karma/operator/plus.hpp | 6
   branches/release/boost/spirit/home/karma/operator/sequence.hpp | 6
   branches/release/boost/spirit/home/karma/stream/stream.hpp | 114 +++++++++++++-------------
   branches/release/boost/spirit/home/karma/string/lit.hpp | 114 +++++++++++++-------------
   branches/release/boost/spirit/home/karma/what.hpp | 2
   branches/release/boost/spirit/home/lex/lexer/terminal_director.hpp | 4
   branches/release/boost/spirit/home/lex/qi/state/state_switcher.hpp | 10 +-
   branches/release/boost/spirit/home/lex/qi/utility/plain_token.hpp | 4
   branches/release/boost/spirit/home/lex/tokenize_and_parse.hpp | 62 --------------
   branches/release/boost/spirit/home/qi/action/action.hpp | 6
   branches/release/boost/spirit/home/qi/auxiliary/eps.hpp | 8
   branches/release/boost/spirit/home/qi/auxiliary/functor_director.hpp | 4
   branches/release/boost/spirit/home/qi/auxiliary/lazy.hpp | 6
   branches/release/boost/spirit/home/qi/auxiliary/none.hpp | 4
   branches/release/boost/spirit/home/qi/auxiliary/primitives.hpp | 34 +++---
   branches/release/boost/spirit/home/qi/binary/binary.hpp | 8
   branches/release/boost/spirit/home/qi/char/char.hpp | 37 ++++---
   branches/release/boost/spirit/home/qi/char/char_class.hpp | 4
   branches/release/boost/spirit/home/qi/char/char_parser.hpp | 6
   branches/release/boost/spirit/home/qi/detail/expect_function.hpp | 4
   branches/release/boost/spirit/home/qi/directive/lexeme.hpp | 6
   branches/release/boost/spirit/home/qi/directive/omit.hpp | 6
   branches/release/boost/spirit/home/qi/directive/raw.hpp | 6
   branches/release/boost/spirit/home/qi/nonterminal/grammar.hpp | 175 +--------------------------------------
   branches/release/boost/spirit/home/qi/nonterminal/nonterminal_director.hpp | 4
   branches/release/boost/spirit/home/qi/nonterminal/rule.hpp | 15 +--
   branches/release/boost/spirit/home/qi/numeric/int.hpp | 4
   branches/release/boost/spirit/home/qi/numeric/real.hpp | 4
   branches/release/boost/spirit/home/qi/numeric/uint.hpp | 4
   branches/release/boost/spirit/home/qi/operator/alternative.hpp | 6
   branches/release/boost/spirit/home/qi/operator/and_predicate.hpp | 6
   branches/release/boost/spirit/home/qi/operator/difference.hpp | 8
   branches/release/boost/spirit/home/qi/operator/kleene.hpp | 6
   branches/release/boost/spirit/home/qi/operator/list.hpp | 8
   branches/release/boost/spirit/home/qi/operator/not_predicate.hpp | 6
   branches/release/boost/spirit/home/qi/operator/optional.hpp | 6
   branches/release/boost/spirit/home/qi/operator/permutation.hpp | 6
   branches/release/boost/spirit/home/qi/operator/plus.hpp | 6
   branches/release/boost/spirit/home/qi/operator/sequence_base.hpp | 6
   branches/release/boost/spirit/home/qi/operator/sequential_or.hpp | 6
   branches/release/boost/spirit/home/qi/stream/stream.hpp | 4
   branches/release/boost/spirit/home/qi/string/lit.hpp | 18 ++-
   branches/release/boost/spirit/home/qi/string/symbols.hpp | 4
   branches/release/boost/spirit/home/qi/what.hpp | 2
   branches/release/boost/spirit/home/support/detail/what_function.hpp | 8 +
   branches/release/libs/spirit/doc/lex.qbk | 12 +-
   branches/release/libs/spirit/doc/lex/introduction.qbk | 21 ++++
   branches/release/libs/spirit/doc/lex/lexer_attributes.qbk | 2
   branches/release/libs/spirit/doc/lex/lexer_primitives.qbk | 3
   branches/release/libs/spirit/doc/lex/lexer_quickstart1.qbk | 2
   branches/release/libs/spirit/doc/lex/lexer_quickstart2.qbk | 2
   branches/release/libs/spirit/doc/lex/lexer_quickstart3.qbk | 2
   branches/release/libs/spirit/doc/lex/lexer_semantic_actions.qbk | 2
   branches/release/libs/spirit/doc/lex/lexer_states.qbk | 2
   branches/release/libs/spirit/doc/lex/lexer_static_model.qbk | 2
   branches/release/libs/spirit/doc/lex/lexer_tutorials.qbk | 2
   branches/release/libs/spirit/doc/lex/parsing_using_a_lexer.qbk | 2
   branches/release/libs/spirit/doc/lex/token_definition.qbk | 2
   branches/release/libs/spirit/doc/lex/tokenizing.qbk | 2
   branches/release/libs/spirit/doc/lex/tokens_values.qbk | 2
   branches/release/libs/spirit/doc/qi_and_karma.qbk | 3
   branches/release/libs/spirit/doc/qi_and_karma/complex.qbk | 1
   branches/release/libs/spirit/doc/qi_and_karma/error_handling.qbk | 113 +++++++++++++++++++++++++
   branches/release/libs/spirit/doc/qi_and_karma/roman.qbk | 114 +++++++++++++++++++++++++
   branches/release/libs/spirit/doc/spirit2.qbk | 35 ++++---
   branches/release/libs/spirit/example/karma/calc2_ast_dump.cpp | 16 +--
   branches/release/libs/spirit/example/karma/calc2_ast_rpn.cpp | 14 +-
   branches/release/libs/spirit/example/karma/calc2_ast_vm.cpp | 16 +--
   branches/release/libs/spirit/example/karma/mini_xml_karma.cpp | 14 +-
   branches/release/libs/spirit/example/lex/example1.cpp | 6
   branches/release/libs/spirit/example/lex/example2.cpp | 14 +-
   branches/release/libs/spirit/example/lex/example3.cpp | 16 +-
   branches/release/libs/spirit/example/lex/example4.cpp | 6
   branches/release/libs/spirit/example/lex/example5.cpp | 8
   branches/release/libs/spirit/example/lex/example6.cpp | 6
   branches/release/libs/spirit/example/lex/print_numbers.cpp | 10 +-
   branches/release/libs/spirit/example/lex/static_lexer/word_count_static.cpp | 13 +-
   branches/release/libs/spirit/example/lex/strip_comments.cpp | 8
   branches/release/libs/spirit/example/lex/word_count.cpp | 13 +-
   branches/release/libs/spirit/example/qi/Jamfile | 12 ++
   branches/release/libs/spirit/example/qi/calc1.cpp | 7
   branches/release/libs/spirit/example/qi/calc2.cpp | 7
   branches/release/libs/spirit/example/qi/calc2_ast.cpp | 7
   branches/release/libs/spirit/example/qi/calc3.cpp | 7
   branches/release/libs/spirit/example/qi/calc3_lexer.cpp | 10 +-
   branches/release/libs/spirit/example/qi/calc4.cpp | 6
   branches/release/libs/spirit/example/qi/calc5.cpp | 9 -
   branches/release/libs/spirit/example/qi/calc6/calc6.cpp | 7
   branches/release/libs/spirit/example/qi/calc6/calc6.hpp | 7
   branches/release/libs/spirit/example/qi/calc6/calc6b.hpp | 3
   branches/release/libs/spirit/example/qi/calc6/calc6c.hpp | 6
   branches/release/libs/spirit/example/qi/calc7/calc7.cpp | 8 -
   branches/release/libs/spirit/example/qi/calc7/calc7.hpp | 7
   branches/release/libs/spirit/example/qi/calc7/calc7b.hpp | 3
   branches/release/libs/spirit/example/qi/calc7/calc7c.hpp | 6
   branches/release/libs/spirit/example/qi/employee.cpp | 13 ++
   branches/release/libs/spirit/example/qi/mini_c/mini_c.cpp | 12 +-
   branches/release/libs/spirit/example/qi/mini_c/mini_c.hpp | 22 ++--
   branches/release/libs/spirit/example/qi/mini_c/mini_cb.hpp | 3
   branches/release/libs/spirit/example/qi/mini_c/mini_cc.hpp | 6
   branches/release/libs/spirit/example/qi/mini_c/mini_cd.hpp | 14 +-
   branches/release/libs/spirit/example/qi/mini_xml1.cpp | 16 ++-
   branches/release/libs/spirit/example/qi/mini_xml2.cpp | 15 ++-
   branches/release/libs/spirit/example/qi/roman.cpp | 36 ++++---
   branches/release/libs/spirit/test/karma/grammar.cpp | 7
   branches/release/libs/spirit/test/karma/grammar_fail.cpp | 2
   branches/release/libs/spirit/test/karma/real_numerics.cpp | 11 ++
   branches/release/libs/spirit/test/qi/grammar.cpp | 59 +++---------
   branches/release/libs/spirit/test/qi/grammar_fail.cpp | 7
   134 files changed, 1286 insertions(+), 1320 deletions(-)

Modified: branches/release/boost/spirit/home/karma/action/action.hpp
==============================================================================
--- branches/release/boost/spirit/home/karma/action/action.hpp (original)
+++ branches/release/boost/spirit/home/karma/action/action.hpp 2008-07-15 12:13:27 EDT (Tue, 15 Jul 2008)
@@ -74,13 +74,13 @@
                 director::generate(spirit::left(component), sink, ctx, d, p);
         }
 
- template <typename Component>
- static std::string what(Component const& component)
+ template <typename Component, typename Context>
+ static std::string what(Component const& component, Context const& ctx)
         {
             typedef typename
                 spirit::result_of::left<Component>::type::director
             director;
- return director::what(spirit::left(component));
+ return director::what(spirit::left(component), ctx);
         }
     };
 

Modified: branches/release/boost/spirit/home/karma/auxiliary/eol.hpp
==============================================================================
--- branches/release/boost/spirit/home/karma/auxiliary/eol.hpp (original)
+++ branches/release/boost/spirit/home/karma/auxiliary/eol.hpp 2008-07-15 12:13:27 EDT (Tue, 15 Jul 2008)
@@ -32,8 +32,8 @@
             return true;
         }
 
- template <typename Component>
- static std::string what(Component const&)
+ template <typename Component, typename Context>
+ static std::string what(Component const& component, Context const& ctx)
         {
             return "eol";
         }

Modified: branches/release/boost/spirit/home/karma/auxiliary/eps.hpp
==============================================================================
--- branches/release/boost/spirit/home/karma/auxiliary/eps.hpp (original)
+++ branches/release/boost/spirit/home/karma/auxiliary/eps.hpp 2008-07-15 12:13:27 EDT (Tue, 15 Jul 2008)
@@ -1,6 +1,6 @@
 // Copyright (c) 2001-2008 Hartmut Kaiser
-//
-// Distributed under the Boost Software License, Version 1.0. (See accompanying
+//
+// Distributed under the Boost Software License, Version 1.0. (See accompanying
 // file LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt)
 
 #if !defined(BOOST_SPIRIT_KARMA_EPS_APRIL_21_2007_0246PM)
@@ -21,18 +21,18 @@
             typedef unused_type type;
         };
 
- template <typename Component, typename OutputIterator,
+ template <typename Component, typename OutputIterator,
             typename Context, typename Delimiter, typename Parameter>
- static bool
- generate(Component const& /*component*/, OutputIterator& sink,
- Context& /*ctx*/, Delimiter const& d, Parameter const& /*param*/)
+ static bool
+ generate(Component const& /*component*/, OutputIterator& sink,
+ Context& /*ctx*/, Delimiter const& d, Parameter const& /*param*/)
         {
             karma::delimit(sink, d);
             return true;
         }
 
- template <typename Component>
- static std::string what(Component const&)
+ template <typename Component, typename Context>
+ static std::string what(Component const& component, Context const& ctx)
         {
             return "eps";
         }
@@ -46,18 +46,18 @@
             typedef unused_type type;
         };
 
- template <typename Component, typename OutputIterator,
+ template <typename Component, typename OutputIterator,
             typename Context, typename Delimiter, typename Parameter>
- static bool
- generate(Component const& component, OutputIterator& sink,
- Context& ctx, Delimiter const& d, Parameter const& /*param*/)
+ static bool
+ generate(Component const& component, OutputIterator& sink,
+ Context& ctx, Delimiter const& d, Parameter const& /*param*/)
         {
             karma::delimit(sink, d);
             return fusion::at_c<0>(component.elements)(unused, ctx);
         }
 
- template <typename Component>
- static std::string what(Component const&)
+ template <typename Component, typename Context>
+ static std::string what(Component const& component, Context const& ctx)
         {
             return "semantic-predicate";
         }

Modified: branches/release/boost/spirit/home/karma/auxiliary/functor_director.hpp
==============================================================================
--- branches/release/boost/spirit/home/karma/auxiliary/functor_director.hpp (original)
+++ branches/release/boost/spirit/home/karma/auxiliary/functor_director.hpp 2008-07-15 12:13:27 EDT (Tue, 15 Jul 2008)
@@ -41,8 +41,8 @@
             return result;
         }
 
- template <typename Component>
- static std::string what(Component const&)
+ template <typename Component, typename Context>
+ static std::string what(Component const& component, Context const& ctx)
         {
             return "functor";
         }

Modified: branches/release/boost/spirit/home/karma/auxiliary/lazy.hpp
==============================================================================
--- branches/release/boost/spirit/home/karma/auxiliary/lazy.hpp (original)
+++ branches/release/boost/spirit/home/karma/auxiliary/lazy.hpp 2008-07-15 12:13:27 EDT (Tue, 15 Jul 2008)
@@ -74,8 +74,8 @@
                 generate(subject, sink, ctx, d, param);
         }
 
- template <typename Component>
- static std::string what(Component const&)
+ template <typename Component, typename Context>
+ static std::string what(Component const& component, Context const& ctx)
         {
             std::string result = "lazy[";
             // FIXME: need to get at the what of the embedded component

Modified: branches/release/boost/spirit/home/karma/auxiliary/none.hpp
==============================================================================
--- branches/release/boost/spirit/home/karma/auxiliary/none.hpp (original)
+++ branches/release/boost/spirit/home/karma/auxiliary/none.hpp 2008-07-15 12:13:27 EDT (Tue, 15 Jul 2008)
@@ -30,8 +30,8 @@
             return false;
         }
 
- template <typename Component>
- static std::string what(Component const&)
+ template <typename Component, typename Context>
+ static std::string what(Component const& component, Context const& ctx)
         {
             return "none";
         }

Modified: branches/release/boost/spirit/home/karma/binary/binary.hpp
==============================================================================
--- branches/release/boost/spirit/home/karma/binary/binary.hpp (original)
+++ branches/release/boost/spirit/home/karma/binary/binary.hpp 2008-07-15 12:13:27 EDT (Tue, 15 Jul 2008)
@@ -136,8 +136,8 @@
             return false;
         }
 
- template <typename Component>
- static std::string what(Component const&)
+ template <typename Component, typename Context>
+ static std::string what(Component const& component, Context const& ctx)
         {
             return karma::detail::what<endian>::is();
         }
@@ -173,8 +173,8 @@
             return true;
         }
 
- template <typename Component>
- static std::string what(Component const&)
+ template <typename Component, typename Context>
+ static std::string what(Component const& component, Context const& ctx)
         {
             return karma::detail::what<endian>::is();
         }

Modified: branches/release/boost/spirit/home/karma/binary/padding.hpp
==============================================================================
--- branches/release/boost/spirit/home/karma/binary/padding.hpp (original)
+++ branches/release/boost/spirit/home/karma/binary/padding.hpp 2008-07-15 12:13:27 EDT (Tue, 15 Jul 2008)
@@ -44,8 +44,8 @@
             return result;
         }
 
- template <typename Component>
- static std::string what(Component const&)
+ template <typename Component, typename Context>
+ static std::string what(Component const& component, Context const& ctx)
         {
             return std::string("pad(") +
                 boost::lexical_cast<std::string>(

Modified: branches/release/boost/spirit/home/karma/char/char.hpp
==============================================================================
--- branches/release/boost/spirit/home/karma/char/char.hpp (original)
+++ branches/release/boost/spirit/home/karma/char/char.hpp 2008-07-15 12:13:27 EDT (Tue, 15 Jul 2008)
@@ -1,6 +1,6 @@
 // Copyright (c) 2001-2008 Hartmut Kaiser
-//
-// Distributed under the Boost Software License, Version 1.0. (See accompanying
+//
+// Distributed under the Boost Software License, Version 1.0. (See accompanying
 // file LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt)
 
 #if !defined(BOOST_SPIRIT_KARMA_CHAR_FEB_21_2007_0543PM)
@@ -24,13 +24,13 @@
 #include <boost/fusion/include/cons.hpp>
 #include <boost/utility/enable_if.hpp>
 
-namespace boost { namespace spirit { namespace karma
-{
+namespace boost { namespace spirit { namespace karma
+{
     ///////////////////////////////////////////////////////////////////////////
     //
- // any_char
+ // any_char
     // generates a single character from the associated parameter
- //
+ //
     // Note: this generator has to have an associated parameter
     //
     ///////////////////////////////////////////////////////////////////////////
@@ -44,31 +44,31 @@
         };
 
         // any_char has a parameter attached
- template <typename Component, typename OutputIterator,
+ template <typename Component, typename OutputIterator,
             typename Context, typename Delimiter, typename Parameter>
- static bool
- generate(Component const&, OutputIterator& sink,
- Context& /*ctx*/, Delimiter const& d, Parameter const& param)
+ static bool
+ generate(Component const&, OutputIterator& sink,
+ Context& /*ctx*/, Delimiter const& d, Parameter const& param)
         {
             detail::generate_to(sink, param);
- karma::delimit(sink, d); // always do post-delimiting
+ karma::delimit(sink, d); // always do post-delimiting
             return true;
         }
 
- // this any_char has no parameter attached, it needs to have been
+ // this any_char has no parameter attached, it needs to have been
         // initialized from a direct literal
- template <typename Component, typename OutputIterator,
+ template <typename Component, typename OutputIterator,
             typename Context, typename Delimiter>
- static bool
- generate(Component const&, OutputIterator&, Context&, Delimiter const&,
- unused_type)
+ static bool
+ generate(Component const&, OutputIterator&, Context&, Delimiter const&,
+ unused_type)
         {
             BOOST_MPL_ASSERT_MSG(false, char__not_usable_without_parameter, ());
             return false;
         }
 
- template <typename Component>
- static std::string what(Component const&)
+ template <typename Component, typename Context>
+ static std::string what(Component const& component, Context const& ctx)
         {
             return "any-char";
         }
@@ -76,13 +76,13 @@
 
     ///////////////////////////////////////////////////////////////////////////
     //
- // literal_char
+ // literal_char
     // generates a single character given by a literal it was initialized
     // from
     //
     ///////////////////////////////////////////////////////////////////////////
     template <typename Char>
- struct literal_char
+ struct literal_char
     {
         template <typename Component, typename Context, typename Unused>
         struct attribute
@@ -91,19 +91,19 @@
         };
 
         // any_char has a parameter attached
- template <typename Component, typename OutputIterator,
+ template <typename Component, typename OutputIterator,
             typename Context, typename Delimiter, typename Parameter>
- static bool
- generate(Component const& component, OutputIterator& sink,
- Context& /*ctx*/, Delimiter const& d, Parameter const& /*param*/)
+ static bool
+ generate(Component const& component, OutputIterator& sink,
+ Context& /*ctx*/, Delimiter const& d, Parameter const& /*param*/)
         {
             detail::generate_to(sink, fusion::at_c<0>(component.elements));
- karma::delimit(sink, d); // always do post-delimiting
+ karma::delimit(sink, d); // always do post-delimiting
             return true;
         }
 
- template <typename Component>
- static std::string what(Component const& component)
+ template <typename Component, typename Context>
+ static std::string what(Component const& component, Context const& ctx)
         {
             return std::string("'")
                 + spirit::detail::to_narrow_char(
@@ -114,12 +114,12 @@
 
     ///////////////////////////////////////////////////////////////////////////
     //
- // lazy_char
- // generates a single character given by a functor it was initialized
+ // lazy_char
+ // generates a single character given by a functor it was initialized
     // from
     //
     ///////////////////////////////////////////////////////////////////////////
- struct lazy_char
+ struct lazy_char
     {
         template <typename Component, typename Context, typename Unused>
         struct attribute
@@ -128,20 +128,20 @@
         };
 
         // any_char has a parameter attached
- template <typename Component, typename OutputIterator,
+ template <typename Component, typename OutputIterator,
             typename Context, typename Delimiter, typename Parameter>
- static bool
- generate(Component const& component, OutputIterator& sink,
- Context& ctx, Delimiter const& d, Parameter const& /*param*/)
+ static bool
+ generate(Component const& component, OutputIterator& sink,
+ Context& ctx, Delimiter const& d, Parameter const& /*param*/)
         {
- detail::generate_to(sink,
+ detail::generate_to(sink,
                 fusion::at_c<0>(component.elements)(unused, ctx));
- karma::delimit(sink, d); // always do post-delimiting
+ karma::delimit(sink, d); // always do post-delimiting
             return true;
         }
 
- template <typename Component>
- static std::string what(Component const&)
+ template <typename Component, typename Context>
+ static std::string what(Component const& component, Context const& ctx)
         {
             return "char";
         }
@@ -154,7 +154,7 @@
     //
     ///////////////////////////////////////////////////////////////////////////
     template <typename Char, typename Tag>
- struct case_any_char
+ struct case_any_char
     {
         template <typename Component, typename Context, typename Unused>
         struct attribute
@@ -166,42 +166,42 @@
         typedef typename Tag::char_class char_class_;
 
         // case_any_char has a parameter attached
- template <typename Component, typename OutputIterator,
+ template <typename Component, typename OutputIterator,
             typename Context, typename Delimiter, typename Parameter>
- static bool
- generate(Component const& /*component*/, OutputIterator& sink,
- Context& /*ctx*/, Delimiter const& d, Parameter const& param)
+ static bool
+ generate(Component const& /*component*/, OutputIterator& sink,
+ Context& /*ctx*/, Delimiter const& d, Parameter const& param)
         {
             using spirit::char_class::convert;
             Char p = convert<char_set>::to(char_class_(), param);
             detail::generate_to(sink, p);
- karma::delimit(sink, d); // always do post-delimiting
+ karma::delimit(sink, d); // always do post-delimiting
             return true;
         }
 
- // this case_any_char has no parameter attached, it needs to have been
+ // this case_any_char has no parameter attached, it needs to have been
         // initialized from a direct literal
- template <typename Component, typename OutputIterator,
+ template <typename Component, typename OutputIterator,
             typename Context, typename Delimiter>
- static bool
- generate(Component const&, OutputIterator&, Context&, Delimiter const&,
- unused_type)
+ static bool
+ generate(Component const&, OutputIterator&, Context&, Delimiter const&,
+ unused_type)
         {
             BOOST_MPL_ASSERT_MSG(false, char__not_usable_without_parameter, ());
             return false;
         }
 
- template <typename Component>
- static std::string what(Component const&)
+ template <typename Component, typename Context>
+ static std::string what(Component const& component, Context const& ctx)
         {
             std::string result;
- result = std::string("any-") +
- spirit::char_class::what<char_set>::is(char_class_()) +
+ result = std::string("any-") +
+ spirit::char_class::what<char_set>::is(char_class_()) +
                 "case-char";
             return result;
         }
     };
-
+
 }}} // namespace boost::spirit::karma
 
 namespace boost { namespace spirit { namespace traits
@@ -218,20 +218,20 @@
>::type
>
     {
- typedef typename
+ typedef typename
             fusion::result_of::value_at_c<Elements, 0>::type
         char_type;
         typedef fusion::vector<char_type> vector_type;
 
         typedef component<
- karma::domain, karma::literal_char<Char>, vector_type>
+ karma::domain, karma::literal_char<Char>, vector_type>
         type;
-
+
         static type
         call(Elements const& elements)
         {
             typedef typename Modifier::char_set char_set;
-
+
             char_type ch = fusion::at_c<0>(elements);
             vector_type v(char_set::tolower(ch));
             return type(v);
@@ -247,20 +247,20 @@
>::type
>
     {
- typedef typename
+ typedef typename
             fusion::result_of::value_at_c<Elements, 0>::type
         char_type;
         typedef fusion::vector<char_type> vector_type;
 
- typedef
- component<karma::domain, karma::literal_char<Char>, vector_type>
+ typedef
+ component<karma::domain, karma::literal_char<Char>, vector_type>
         type;
-
+
         static type
         call(Elements const& elements)
         {
             typedef typename Modifier::char_set char_set;
-
+
             char_type ch = fusion::at_c<0>(elements);
             vector_type v(char_set::toupper(ch));
             return type(v);
@@ -282,11 +282,11 @@
         typedef typename Modifier::char_set char_set;
         typedef spirit::char_class::tag::lower char_class_;
         typedef spirit::char_class::key<char_set, char_class_> key_tag;
-
+
         typedef component<
- karma::domain, karma::case_any_char<Char, key_tag>, fusion::nil>
+ karma::domain, karma::case_any_char<Char, key_tag>, fusion::nil>
         type;
-
+
         static type
         call(Elements const&)
         {
@@ -306,11 +306,11 @@
         typedef typename Modifier::char_set char_set;
         typedef spirit::char_class::tag::upper char_class_;
         typedef spirit::char_class::key<char_set, char_class_> key_tag;
-
+
         typedef component<
- karma::domain, karma::case_any_char<Char, key_tag>, fusion::nil>
+ karma::domain, karma::case_any_char<Char, key_tag>, fusion::nil>
         type;
-
+
         static type
         call(Elements const&)
         {

Modified: branches/release/boost/spirit/home/karma/char/space.hpp
==============================================================================
--- branches/release/boost/spirit/home/karma/char/space.hpp (original)
+++ branches/release/boost/spirit/home/karma/char/space.hpp 2008-07-15 12:13:27 EDT (Tue, 15 Jul 2008)
@@ -1,6 +1,6 @@
 // Copyright (c) 2001-2008 Hartmut Kaiser
-//
-// Distributed under the Boost Software License, Version 1.0. (See accompanying
+//
+// Distributed under the Boost Software License, Version 1.0. (See accompanying
 // file LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt)
 
 #if !defined(BOOST_SPIRIT_KARMA_SPACE_MAR_06_2007_0934PM)
@@ -20,13 +20,13 @@
 #include <boost/spirit/home/support/standard.hpp>
 #include <boost/spirit/home/support/standard_wide.hpp>
 
-namespace boost { namespace spirit { namespace karma
-{
+namespace boost { namespace spirit { namespace karma
+{
     ///////////////////////////////////////////////////////////////////////////
     //
- // space
+ // space
     // generates a single character from the associated parameter
- //
+ //
     ///////////////////////////////////////////////////////////////////////////
     template <typename Tag, typename Char>
     struct any_space_char
@@ -41,33 +41,33 @@
         typedef typename Tag::char_class char_class_;
 
         // space has a parameter attached
- template <typename Component, typename OutputIterator,
+ template <typename Component, typename OutputIterator,
             typename Context, typename Delimiter, typename Parameter>
- static bool
- generate(Component const& /*component*/, OutputIterator& sink,
- Context& /*ctx*/, Delimiter const& d, Parameter const& ch)
+ static bool
+ generate(Component const& /*component*/, OutputIterator& sink,
+ Context& /*ctx*/, Delimiter const& d, Parameter const& ch)
         {
             using spirit::char_class::classify;
             BOOST_ASSERT(classify<char_set>::is(char_class_(), ch));
             detail::generate_to(sink, ch);
- karma::delimit(sink, d); // always do post-delimiting
+ karma::delimit(sink, d); // always do post-delimiting
             return true;
         }
 
         // this space has no parameter attached, just generate a single ' '
- template <typename Component, typename OutputIterator,
+ template <typename Component, typename OutputIterator,
             typename Context, typename Delimiter>
- static bool
- generate(Component const&, OutputIterator& sink, Context&,
- Delimiter const& d, unused_type)
+ static bool
+ generate(Component const&, OutputIterator& sink, Context&,
+ Delimiter const& d, unused_type)
         {
             detail::generate_to(sink, ' '); // generate a single space
- karma::delimit(sink, d); // always do post-delimiting
+ karma::delimit(sink, d); // always do post-delimiting
             return true;
         }
 
- template <typename Component>
- static std::string what(Component const&)
+ template <typename Component, typename Context>
+ static std::string what(Component const& component, Context const& ctx)
         {
             return "any-space";
         }
@@ -76,7 +76,7 @@
     ///////////////////////////////////////////////////////////////////////////
     //
     // space(...)
- // generates a single space character given by a literal it was
+ // generates a single space character given by a literal it was
     // initialized from
     //
     ///////////////////////////////////////////////////////////////////////////
@@ -90,19 +90,19 @@
         };
 
         // any_char has a parameter attached
- template <typename Component, typename OutputIterator,
+ template <typename Component, typename OutputIterator,
             typename Context, typename Delimiter, typename Parameter>
- static bool
- generate(Component const& component, OutputIterator& sink,
- Context& /*ctx*/, Delimiter const& d, Parameter const& /*param*/)
+ static bool
+ generate(Component const& component, OutputIterator& sink,
+ Context& /*ctx*/, Delimiter const& d, Parameter const& /*param*/)
         {
             detail::generate_to(sink, fusion::at_c<0>(component.elements));
- karma::delimit(sink, d); // always do post-delimiting
+ karma::delimit(sink, d); // always do post-delimiting
             return true;
         }
 
- template <typename Component>
- static std::string what(Component const& component)
+ template <typename Component, typename Context>
+ static std::string what(Component const& component, Context const& ctx)
         {
             return std::string("space('")
                 + spirit::detail::to_narrow_char(

Modified: branches/release/boost/spirit/home/karma/directive/center_alignment.hpp
==============================================================================
--- branches/release/boost/spirit/home/karma/directive/center_alignment.hpp (original)
+++ branches/release/boost/spirit/home/karma/directive/center_alignment.hpp 2008-07-15 12:13:27 EDT (Tue, 15 Jul 2008)
@@ -1,6 +1,6 @@
 // Copyright (c) 2001-2008 Hartmut Kaiser
-//
-// Distributed under the Boost Software License, Version 1.0. (See accompanying
+//
+// Distributed under the Boost Software License, Version 1.0. (See accompanying
 // file LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt)
 
 #if !defined(BOOST_SPIRIT_KARMA_CENTER_ALIGNMENT_FEB_27_2007_1216PM)
@@ -18,7 +18,7 @@
 
 ///////////////////////////////////////////////////////////////////////////////
 //
-// The BOOST_KARMA_DEFAULT_FIELD_LENGTH specifies the default field length
+// The BOOST_KARMA_DEFAULT_FIELD_LENGTH specifies the default field length
 // to be used for padding.
 //
 ///////////////////////////////////////////////////////////////////////////////
@@ -26,10 +26,10 @@
 #define BOOST_KARMA_DEFAULT_FIELD_LENGTH 10
 #endif
 
-namespace boost { namespace spirit { namespace karma
+namespace boost { namespace spirit { namespace karma
 {
     ///////////////////////////////////////////////////////////////////////////
- // The simple center alignment directive is used for center[...]
+ // The simple center alignment directive is used for center[...]
     // generators. It uses default values for the generated width (defined via
     // the BOOST_KARMA_DEFAULT_FIELD_LENGTH constant) and for the padding
     // generator (always spaces).
@@ -40,25 +40,25 @@
         struct attribute
           : traits::attribute_of<
                 karma::domain,
- typename result_of::argument1<Component>::type,
+ typename result_of::argument1<Component>::type,
                 Context
>
         {
         };
 
- template <typename Component, typename OutputIterator,
+ template <typename Component, typename OutputIterator,
             typename Context, typename Delimiter, typename Parameter>
- static bool
- generate(Component const& component, OutputIterator& sink,
- Context& ctx, Delimiter const& d, Parameter const& param)
+ static bool
+ generate(Component const& component, OutputIterator& sink,
+ Context& ctx, Delimiter const& d, Parameter const& param)
         {
- return detail::center_generate(sink, ctx, d, param,
- argument1(component), BOOST_KARMA_DEFAULT_FIELD_LENGTH,
+ return detail::center_generate(sink, ctx, d, param,
+ argument1(component), BOOST_KARMA_DEFAULT_FIELD_LENGTH,
                 spirit::as_component(karma::domain(), ' '));
         }
 
- template <typename Component>
- static std::string what(Component const& component)
+ template <typename Component, typename Context>
+ static std::string what(Component const& component, Context const& ctx)
         {
             std::string result = "center[";
 
@@ -66,12 +66,12 @@
                 spirit::result_of::argument1<Component>::type::director
             director;
 
- result += director::what(spirit::argument1(component));
+ result += director::what(spirit::argument1(component), ctx);
             result += "]";
             return result;
         }
     };
-
+
     ///////////////////////////////////////////////////////////////////////////
     // The center alignment with width directive, is used for generators
     // like center(width)[...]. It uses a default value for the padding
@@ -83,27 +83,27 @@
         struct attribute
           : traits::attribute_of<
                 karma::domain,
- typename result_of::subject<Component>::type,
+ typename result_of::subject<Component>::type,
                 Context
>
         {
         };
 
- template <typename Component, typename OutputIterator,
+ template <typename Component, typename OutputIterator,
             typename Context, typename Delimiter, typename Parameter>
- static bool
- generate(Component const& component, OutputIterator& sink,
- Context& ctx, Delimiter const& d, Parameter const& param)
+ static bool
+ generate(Component const& component, OutputIterator& sink,
+ Context& ctx, Delimiter const& d, Parameter const& param)
         {
- return detail::center_generate(sink, ctx, d, param,
+ return detail::center_generate(sink, ctx, d, param,
                 subject(component), proto::arg_c<0>(argument1(component)), ' ');
         }
 
- template <typename Component>
- static std::string what(Component const& component)
+ template <typename Component, typename Context>
+ static std::string what(Component const& component, Context const& ctx)
         {
             std::string result = "center(";
-
+
             result += boost::lexical_cast<std::string>(
                 proto::arg_c<0>(argument1(component)));
             result += ")[";
@@ -112,16 +112,16 @@
                 spirit::result_of::subject<Component>::type::director
             director;
 
- result += director::what(spirit::subject(component));
+ result += director::what(spirit::subject(component), ctx);
             result += "]";
             return result;
         }
     };
-
+
     ///////////////////////////////////////////////////////////////////////////
     // The center alignment directive with padding, is used for generators like
- // center(padding)[...], where padding is a arbitrary generator
- // expression. It uses a default value for the generated width (defined
+ // center(padding)[...], where padding is a arbitrary generator
+ // expression. It uses a default value for the generated width (defined
     // via the BOOST_KARMA_DEFAULT_FIELD_LENGTH constant).
     ///////////////////////////////////////////////////////////////////////////
     struct padding_center_aligment
@@ -130,49 +130,49 @@
         struct attribute
           : traits::attribute_of<
                 karma::domain,
- typename result_of::subject<Component>::type,
+ typename result_of::subject<Component>::type,
                 Context
>
         {
         };
 
- template <typename Component, typename OutputIterator,
+ template <typename Component, typename OutputIterator,
             typename Context, typename Delimiter, typename Parameter>
- static bool
- generate(Component const& component, OutputIterator& sink,
- Context& ctx, Delimiter const& d, Parameter const& param)
+ static bool
+ generate(Component const& component, OutputIterator& sink,
+ Context& ctx, Delimiter const& d, Parameter const& param)
         {
- return detail::center_generate(sink, ctx, d, param,
- subject(component), BOOST_KARMA_DEFAULT_FIELD_LENGTH,
+ return detail::center_generate(sink, ctx, d, param,
+ subject(component), BOOST_KARMA_DEFAULT_FIELD_LENGTH,
                 argument1(component));
         }
 
- template <typename Component>
- static std::string what(Component const& component)
+ template <typename Component, typename Context>
+ static std::string what(Component const& component, Context const& ctx)
         {
             std::string result = "center(";
-
+
             typedef typename
                 spirit::result_of::argument1<Component>::type::director
             padding;
 
- result += padding::what(spirit::argument1(component));
+ result += padding::what(spirit::argument1(component), ctx);
             result += ")[";
 
             typedef typename
                 spirit::result_of::subject<Component>::type::director
             director;
 
- result += director::what(spirit::subject(component));
+ result += director::what(spirit::subject(component), ctx);
             result += "]";
             return result;
         }
     };
-
+
     ///////////////////////////////////////////////////////////////////////////
- // The full center alignment directive, is used for generators like
- // center(width, padding)[...], where width is a integer value to be
- // used as the field width and padding is a arbitrary generator
+ // The full center alignment directive, is used for generators like
+ // center(width, padding)[...], where width is a integer value to be
+ // used as the field width and padding is a arbitrary generator
     // expression.
     ///////////////////////////////////////////////////////////////////////////
     struct full_center_aligment
@@ -181,28 +181,28 @@
         struct attribute
           : traits::attribute_of<
                 karma::domain,
- typename result_of::subject<Component>::type,
+ typename result_of::subject<Component>::type,
                 Context
>
         {
         };
 
- template <typename Component, typename OutputIterator,
+ template <typename Component, typename OutputIterator,
             typename Context, typename Delimiter, typename Parameter>
- static bool
- generate(Component const& component, OutputIterator& sink,
- Context& ctx, Delimiter const& d, Parameter const& param)
+ static bool
+ generate(Component const& component, OutputIterator& sink,
+ Context& ctx, Delimiter const& d, Parameter const& param)
         {
- return detail::center_generate(sink, ctx, d, param,
- subject(component), proto::arg_c<0>(argument1(component)),
+ return detail::center_generate(sink, ctx, d, param,
+ subject(component), proto::arg_c<0>(argument1(component)),
                 argument2(component));
         }
 
- template <typename Component>
- static std::string what(Component const& component)
+ template <typename Component, typename Context>
+ static std::string what(Component const& component, Context const& ctx)
         {
             std::string result = "center(";
-
+
             result += boost::lexical_cast<std::string>(
                 proto::arg_c<0>(argument1(component)));
             result += ", ";
@@ -211,19 +211,19 @@
                 spirit::result_of::argument2<Component>::type::director
             padding;
 
- result += padding::what(spirit::argument2(component));
+ result += padding::what(spirit::argument2(component), ctx);
             result += ")[";
 
             typedef typename
                 spirit::result_of::subject<Component>::type::director
             director;
 
- result += director::what(spirit::subject(component));
+ result += director::what(spirit::subject(component), ctx);
             result += "]";
             return result;
         }
     };
-
+
 }}} // namespace boost::spirit::karma
 
 #endif

Modified: branches/release/boost/spirit/home/karma/directive/delimit.hpp
==============================================================================
--- branches/release/boost/spirit/home/karma/directive/delimit.hpp (original)
+++ branches/release/boost/spirit/home/karma/directive/delimit.hpp 2008-07-15 12:13:27 EDT (Tue, 15 Jul 2008)
@@ -1,6 +1,6 @@
 // Copyright (c) 2001-2008 Hartmut Kaiser
-//
-// Distributed under the Boost Software License, Version 1.0. (See accompanying
+//
+// Distributed under the Boost Software License, Version 1.0. (See accompanying
 // file LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt)
 
 #if !defined(BOOST_SPIRIT_KARMA_DELIMIT_MAR_02_2007_0217PM)
@@ -27,31 +27,31 @@
         struct attribute
           : traits::attribute_of<
                 karma::domain,
- typename result_of::right<Component>::type,
+ typename result_of::right<Component>::type,
                 Context
>
         {
         };
 
- template <typename Component, typename OutputIterator,
+ template <typename Component, typename OutputIterator,
             typename Context, typename Delimiter, typename Parameter>
- static bool
- generate(Component const& component, OutputIterator& sink,
- Context& ctx, Delimiter const& /*d*/, Parameter const& param)
+ static bool
+ generate(Component const& component, OutputIterator& sink,
+ Context& ctx, Delimiter const& /*d*/, Parameter const& param)
         {
- // the delimit_space generator simply dispatches to the embedded
+ // the delimit_space generator simply dispatches to the embedded
             // generator while supplying a single space as the new delimiter
             // to use
- typedef typename
+ typedef typename
                 result_of::right<Component>::type::director
             director;
-
- return director::generate(spirit::right(component),
+
+ return director::generate(spirit::right(component),
                 sink, ctx, spirit::as_component(karma::domain(), ' '), param);
         }
 
- template <typename Component>
- static std::string what(Component const& component)
+ template <typename Component, typename Context>
+ static std::string what(Component const& component, Context const& ctx)
         {
             std::string result = "delimit[";
 
@@ -59,7 +59,7 @@
                 spirit::result_of::right<Component>::type::director
             director;
 
- result += director::what(spirit::right(component));
+ result += director::what(spirit::right(component), ctx);
             result += "]";
             return result;
         }
@@ -74,48 +74,48 @@
         struct attribute
           : traits::attribute_of<
                 karma::domain,
- typename result_of::subject<Component>::type,
+ typename result_of::subject<Component>::type,
                 Context
>
         {
         };
 
- template <typename Component, typename OutputIterator,
+ template <typename Component, typename OutputIterator,
             typename Context, typename Delimiter, typename Parameter>
- static bool
- generate(Component const& component, OutputIterator& sink,
- Context& ctx, Delimiter const& /*d*/, Parameter const& param)
+ static bool
+ generate(Component const& component, OutputIterator& sink,
+ Context& ctx, Delimiter const& /*d*/, Parameter const& param)
         {
- // the delimit generator simply dispatches to the embedded
+ // the delimit generator simply dispatches to the embedded
             // generator while supplying it's argument as the new delimiter
             // to use
- typedef typename
+ typedef typename
                 spirit::result_of::subject<Component>::type::director
             director;
-
- return director::generate(spirit::subject(component), sink, ctx,
+
+ return director::generate(spirit::subject(component), sink, ctx,
                 spirit::as_component(
- karma::domain(), spirit::argument1(component)),
+ karma::domain(), spirit::argument1(component)),
                 param);
         }
 
- template <typename Component>
- static std::string what(Component const& component)
+ template <typename Component, typename Context>
+ static std::string what(Component const& component, Context const& ctx)
         {
             std::string result = "delimit(";
-
+
             typedef typename
                 spirit::result_of::argument1<Component>::type::director
             delimiter;
-
- result += delimiter::what(spirit::argument1(component));
+
+ result += delimiter::what(spirit::argument1(component), ctx);
             result +=")[";
 
             typedef typename
                 spirit::result_of::subject<Component>::type::director
             director;
 
- result += director::what(spirit::subject(component));
+ result += director::what(spirit::subject(component), ctx);
             result += "]";
             return result;
         }

Modified: branches/release/boost/spirit/home/karma/directive/left_alignment.hpp
==============================================================================
--- branches/release/boost/spirit/home/karma/directive/left_alignment.hpp (original)
+++ branches/release/boost/spirit/home/karma/directive/left_alignment.hpp 2008-07-15 12:13:27 EDT (Tue, 15 Jul 2008)
@@ -1,6 +1,6 @@
 // Copyright (c) 2001-2008 Hartmut Kaiser
-//
-// Distributed under the Boost Software License, Version 1.0. (See accompanying
+//
+// Distributed under the Boost Software License, Version 1.0. (See accompanying
 // file LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt)
 
 #if !defined(BOOST_SPIRIT_KARMA_LEFT_ALIGNMENT_FEB_27_2007_1216PM)
@@ -18,7 +18,7 @@
 
 ///////////////////////////////////////////////////////////////////////////////
 //
-// The BOOST_KARMA_DEFAULT_FIELD_LENGTH specifies the default field length
+// The BOOST_KARMA_DEFAULT_FIELD_LENGTH specifies the default field length
 // to be used for padding.
 //
 ///////////////////////////////////////////////////////////////////////////////
@@ -26,10 +26,10 @@
 #define BOOST_KARMA_DEFAULT_FIELD_LENGTH 10
 #endif
 
-namespace boost { namespace spirit { namespace karma
+namespace boost { namespace spirit { namespace karma
 {
     ///////////////////////////////////////////////////////////////////////////
- // The simple left alignment directive is used for left_align[...]
+ // The simple left alignment directive is used for left_align[...]
     // generators. It uses default values for the generated width (defined via
     // the BOOST_KARMA_DEFAULT_FIELD_LENGTH constant) and for the padding
     // generator (always spaces).
@@ -37,27 +37,27 @@
     struct simple_left_aligment
     {
         template <typename Component, typename Context, typename Unused>
- struct attribute
+ struct attribute
           : traits::attribute_of<
                 karma::domain,
- typename result_of::argument1<Component>::type,
+ typename result_of::argument1<Component>::type,
                 Context
>
         {
         };
 
- template <typename Component, typename OutputIterator,
+ template <typename Component, typename OutputIterator,
             typename Context, typename Delimiter, typename Parameter>
- static bool
- generate(Component const& component, OutputIterator& sink,
- Context& ctx, Delimiter const& d, Parameter const& param)
+ static bool
+ generate(Component const& component, OutputIterator& sink,
+ Context& ctx, Delimiter const& d, Parameter const& param)
         {
- return detail::left_align_generate(sink, ctx, d, param,
+ return detail::left_align_generate(sink, ctx, d, param,
                 argument1(component), BOOST_KARMA_DEFAULT_FIELD_LENGTH, ' ');
         }
 
- template <typename Component>
- static std::string what(Component const& component)
+ template <typename Component, typename Context>
+ static std::string what(Component const& component, Context const& ctx)
         {
             std::string result = "left_align[";
 
@@ -65,12 +65,12 @@
                 spirit::result_of::argument1<Component>::type::director
             director;
 
- result += director::what(spirit::argument1(component));
+ result += director::what(spirit::argument1(component), ctx);
             result += "]";
             return result;
         }
     };
-
+
     ///////////////////////////////////////////////////////////////////////////
     // The left alignment with width directive, is used for generators
     // like left_align(width)[...]. It uses a default value for the padding
@@ -82,27 +82,27 @@
         struct attribute
           : traits::attribute_of<
                 karma::domain,
- typename result_of::subject<Component>::type,
+ typename result_of::subject<Component>::type,
                 Context
>
         {
         };
 
- template <typename Component, typename OutputIterator,
+ template <typename Component, typename OutputIterator,
             typename Context, typename Delimiter, typename Parameter>
- static bool
- generate(Component const& component, OutputIterator& sink,
- Context& ctx, Delimiter const& d, Parameter const& param)
+ static bool
+ generate(Component const& component, OutputIterator& sink,
+ Context& ctx, Delimiter const& d, Parameter const& param)
         {
- return detail::left_align_generate(sink, ctx, d, param,
+ return detail::left_align_generate(sink, ctx, d, param,
                 subject(component), proto::arg_c<0>(argument1(component)), ' ');
         }
 
- template <typename Component>
- static std::string what(Component const& component)
+ template <typename Component, typename Context>
+ static std::string what(Component const& component, Context const& ctx)
         {
             std::string result = "left_align(";
-
+
             result += boost::lexical_cast<std::string>(
                 proto::arg_c<0>(argument1(component)));
             result += ")[";
@@ -111,16 +111,16 @@
                 spirit::result_of::subject<Component>::type::director
             director;
 
- result += director::what(spirit::subject(component));
+ result += director::what(spirit::subject(component), ctx);
             result += "]";
             return result;
         }
     };
-
+
     ///////////////////////////////////////////////////////////////////////////
     // The left alignment directive with padding, is used for generators like
- // left_align(padding)[...], where padding is a arbitrary generator
- // expression. It uses a default value for the generated width (defined
+ // left_align(padding)[...], where padding is a arbitrary generator
+ // expression. It uses a default value for the generated width (defined
     // via the BOOST_KARMA_DEFAULT_FIELD_LENGTH constant).
     ///////////////////////////////////////////////////////////////////////////
     struct padding_left_aligment
@@ -129,49 +129,49 @@
         struct attribute
           : traits::attribute_of<
                 karma::domain,
- typename result_of::subject<Component>::type,
+ typename result_of::subject<Component>::type,
                 Context
>
         {
         };
 
- template <typename Component, typename OutputIterator,
+ template <typename Component, typename OutputIterator,
             typename Context, typename Delimiter, typename Parameter>
- static bool
- generate(Component const& component, OutputIterator& sink,
- Context& ctx, Delimiter const& d, Parameter const& param)
+ static bool
+ generate(Component const& component, OutputIterator& sink,
+ Context& ctx, Delimiter const& d, Parameter const& param)
         {
- return detail::left_align_generate(sink, ctx, d, param,
- subject(component), BOOST_KARMA_DEFAULT_FIELD_LENGTH,
+ return detail::left_align_generate(sink, ctx, d, param,
+ subject(component), BOOST_KARMA_DEFAULT_FIELD_LENGTH,
                 argument1(component));
         }
 
- template <typename Component>
- static std::string what(Component const& component)
+ template <typename Component, typename Context>
+ static std::string what(Component const& component, Context const& ctx)
         {
             std::string result = "left_align(";
-
+
             typedef typename
                 spirit::result_of::argument1<Component>::type::director
             padding;
 
- result += padding::what(spirit::argument1(component));
+ result += padding::what(spirit::argument1(component), ctx);
             result += ")[";
 
             typedef typename
                 spirit::result_of::subject<Component>::type::director
             director;
 
- result += director::what(spirit::subject(component));
+ result += director::what(spirit::subject(component), ctx);
             result += "]";
             return result;
         }
     };
-
+
     ///////////////////////////////////////////////////////////////////////////
- // The full left alignment directive, is used for generators like
- // left_align(width, padding)[...], where width is a integer value to be
- // used as the field width and padding is a arbitrary generator
+ // The full left alignment directive, is used for generators like
+ // left_align(width, padding)[...], where width is a integer value to be
+ // used as the field width and padding is a arbitrary generator
     // expression.
     ///////////////////////////////////////////////////////////////////////////
     struct full_left_aligment
@@ -180,28 +180,28 @@
         struct attribute
           : traits::attribute_of<
                 karma::domain,
- typename result_of::subject<Component>::type,
+ typename result_of::subject<Component>::type,
                 Context
>
         {
         };
 
- template <typename Component, typename OutputIterator,
+ template <typename Component, typename OutputIterator,
             typename Context, typename Delimiter, typename Parameter>
- static bool
- generate(Component const& component, OutputIterator& sink,
- Context& ctx, Delimiter const& d, Parameter const& param)
+ static bool
+ generate(Component const& component, OutputIterator& sink,
+ Context& ctx, Delimiter const& d, Parameter const& param)
         {
- return detail::left_align_generate(sink, ctx, d, param,
- subject(component), proto::arg_c<0>(argument1(component)),
+ return detail::left_align_generate(sink, ctx, d, param,
+ subject(component), proto::arg_c<0>(argument1(component)),
                 argument2(component));
         }
 
- template <typename Component>
- static std::string what(Component const& component)
+ template <typename Component, typename Context>
+ static std::string what(Component const& component, Context const& ctx)
         {
             std::string result = "left_align(";
-
+
             result += boost::lexical_cast<std::string>(
                 proto::arg_c<0>(argument1(component)));
             result += ", ";
@@ -210,19 +210,19 @@
                 spirit::result_of::argument2<Component>::type::director
             padding;
 
- result += padding::what(spirit::argument2(component));
+ result += padding::what(spirit::argument2(component), ctx);
             result += ")[";
 
             typedef typename
                 spirit::result_of::subject<Component>::type::director
             director;
 
- result += director::what(spirit::subject(component));
+ result += director::what(spirit::subject(component), ctx);
             result += "]";
             return result;
         }
     };
-
+
 }}} // namespace boost::spirit::karma
 
 #endif

Modified: branches/release/boost/spirit/home/karma/directive/right_alignment.hpp
==============================================================================
--- branches/release/boost/spirit/home/karma/directive/right_alignment.hpp (original)
+++ branches/release/boost/spirit/home/karma/directive/right_alignment.hpp 2008-07-15 12:13:27 EDT (Tue, 15 Jul 2008)
@@ -1,6 +1,6 @@
 // Copyright (c) 2001-2008 Hartmut Kaiser
-//
-// Distributed under the Boost Software License, Version 1.0. (See accompanying
+//
+// Distributed under the Boost Software License, Version 1.0. (See accompanying
 // file LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt)
 
 #if !defined(BOOST_SPIRIT_KARMA_RIGHT_ALIGNMENT_FEB_27_2007_1216PM)
@@ -18,7 +18,7 @@
 
 ///////////////////////////////////////////////////////////////////////////////
 //
-// The BOOST_KARMA_DEFAULT_FIELD_LENGTH specifies the default field length
+// The BOOST_KARMA_DEFAULT_FIELD_LENGTH specifies the default field length
 // to be used for padding.
 //
 ///////////////////////////////////////////////////////////////////////////////
@@ -26,10 +26,10 @@
 #define BOOST_KARMA_DEFAULT_FIELD_LENGTH 10
 #endif
 
-namespace boost { namespace spirit { namespace karma
+namespace boost { namespace spirit { namespace karma
 {
     ///////////////////////////////////////////////////////////////////////////
- // The simple right alignment directive is used for right_align[...]
+ // The simple right alignment directive is used for right_align[...]
     // generators. It uses default values for the generated width (defined via
     // the BOOST_KARMA_DEFAULT_FIELD_LENGTH constant) and for the padding
     // generator (always spaces).
@@ -40,25 +40,25 @@
         struct attribute
           : traits::attribute_of<
                 karma::domain,
- typename result_of::argument1<Component>::type,
+ typename result_of::argument1<Component>::type,
                 Context
>
         {
         };
 
- template <typename Component, typename OutputIterator,
+ template <typename Component, typename OutputIterator,
             typename Context, typename Delimiter, typename Parameter>
- static bool
- generate(Component const& component, OutputIterator& sink,
- Context& ctx, Delimiter const& d, Parameter const& param)
+ static bool
+ generate(Component const& component, OutputIterator& sink,
+ Context& ctx, Delimiter const& d, Parameter const& param)
         {
- return detail::right_align_generate(sink, ctx, d, param,
- argument1(component), BOOST_KARMA_DEFAULT_FIELD_LENGTH,
+ return detail::right_align_generate(sink, ctx, d, param,
+ argument1(component), BOOST_KARMA_DEFAULT_FIELD_LENGTH,
                 spirit::as_component(karma::domain(), ' '));
         }
 
- template <typename Component>
- static std::string what(Component const& component)
+ template <typename Component, typename Context>
+ static std::string what(Component const& component, Context const& ctx)
         {
             std::string result = "right_align[";
 
@@ -66,12 +66,12 @@
                 spirit::result_of::argument1<Component>::type::director
             director;
 
- result += director::what(spirit::argument1(component));
+ result += director::what(spirit::argument1(component), ctx);
             result += "]";
             return result;
         }
     };
-
+
     ///////////////////////////////////////////////////////////////////////////
     // The right alignment with width directive, is used for generators
     // like right_align(width)[...]. It uses a default value for the padding
@@ -83,27 +83,27 @@
         struct attribute
           : traits::attribute_of<
                 karma::domain,
- typename result_of::subject<Component>::type,
+ typename result_of::subject<Component>::type,
                 Context
>
         {
         };
 
- template <typename Component, typename OutputIterator,
+ template <typename Component, typename OutputIterator,
             typename Context, typename Delimiter, typename Parameter>
- static bool
- generate(Component const& component, OutputIterator& sink,
- Context& ctx, Delimiter const& d, Parameter const& param)
+ static bool
+ generate(Component const& component, OutputIterator& sink,
+ Context& ctx, Delimiter const& d, Parameter const& param)
         {
- return detail::right_align_generate(sink, ctx, d, param,
+ return detail::right_align_generate(sink, ctx, d, param,
                 subject(component), proto::arg_c<0>(argument1(component)), ' ');
         }
 
- template <typename Component>
- static std::string what(Component const& component)
+ template <typename Component, typename Context>
+ static std::string what(Component const& component, Context const& ctx)
         {
             std::string result = "right_align(";
-
+
             result += boost::lexical_cast<std::string>(
                 proto::arg_c<0>(argument1(component)));
             result += ")[";
@@ -112,16 +112,16 @@
                 spirit::result_of::subject<Component>::type::director
             director;
 
- result += director::what(spirit::subject(component));
+ result += director::what(spirit::subject(component), ctx);
             result += "]";
             return result;
         }
     };
-
+
     ///////////////////////////////////////////////////////////////////////////
     // The right alignment directive with padding, is used for generators like
- // right_align(padding)[...], where padding is a arbitrary generator
- // expression. It uses a default value for the generated width (defined
+ // right_align(padding)[...], where padding is a arbitrary generator
+ // expression. It uses a default value for the generated width (defined
     // via the BOOST_KARMA_DEFAULT_FIELD_LENGTH constant).
     ///////////////////////////////////////////////////////////////////////////
     struct padding_right_aligment
@@ -130,49 +130,49 @@
         struct attribute
           : traits::attribute_of<
                 karma::domain,
- typename result_of::subject<Component>::type,
+ typename result_of::subject<Component>::type,
                 Context
>
         {
         };
 
- template <typename Component, typename OutputIterator,
+ template <typename Component, typename OutputIterator,
             typename Context, typename Delimiter, typename Parameter>
- static bool
- generate(Component const& component, OutputIterator& sink,
- Context& ctx, Delimiter const& d, Parameter const& param)
+ static bool
+ generate(Component const& component, OutputIterator& sink,
+ Context& ctx, Delimiter const& d, Parameter const& param)
         {
- return detail::right_align_generate(sink, ctx, d, param,
- subject(component), BOOST_KARMA_DEFAULT_FIELD_LENGTH,
+ return detail::right_align_generate(sink, ctx, d, param,
+ subject(component), BOOST_KARMA_DEFAULT_FIELD_LENGTH,
                 argument1(component));
         }
 
- template <typename Component>
- static std::string what(Component const& component)
+ template <typename Component, typename Context>
+ static std::string what(Component const& component, Context const& ctx)
         {
             std::string result = "right_align(";
-
+
             typedef typename
                 spirit::result_of::argument1<Component>::type::director
             padding;
 
- result += padding::what(spirit::argument1(component));
+ result += padding::what(spirit::argument1(component), ctx);
             result += ")[";
 
             typedef typename
                 spirit::result_of::subject<Component>::type::director
             director;
 
- result += director::what(spirit::subject(component));
+ result += director::what(spirit::subject(component), ctx);
             result += "]";
             return result;
         }
     };
-
+
     ///////////////////////////////////////////////////////////////////////////
- // The full right alignment directive, is used for generators like
- // right_align(width, padding)[...], where width is a integer value to be
- // used as the field width and padding is a arbitrary generator
+ // The full right alignment directive, is used for generators like
+ // right_align(width, padding)[...], where width is a integer value to be
+ // used as the field width and padding is a arbitrary generator
     // expression.
     ///////////////////////////////////////////////////////////////////////////
     struct full_right_aligment
@@ -181,28 +181,28 @@
         struct attribute
           : traits::attribute_of<
                 karma::domain,
- typename result_of::subject<Component>::type,
+ typename result_of::subject<Component>::type,
                 Context
>
         {
         };
 
- template <typename Component, typename OutputIterator,
+ template <typename Component, typename OutputIterator,
             typename Context, typename Delimiter, typename Parameter>
- static bool
- generate(Component const& component, OutputIterator& sink,
- Context& ctx, Delimiter const& d, Parameter const& param)
+ static bool
+ generate(Component const& component, OutputIterator& sink,
+ Context& ctx, Delimiter const& d, Parameter const& param)
         {
- return detail::right_align_generate(sink, ctx, d, param,
- subject(component), proto::arg_c<0>(argument1(component)),
+ return detail::right_align_generate(sink, ctx, d, param,
+ subject(component), proto::arg_c<0>(argument1(component)),
                 argument2(component));
         }
 
- template <typename Component>
- static std::string what(Component const& component)
+ template <typename Component, typename Context>
+ static std::string what(Component const& component, Context const& ctx)
         {
             std::string result = "right_align(";
-
+
             result += boost::lexical_cast<std::string>(
                 proto::arg_c<0>(argument1(component)));
             result += ", ";
@@ -211,19 +211,19 @@
                 spirit::result_of::argument2<Component>::type::director
             padding;
 
- result += padding::what(spirit::argument2(component));
+ result += padding::what(spirit::argument2(component), ctx);
             result += ")[";
 
             typedef typename
                 spirit::result_of::subject<Component>::type::director
             director;
 
- result += director::what(spirit::subject(component));
+ result += director::what(spirit::subject(component), ctx);
             result += "]";
             return result;
         }
     };
-
+
 }}} // namespace boost::spirit::karma
 
 #endif

Modified: branches/release/boost/spirit/home/karma/directive/verbatim.hpp
==============================================================================
--- branches/release/boost/spirit/home/karma/directive/verbatim.hpp (original)
+++ branches/release/boost/spirit/home/karma/directive/verbatim.hpp 2008-07-15 12:13:27 EDT (Tue, 15 Jul 2008)
@@ -55,8 +55,8 @@
             return false;
         }
 
- template <typename Component>
- static std::string what(Component const& component)
+ template <typename Component, typename Context>
+ static std::string what(Component const& component, Context const& ctx)
         {
             std::string result = "verbatim[";
 
@@ -64,7 +64,7 @@
                 spirit::result_of::right<Component>::type::director
             director;
 
- result += director::what(spirit::right(component));
+ result += director::what(spirit::right(component), ctx);
             result += "]";
             return result;
         }

Modified: branches/release/boost/spirit/home/karma/nonterminal/grammar.hpp
==============================================================================
--- branches/release/boost/spirit/home/karma/nonterminal/grammar.hpp (original)
+++ branches/release/boost/spirit/home/karma/nonterminal/grammar.hpp 2008-07-15 12:13:27 EDT (Tue, 15 Jul 2008)
@@ -8,7 +8,8 @@
 #define BOOST_SPIRIT_KARMA_GRAMMAR_MAR_05_2007_0542PM
 
 #include <boost/spirit/home/support/unused.hpp>
-#include <boost/spirit/home/support/nonterminal/nonterminal.hpp>
+#include <boost/spirit/home/karma/nonterminal/nonterminal.hpp>
+#include <boost/spirit/home/karma/nonterminal/grammar_fwd.hpp>
 #include <boost/spirit/home/karma/domain.hpp>
 #include <boost/spirit/home/karma/nonterminal/rule.hpp>
 #include <boost/spirit/home/karma/nonterminal/nonterminal_director.hpp>
@@ -17,100 +18,61 @@
 
 namespace boost { namespace spirit { namespace karma
 {
- template <typename Definition>
+ template <typename Iterator, typename T0 , typename T1 , typename T2>
     struct grammar
       : nonterminal<
- grammar<Definition>,
- typename Definition::sig_type,
- typename Definition::locals_type
- >
+ grammar<Iterator, T0, T1, T2>,
+ typename karma::rule<Iterator, T0, T1, T2>::sig_type,
+ typename karma::rule<Iterator, T0, T1, T2>::locals_type
+ >, noncopyable
     {
- typedef typename Definition::sig_type sig_type;
- typedef typename Definition::locals_type locals_type;
- typedef typename Definition::delimiter_type delimiter_type;
- typedef typename Definition::start_type start_type;
- typedef typename Definition::iterator_type iterator_type;
+ typedef Iterator iterator_type;
+ typedef karma::rule<Iterator, T0, T1, T2> start_type;
+ typedef typename start_type::sig_type sig_type;
+ typedef typename start_type::locals_type locals_type;
+ typedef typename start_type::delimiter_type delimiter_type;
+ typedef grammar<Iterator, T0, T1, T2> base_type;
+
+ grammar(start_type const& start, std::string const& name_ = std::string())
+ : start_(start), name_(name_)
+ {}
 
- explicit grammar(Definition const& definition_)
- : definition(definition_), start(definition_.start)
+ std::string name() const
         {
+ return name_;
         }
 
- template <typename Definition_, typename Start>
- grammar(Definition_ const& definition_, Start const& start_)
- : definition(definition_), start(start_)
+ void name(std::string const& name__)
         {
+ name_ = name__;
         }
 
+ start_type const& start_;
+ std::string name_;
+
     private:
         template <typename OutputIterator, typename Context, typename Delimiter>
         bool generate(OutputIterator& sink, Context& context,
             Delimiter const& delim) const
         {
- return start.generate(sink, context, delim);
+ return start_.generate(sink, context, delim);
         }
 
         std::string what() const
         {
- if (definition.name().empty())
+ if (name().empty())
             {
- return start.what();
+ return start_.what();
             }
             else
             {
- return definition.name();
+ return name();
             }
         }
 
         friend struct nonterminal_director;
- Definition const& definition;
- start_type const& start;
     };
 
- template <typename OutputIterator, typename T0 = unused_type,
- typename T1 = unused_type, typename T2 = unused_type>
- struct grammar_def : noncopyable
- {
- typedef karma::rule<OutputIterator, T0, T1, T2> start_type;
- typedef typename start_type::iterator_type iterator_type;
- typedef typename start_type::sig_type sig_type;
- typedef typename start_type::locals_type locals_type;
- typedef typename start_type::delimiter_type delimiter_type;
-
- grammar_def(std::string const& name_ = std::string())
- : name_(name_) {}
-
- std::string name() const
- {
- return name_;
- }
-
- void name(std::string const& name__)
- {
- name_ = name__;
- }
-
- std::string name_;
- };
-
- ///////////////////////////////////////////////////////////////////////////
- // Generator functions helping to construct a proper grammar object
- // instance
- ///////////////////////////////////////////////////////////////////////////
- template <typename Definition>
- inline grammar<Definition>
- make_generator(Definition const& def)
- {
- return grammar<Definition>(def);
- }
-
- template <typename Definition, typename Start>
- inline grammar<Definition>
- make_generator(Definition const& def, Start const& start)
- {
- return grammar<Definition>(def, start);
- }
-
 }}}
 
 #endif

Added: branches/release/boost/spirit/home/karma/nonterminal/grammar_fwd.hpp
==============================================================================
--- (empty file)
+++ branches/release/boost/spirit/home/karma/nonterminal/grammar_fwd.hpp 2008-07-15 12:13:27 EDT (Tue, 15 Jul 2008)
@@ -0,0 +1,26 @@
+/*=============================================================================
+ Copyright (c) 2001-2008 Joel de Guzman
+ Copyright (c) 2001-2008 Hartmut Kaiser
+
+ Distributed under the Boost Software License, Version 1.0. (See accompanying
+ file LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt)
+==============================================================================*/
+#if !defined(BOOST_SPIRIT_KARMA_GRAMMAR_FWD_JULY_13_2008_0924AM)
+#define BOOST_SPIRIT_KARMA_GRAMMAR_FWD_JULY_13_2008_0924AM
+
+#include <boost/spirit/home/support/unused.hpp>
+
+namespace boost { namespace spirit { namespace karma
+{
+ // forward declaration
+ template <
+ typename Iterator,
+ typename T0 = unused_type,
+ typename T1 = unused_type,
+ typename T2 = unused_type
+ >
+ struct grammar;
+
+}}}
+
+#endif

Modified: branches/release/boost/spirit/home/karma/nonterminal/nonterminal_director.hpp
==============================================================================
--- branches/release/boost/spirit/home/karma/nonterminal/nonterminal_director.hpp (original)
+++ branches/release/boost/spirit/home/karma/nonterminal/nonterminal_director.hpp 2008-07-15 12:13:27 EDT (Tue, 15 Jul 2008)
@@ -148,8 +148,8 @@
             return x.ptr->what();
         }
 
- template <typename Component>
- static std::string what(Component const& component)
+ template <typename Component, typename Context>
+ static std::string what(Component const& component, Context const& ctx)
         {
             return what_nonterminal(subject(component).held);
         }

Modified: branches/release/boost/spirit/home/karma/nonterminal/rule.hpp
==============================================================================
--- branches/release/boost/spirit/home/karma/nonterminal/rule.hpp (original)
+++ branches/release/boost/spirit/home/karma/nonterminal/rule.hpp 2008-07-15 12:13:27 EDT (Tue, 15 Jul 2008)
@@ -13,6 +13,7 @@
 
 #include <boost/spirit/home/support/unused.hpp>
 #include <boost/spirit/home/karma/nonterminal/nonterminal.hpp>
+#include <boost/spirit/home/karma/nonterminal/grammar_fwd.hpp>
 #include <boost/spirit/home/karma/nonterminal/detail/rule.hpp>
 #include <boost/spirit/home/karma/domain.hpp>
 #include <boost/spirit/home/karma/detail/output_iterator.hpp>
@@ -26,9 +27,6 @@
 
 namespace boost { namespace spirit { namespace karma
 {
- template <typename Definition>
- struct grammar; // forward declaration
-
     template <typename OutputIterator, typename T0 = unused_type,
         typename T1 = unused_type, typename T2 = unused_type>
     struct rule
@@ -140,7 +138,7 @@
 
     private:
 
- template <typename Definition>
+ template <typename Iterator_, typename T0_, typename T1_, typename T2_>
         friend struct grammar;
 
         template <typename Expr, typename Auto>

Modified: branches/release/boost/spirit/home/karma/numeric/int.hpp
==============================================================================
--- branches/release/boost/spirit/home/karma/numeric/int.hpp (original)
+++ branches/release/boost/spirit/home/karma/numeric/int.hpp 2008-07-15 12:13:27 EDT (Tue, 15 Jul 2008)
@@ -1,6 +1,6 @@
 // Copyright (c) 2001-2008 Hartmut Kaiser
-//
-// Distributed under the Boost Software License, Version 1.0. (See accompanying
+//
+// Distributed under the Boost Software License, Version 1.0. (See accompanying
 // file LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt)
 
 #if !defined(BOOST_SPIRIT_KARMA_INT_FEB_23_2007_0840PM)
@@ -25,8 +25,8 @@
 namespace boost { namespace spirit { namespace karma
 {
     ///////////////////////////////////////////////////////////////////////////
- // This specialization is used for int generators not having a direct
- // initializer: int_, long_ etc. These generators must be used in
+ // This specialization is used for int generators not having a direct
+ // initializer: int_, long_ etc. These generators must be used in
     // conjunction with a parameter.
     ///////////////////////////////////////////////////////////////////////////
     template <typename T, unsigned Radix, bool ForceSign, typename Tag>
@@ -45,44 +45,44 @@
 
         BOOST_MPL_ASSERT_MSG(std::numeric_limits<T>::is_signed,
             signed_unsigned_mismatch, ());
-
+
         // int has a parameter attached
- template <typename Component, typename OutputIterator,
+ template <typename Component, typename OutputIterator,
             typename Context, typename Delimiter, typename Parameter>
- static bool
- generate(Component const& /*component*/, OutputIterator& sink,
- Context& /*ctx*/, Delimiter const& d, Parameter const& param)
+ static bool
+ generate(Component const& /*component*/, OutputIterator& sink,
+ Context& /*ctx*/, Delimiter const& d, Parameter const& param)
         {
- sign_inserter<ForceSign>::call(sink, detail::is_zero(param),
+ sign_inserter<ForceSign>::call(sink, detail::is_zero(param),
                 detail::is_negative(param));
- bool result = int_inserter<Radix, Tag>::call(sink,
+ bool result = int_inserter<Radix, Tag>::call(sink,
                 detail::absolute_value(param));
- karma::delimit(sink, d); // always do post-delimiting
+ karma::delimit(sink, d); // always do post-delimiting
             return result;
         }
 
- // this int has no parameter attached, it needs to have been
+ // this int has no parameter attached, it needs to have been
         // initialized from a direct literal
- template <typename Component, typename OutputIterator,
+ template <typename Component, typename OutputIterator,
             typename Context, typename Delimiter>
- static bool
- generate(Component const&, OutputIterator&, Context&, Delimiter const&,
- unused_type)
+ static bool
+ generate(Component const&, OutputIterator&, Context&, Delimiter const&,
+ unused_type)
         {
             BOOST_MPL_ASSERT_MSG(false, int__not_usable_without_parameter, ());
             return false;
         }
 
- template <typename Component>
- static std::string what(Component const&)
+ template <typename Component, typename Context>
+ static std::string what(Component const& component, Context const& ctx)
         {
             return "integer";
         }
     };
 
     ///////////////////////////////////////////////////////////////////////////
- // This specialization is used for int generators having a direct
- // initializer: int_(10), long_(20) etc.
+ // This specialization is used for int generators having a direct
+ // initializer: int_(10), long_(20) etc.
     ///////////////////////////////////////////////////////////////////////////
     template <typename T, unsigned Radix, bool ForceSign, typename Tag>
     struct int_generator<true, T, Radix, ForceSign, Tag>
@@ -100,24 +100,24 @@
 
         BOOST_MPL_ASSERT_MSG(std::numeric_limits<T>::is_signed,
             signed_unsigned_mismatch, ());
-
- template <typename Component, typename OutputIterator,
+
+ template <typename Component, typename OutputIterator,
             typename Context, typename Delimiter, typename Parameter>
- static bool
- generate(Component const& component, OutputIterator& sink,
- Context& /*ctx*/, Delimiter const& d, Parameter const& /*param*/)
+ static bool
+ generate(Component const& component, OutputIterator& sink,
+ Context& /*ctx*/, Delimiter const& d, Parameter const& /*param*/)
         {
             T n = fusion::at_c<0>(component.elements);
- sign_inserter<ForceSign>::call(sink, detail::is_zero(n),
+ sign_inserter<ForceSign>::call(sink, detail::is_zero(n),
                 detail::is_negative(n));
- bool result = int_inserter<Radix, Tag>::call(sink,
+ bool result = int_inserter<Radix, Tag>::call(sink,
                 detail::absolute_value(n));
- karma::delimit(sink, d); // always do post-delimiting
+ karma::delimit(sink, d); // always do post-delimiting
             return result;
         }
 
- template <typename Component>
- static std::string what(Component const&)
+ template <typename Component, typename Context>
+ static std::string what(Component const& component, Context const& ctx)
         {
             return "integer";
         }
@@ -145,7 +145,7 @@
 
         typedef karma::int_generator<false, T, Radix, ForceSign, key_tag> int_type;
         typedef component<karma::domain, int_type, fusion::nil> type;
-
+
         static type
         call(Elements const&)
         {
@@ -166,14 +166,14 @@
         typedef spirit::char_class::tag::lower char_class_;
         typedef spirit::char_class::key<char_set, char_class_> key_tag;
 
- typedef typename
+ typedef typename
             fusion::result_of::value_at_c<Elements, 0>::type
         int_data_type;
         typedef fusion::vector<int_data_type> vector_type;
 
         typedef karma::int_generator<true, T, Radix, ForceSign, key_tag> int_type;
         typedef component<karma::domain, int_type, vector_type> type;
-
+
         static type
         call(Elements const& elements)
         {
@@ -199,7 +199,7 @@
 
         typedef karma::int_generator<false, T, Radix, ForceSign, key_tag> int_type;
         typedef component<karma::domain, int_type, fusion::nil> type;
-
+
         static type
         call(Elements const&)
         {
@@ -220,14 +220,14 @@
         typedef spirit::char_class::tag::upper char_class_;
         typedef spirit::char_class::key<char_set, char_class_> key_tag;
 
- typedef typename
+ typedef typename
             fusion::result_of::value_at_c<Elements, 0>::type
         int_data_type;
         typedef fusion::vector<int_data_type> vector_type;
 
         typedef karma::int_generator<true, T, Radix, ForceSign, key_tag> int_type;
         typedef component<karma::domain, int_type, vector_type> type;
-
+
         static type
         call(Elements const& elements)
         {

Modified: branches/release/boost/spirit/home/karma/numeric/real.hpp
==============================================================================
--- branches/release/boost/spirit/home/karma/numeric/real.hpp (original)
+++ branches/release/boost/spirit/home/karma/numeric/real.hpp 2008-07-15 12:13:27 EDT (Tue, 15 Jul 2008)
@@ -1,6 +1,6 @@
 // Copyright (c) 2001-2008 Hartmut Kaiser
-//
-// Distributed under the Boost Software License, Version 1.0. (See accompanying
+//
+// Distributed under the Boost Software License, Version 1.0. (See accompanying
 // file LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt)
 
 #if !defined(BOOST_SPIRIT_KARMA_REAL_FEB_26_2007_0512PM)
@@ -20,17 +20,17 @@
 #include <boost/spirit/home/karma/numeric/detail/numeric_utils.hpp>
 #include <cmath>
 
-namespace boost { namespace spirit { namespace karma
+namespace boost { namespace spirit { namespace karma
 {
     namespace detail
     {
         template <typename RealPolicies>
         struct real_policy;
     }
-
+
     ///////////////////////////////////////////////////////////////////////////
- // This specialization is used for real generators not having a direct
- // initializer: float_, double_ etc. These generators must be used in
+ // This specialization is used for real generators not having a direct
+ // initializer: float_, double_ etc. These generators must be used in
     // conjunction with a parameter.
     ///////////////////////////////////////////////////////////////////////////
     template <typename T, typename RealPolicies, typename Tag>
@@ -43,44 +43,44 @@
         };
 
         // double_/float_/etc. has a parameter attached
- template <typename Component, typename OutputIterator,
+ template <typename Component, typename OutputIterator,
             typename Context, typename Delimiter, typename Parameter>
- static bool
- generate(Component const& component, OutputIterator& sink,
- Context& /*ctx*/, Delimiter const& d, Parameter const& param)
+ static bool
+ generate(Component const& component, OutputIterator& sink,
+ Context& /*ctx*/, Delimiter const& d, Parameter const& param)
         {
             RealPolicies const& p = detail::real_policy<RealPolicies>::get(
                 fusion::at_c<0>(component.elements));
             bool result = real_inserter<T, RealPolicies, Tag>::
                 call(sink, param, p);
 
- karma::delimit(sink, d); // always do post-delimiting
+ karma::delimit(sink, d); // always do post-delimiting
             return result;
         }
 
- // this double_/float_/etc. has no parameter attached, it needs to have
+ // this double_/float_/etc. has no parameter attached, it needs to have
         // been initialized from a direct literal
- template <typename Component, typename OutputIterator,
+ template <typename Component, typename OutputIterator,
             typename Context, typename Delimiter>
- static bool
- generate(Component const&, OutputIterator&, Context&, Delimiter const&,
- unused_type)
+ static bool
+ generate(Component const&, OutputIterator&, Context&, Delimiter const&,
+ unused_type)
         {
- BOOST_MPL_ASSERT_MSG(false, real_not_usable_without_parameter,
+ BOOST_MPL_ASSERT_MSG(false, real_not_usable_without_parameter,
                 (Component, Context));
             return false;
         }
 
- template <typename Component>
- static std::string what(Component const&)
+ template <typename Component, typename Context>
+ static std::string what(Component const& component, Context const& ctx)
         {
             return "real number";
         }
     };
-
+
     ///////////////////////////////////////////////////////////////////////////
- // This specialization is used for real generators having a direct
- // initializer: float_(10.), double_(20.) etc.
+ // This specialization is used for real generators having a direct
+ // initializer: float_(10.), double_(20.) etc.
     ///////////////////////////////////////////////////////////////////////////
     template <typename T, typename RealPolicies, typename Tag>
     struct real_generator<true, T, RealPolicies, Tag>
@@ -91,28 +91,28 @@
             typedef unused_type type;
         };
 
- template <typename Component, typename OutputIterator,
+ template <typename Component, typename OutputIterator,
             typename Context, typename Delimiter, typename Parameter>
- static bool
- generate(Component const& component, OutputIterator& sink,
- Context& /*ctx*/, Delimiter const& d, Parameter const& /*param*/)
+ static bool
+ generate(Component const& component, OutputIterator& sink,
+ Context& /*ctx*/, Delimiter const& d, Parameter const& /*param*/)
         {
             RealPolicies const& p = detail::real_policy<RealPolicies>::get(
                 fusion::at_c<0>(component.elements));
             T n = fusion::at_c<1>(component.elements);
             bool result = real_inserter<T, RealPolicies, Tag>::call(sink, n, p);
 
- karma::delimit(sink, d); // always do post-delimiting
+ karma::delimit(sink, d); // always do post-delimiting
             return result;
         }
 
- template <typename Component>
- static std::string what(Component const&)
+ template <typename Component, typename Context>
+ static std::string what(Component const& component, Context const& ctx)
         {
             return "real number";
         }
     };
-
+
 }}}
 
 namespace boost { namespace spirit { namespace traits
@@ -133,14 +133,14 @@
         typedef spirit::char_class::tag::lower char_class_;
         typedef spirit::char_class::key<char_set, char_class_> key_tag;
 
- typedef typename
+ typedef typename
             fusion::result_of::value_at_c<Elements, 0>::type
         real_policy_type;
         typedef fusion::vector<real_policy_type> vector_type;
 
         typedef karma::real_generator<false, T, RealPolicies, key_tag> real_type;
         typedef component<karma::domain, real_type, vector_type> type;
-
+
         static type
         call(Elements const& elements)
         {
@@ -161,17 +161,17 @@
         typedef spirit::char_class::tag::lower char_class_;
         typedef spirit::char_class::key<char_set, char_class_> key_tag;
 
- typedef typename
+ typedef typename
             fusion::result_of::value_at_c<Elements, 0>::type
         real_policy_type;
- typedef typename
+ typedef typename
             fusion::result_of::value_at_c<Elements, 1>::type
         real_data_type;
         typedef fusion::vector<real_policy_type, real_data_type> vector_type;
 
         typedef karma::real_generator<true, T, RealPolicies, key_tag> real_type;
         typedef component<karma::domain, real_type, vector_type> type;
-
+
         static type
         call(Elements const& elements)
         {
@@ -195,14 +195,14 @@
         typedef spirit::char_class::tag::upper char_class_;
         typedef spirit::char_class::key<char_set, char_class_> key_tag;
 
- typedef typename
+ typedef typename
             fusion::result_of::value_at_c<Elements, 0>::type
         real_policy_type;
         typedef fusion::vector<real_policy_type> vector_type;
 
         typedef karma::real_generator<false, T, RealPolicies, key_tag> real_type;
         typedef component<karma::domain, real_type, vector_type> type;
-
+
         static type
         call(Elements const& elements)
         {
@@ -223,17 +223,17 @@
         typedef spirit::char_class::tag::upper char_class_;
         typedef spirit::char_class::key<char_set, char_class_> key_tag;
 
- typedef typename
+ typedef typename
             fusion::result_of::value_at_c<Elements, 0>::type
         real_policy_type;
- typedef typename
+ typedef typename
             fusion::result_of::value_at_c<Elements, 1>::type
         real_data_type;
         typedef fusion::vector<real_policy_type, real_data_type> vector_type;
 
         typedef karma::real_generator<true, T, RealPolicies, key_tag> real_type;
         typedef component<karma::domain, real_type, vector_type> type;
-
+
         static type
         call(Elements const& elements)
         {

Modified: branches/release/boost/spirit/home/karma/numeric/uint.hpp
==============================================================================
--- branches/release/boost/spirit/home/karma/numeric/uint.hpp (original)
+++ branches/release/boost/spirit/home/karma/numeric/uint.hpp 2008-07-15 12:13:27 EDT (Tue, 15 Jul 2008)
@@ -1,6 +1,6 @@
 // Copyright (c) 2001-2008 Hartmut Kaiser
-//
-// Distributed under the Boost Software License, Version 1.0. (See accompanying
+//
+// Distributed under the Boost Software License, Version 1.0. (See accompanying
 // file LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt)
 
 #if !defined(BOOST_SPIRIT_KARMA_UINT_FEB_23_2007_0840PM)
@@ -39,33 +39,33 @@
 
         BOOST_MPL_ASSERT_MSG(!std::numeric_limits<T>::is_signed,
             signed_unsigned_mismatch, ());
-
+
         // uint has a parameter attached
- template <typename Component, typename OutputIterator,
+ template <typename Component, typename OutputIterator,
             typename Context, typename Delimiter, typename Parameter>
- static bool
- generate(Component const& /*component*/, OutputIterator& sink,
- Context& /*ctx*/, Delimiter const& d, Parameter const& param)
+ static bool
+ generate(Component const& /*component*/, OutputIterator& sink,
+ Context& /*ctx*/, Delimiter const& d, Parameter const& param)
         {
             bool result = int_inserter<Radix, Tag>::call(sink, param);
- karma::delimit(sink, d); // always do post-delimiting
+ karma::delimit(sink, d); // always do post-delimiting
             return result;
         }
 
- // this uint has no parameter attached, it needs to have been
+ // this uint has no parameter attached, it needs to have been
         // initialized from a direct literal
- template <typename Component, typename OutputIterator,
+ template <typename Component, typename OutputIterator,
             typename Context, typename Delimiter>
- static bool
- generate(Component const&, OutputIterator&, Context&, Delimiter const&,
- unused_type)
+ static bool
+ generate(Component const&, OutputIterator&, Context&, Delimiter const&,
+ unused_type)
         {
             BOOST_MPL_ASSERT_MSG(false, uint_not_usable_without_parameter, ());
             return false;
         }
-
- template <typename Component>
- static std::string what(Component const&)
+
+ template <typename Component, typename Context>
+ static std::string what(Component const& component, Context const& ctx)
         {
             return "unsigned integer";
         }
@@ -87,21 +87,21 @@
 
         BOOST_MPL_ASSERT_MSG(!std::numeric_limits<T>::is_signed,
             signed_unsigned_mismatch, ());
-
- template <typename Component, typename OutputIterator,
+
+ template <typename Component, typename OutputIterator,
             typename Context, typename Delimiter, typename Parameter>
- static bool
- generate(Component const& component, OutputIterator& sink,
- Context& /*ctx*/, Delimiter const& d, Parameter const& /*param*/)
+ static bool
+ generate(Component const& component, OutputIterator& sink,
+ Context& /*ctx*/, Delimiter const& d, Parameter const& /*param*/)
         {
             T n = fusion::at_c<0>(component.elements);
             bool result = int_inserter<Radix, Tag>::call(sink, n);
- karma::delimit(sink, d); // always do post-delimiting
+ karma::delimit(sink, d); // always do post-delimiting
             return result;
         }
-
- template <typename Component>
- static std::string what(Component const&)
+
+ template <typename Component, typename Context>
+ static std::string what(Component const& component, Context const& ctx)
         {
             return "unsigned integer";
         }
@@ -129,7 +129,7 @@
 
         typedef karma::uint_generator<false, T, Radix, ForceSign, key_tag> int_type;
         typedef component<karma::domain, int_type, fusion::nil> type;
-
+
         static type
         call(Elements const&)
         {
@@ -150,14 +150,14 @@
         typedef spirit::char_class::tag::lower char_class_;
         typedef spirit::char_class::key<char_set, char_class_> key_tag;
 
- typedef typename
+ typedef typename
             fusion::result_of::value_at_c<Elements, 0>::type
         int_data_type;
         typedef fusion::vector<int_data_type> vector_type;
 
         typedef karma::uint_generator<true, T, Radix, ForceSign, key_tag> int_type;
         typedef component<karma::domain, int_type, vector_type> type;
-
+
         static type
         call(Elements const& elements)
         {
@@ -183,7 +183,7 @@
 
         typedef karma::uint_generator<false, T, Radix, ForceSign, key_tag> int_type;
         typedef component<karma::domain, int_type, fusion::nil> type;
-
+
         static type
         call(Elements const&)
         {
@@ -204,14 +204,14 @@
         typedef spirit::char_class::tag::upper char_class_;
         typedef spirit::char_class::key<char_set, char_class_> key_tag;
 
- typedef typename
+ typedef typename
             fusion::result_of::value_at_c<Elements, 0>::type
         int_data_type;
         typedef fusion::vector<int_data_type> vector_type;
 
         typedef karma::uint_generator<true, T, Radix, ForceSign, key_tag> int_type;
         typedef component<karma::domain, int_type, vector_type> type;
-
+
         static type
         call(Elements const& elements)
         {

Modified: branches/release/boost/spirit/home/karma/operator/alternative.hpp
==============================================================================
--- branches/release/boost/spirit/home/karma/operator/alternative.hpp (original)
+++ branches/release/boost/spirit/home/karma/operator/alternative.hpp 2008-07-15 12:13:27 EDT (Tue, 15 Jul 2008)
@@ -65,12 +65,12 @@
             return fusion::any(component.elements, f);
         }
 
- template <typename Component>
- static std::string what(Component const& component)
+ template <typename Component, typename Context>
+ static std::string what(Component const& component, Context const& ctx)
         {
             std::string result = "alternatives[";
             fusion::for_each(component.elements,
- spirit::detail::what_function(result));
+ spirit::detail::what_function<Context>(result, ctx));
             result += "]";
             return result;
         }

Modified: branches/release/boost/spirit/home/karma/operator/kleene.hpp
==============================================================================
--- branches/release/boost/spirit/home/karma/operator/kleene.hpp (original)
+++ branches/release/boost/spirit/home/karma/operator/kleene.hpp 2008-07-15 12:13:27 EDT (Tue, 15 Jul 2008)
@@ -72,8 +72,8 @@
 // return false;
 // }
 
- template <typename Component>
- static std::string what(Component const& component)
+ template <typename Component, typename Context>
+ static std::string what(Component const& component, Context const& ctx)
         {
             std::string result = "kleene[";
 
@@ -81,7 +81,7 @@
                 spirit::result_of::subject<Component>::type::director
             director;
 
- result += director::what(spirit::subject(component));
+ result += director::what(spirit::subject(component), ctx);
             result += "]";
             return result;
         }

Modified: branches/release/boost/spirit/home/karma/operator/list.hpp
==============================================================================
--- branches/release/boost/spirit/home/karma/operator/list.hpp (original)
+++ branches/release/boost/spirit/home/karma/operator/list.hpp 2008-07-15 12:13:27 EDT (Tue, 15 Jul 2008)
@@ -70,8 +70,8 @@
             return false;
         }
 
- template <typename Component>
- static std::string what(Component const& component)
+ template <typename Component, typename Context>
+ static std::string what(Component const& component, Context const& ctx)
         {
             std::string result = "list[";
 
@@ -83,9 +83,9 @@
                 spirit::result_of::right<Component>::type::director
             rdirector;
 
- result += ldirector::what(spirit::left(component));
+ result += ldirector::what(spirit::left(component), ctx);
             result += ", ";
- result += rdirector::what(spirit::right(component));
+ result += rdirector::what(spirit::right(component), ctx);
             result += "]";
             return result;
         }

Modified: branches/release/boost/spirit/home/karma/operator/optional.hpp
==============================================================================
--- branches/release/boost/spirit/home/karma/operator/optional.hpp (original)
+++ branches/release/boost/spirit/home/karma/operator/optional.hpp 2008-07-15 12:13:27 EDT (Tue, 15 Jul 2008)
@@ -79,8 +79,8 @@
             return true;
         }
 
- template <typename Component>
- static std::string what(Component const& component)
+ template <typename Component, typename Context>
+ static std::string what(Component const& component, Context const& ctx)
         {
             std::string result = "optional[";
 
@@ -88,7 +88,7 @@
                 spirit::result_of::subject<Component>::type::director
             director;
 
- result += director::what(spirit::subject(component));
+ result += director::what(spirit::subject(component), ctx);
             result += "]";
             return result;
         }

Modified: branches/release/boost/spirit/home/karma/operator/plus.hpp
==============================================================================
--- branches/release/boost/spirit/home/karma/operator/plus.hpp (original)
+++ branches/release/boost/spirit/home/karma/operator/plus.hpp 2008-07-15 12:13:27 EDT (Tue, 15 Jul 2008)
@@ -75,8 +75,8 @@
 // return false;
 // }
 
- template <typename Component>
- static std::string what(Component const& component)
+ template <typename Component, typename Context>
+ static std::string what(Component const& component, Context const& ctx)
         {
             std::string result = "plus[";
 
@@ -84,7 +84,7 @@
                 spirit::result_of::subject<Component>::type::director
             director;
 
- result += director::what(spirit::subject(component));
+ result += director::what(spirit::subject(component), ctx);
             result += "]";
             return result;
         }

Modified: branches/release/boost/spirit/home/karma/operator/sequence.hpp
==============================================================================
--- branches/release/boost/spirit/home/karma/operator/sequence.hpp (original)
+++ branches/release/boost/spirit/home/karma/operator/sequence.hpp 2008-07-15 12:13:27 EDT (Tue, 15 Jul 2008)
@@ -73,12 +73,12 @@
             return !spirit::any_if(component.elements, param, f, predicate());
         }
 
- template <typename Component>
- static std::string what(Component const& component)
+ template <typename Component, typename Context>
+ static std::string what(Component const& component, Context const& ctx)
         {
             std::string result = "sequence[";
             fusion::for_each(component.elements,
- spirit::detail::what_function(result));
+ spirit::detail::what_function<Context>(result, ctx));
             result += "]";
             return result;
         }

Modified: branches/release/boost/spirit/home/karma/stream/stream.hpp
==============================================================================
--- branches/release/boost/spirit/home/karma/stream/stream.hpp (original)
+++ branches/release/boost/spirit/home/karma/stream/stream.hpp 2008-07-15 12:13:27 EDT (Tue, 15 Jul 2008)
@@ -17,20 +17,20 @@
 #include <iosfwd>
 
 ///////////////////////////////////////////////////////////////////////////////
-namespace boost { namespace spirit
-{
+namespace boost { namespace spirit
+{
     // overload the streaming operators for the unused_type
     template <typename Char, typename Traits>
- inline std::basic_ostream<Char, Traits>&
+ inline std::basic_ostream<Char, Traits>&
     operator<< (std::basic_ostream<Char, Traits>& os, unused_type)
     {
         return os;
     }
-
+
 }}
 
 ///////////////////////////////////////////////////////////////////////////////
-namespace boost { namespace spirit { namespace karma
+namespace boost { namespace spirit { namespace karma
 {
     template <typename Char>
     struct any_stream
@@ -42,24 +42,24 @@
         };
 
         // any_stream has a parameter attached
-
+
         // this overload will be used in the normal case (not called from
         // format_manip).
- template <typename Component, typename OutputIterator,
+ template <typename Component, typename OutputIterator,
             typename Context, typename Delimiter, typename Parameter>
- static bool
- generate(Component const& component, OutputIterator& sink,
- Context& /*ctx*/, Delimiter const& d, Parameter const& param)
+ static bool
+ generate(Component const& component, OutputIterator& sink,
+ Context& /*ctx*/, Delimiter const& d, Parameter const& param)
         {
- typedef
- karma::detail::iterator_sink<OutputIterator, Char>
+ typedef
+ karma::detail::iterator_sink<OutputIterator, Char>
             sink_device;
 
             iostreams::stream<sink_device> ostr(sink);
             ostr << param << std::flush; // use existing operator<<()
-
+
             if (ostr.good()) {
- karma::delimit(sink, d); // always do post-delimiting
+ karma::delimit(sink, d); // always do post-delimiting
                 return true;
             }
             return false;
@@ -68,48 +68,48 @@
         // this is a special overload to detect if the output iterator has been
         // generated by a format_manip object.
         template <
- typename Component, typename T, typename Traits,
+ typename Component, typename T, typename Traits,
             typename Context, typename Delimiter, typename Parameter
>
- static bool
- generate(Component const& component,
+ static bool
+ generate(Component const& component,
             karma::detail::output_iterator<
- karma::detail::ostream_iterator<T, Char, Traits>
- >& sink, Context&, Delimiter const& d, Parameter const& param)
+ karma::detail::ostream_iterator<T, Char, Traits>
+ >& sink, Context&, Delimiter const& d, Parameter const& param)
         {
             typedef karma::detail::output_iterator<
- karma::detail::ostream_iterator<T, Char, Traits>
+ karma::detail::ostream_iterator<T, Char, Traits>
> output_iterator;
- typedef
- karma::detail::iterator_sink<output_iterator, Char>
+ typedef
+ karma::detail::iterator_sink<output_iterator, Char>
             sink_device;
 
             iostreams::stream<sink_device> ostr(sink);
             ostr.imbue(sink.get_ostream().getloc());
             ostr << param << std::flush; // use existing operator<<()
-
+
             if (ostr.good()) {
- karma::delimit(sink, d); // always do post-delimiting
+ karma::delimit(sink, d); // always do post-delimiting
                 return true;
             }
             return false;
         }
-
- // this any_stream has no parameter attached, it needs to have been
+
+ // this any_stream has no parameter attached, it needs to have been
         // initialized from a value/variable
- template <typename Component, typename OutputIterator,
+ template <typename Component, typename OutputIterator,
             typename Context, typename Delimiter>
- static bool
- generate(Component const&, OutputIterator&, Context&, Delimiter const&,
- unused_type)
+ static bool
+ generate(Component const&, OutputIterator&, Context&, Delimiter const&,
+ unused_type)
         {
- BOOST_MPL_ASSERT_MSG(false, stream__not_usable_without_parameter,
+ BOOST_MPL_ASSERT_MSG(false, stream__not_usable_without_parameter,
               (Component, OutputIterator, Delimiter));
             return false;
         }
 
- template <typename Component>
- static std::string what(Component const& component)
+ template <typename Component, typename Context>
+ static std::string what(Component const& component, Context const& ctx)
         {
             return "any-stream";
         }
@@ -126,22 +126,22 @@
         };
 
         // stream_director has a parameter attached
- template <typename Component, typename OutputIterator,
+ template <typename Component, typename OutputIterator,
             typename Context, typename Delimiter, typename Parameter>
- static bool
- generate(Component const& component, OutputIterator& sink,
- Context& /*ctx*/, Delimiter const& d, Parameter const&)
+ static bool
+ generate(Component const& component, OutputIterator& sink,
+ Context& /*ctx*/, Delimiter const& d, Parameter const&)
         {
- typedef
- karma::detail::iterator_sink<OutputIterator, Char>
+ typedef
+ karma::detail::iterator_sink<OutputIterator, Char>
             sink_device;
 
             // use existing operator<<()
             iostreams::stream<sink_device> ostr(sink);
- ostr << fusion::at_c<0>(component.elements) << std::flush;
-
+ ostr << fusion::at_c<0>(component.elements) << std::flush;
+
             if (ostr.good()) {
- karma::delimit(sink, d); // always do post-delimiting
+ karma::delimit(sink, d); // always do post-delimiting
                 return true;
             }
             return false;
@@ -150,41 +150,41 @@
         // this is a special overload to detect if the output iterator has been
         // generated by a format_manip object.
         template <
- typename Component, typename T, typename Traits,
+ typename Component, typename T, typename Traits,
             typename Context, typename Delimiter, typename Parameter
>
- static bool
- generate(Component const& component,
+ static bool
+ generate(Component const& component,
             karma::detail::output_iterator<
- karma::detail::ostream_iterator<T, Char, Traits>
- >& sink, Context&, Delimiter const& d, Parameter const&)
+ karma::detail::ostream_iterator<T, Char, Traits>
+ >& sink, Context&, Delimiter const& d, Parameter const&)
         {
             typedef karma::detail::output_iterator<
- karma::detail::ostream_iterator<T, Char, Traits>
+ karma::detail::ostream_iterator<T, Char, Traits>
> output_iterator;
- typedef
- karma::detail::iterator_sink<output_iterator, Char>
+ typedef
+ karma::detail::iterator_sink<output_iterator, Char>
             sink_device;
 
             // use existing operator<<()
             iostreams::stream<sink_device> ostr(sink);
             ostr.imbue(sink.get_ostream().getloc());
- ostr << fusion::at_c<0>(component.elements) << std::flush;
-
+ ostr << fusion::at_c<0>(component.elements) << std::flush;
+
             if (ostr.good()) {
- karma::delimit(sink, d); // always do post-delimiting
+ karma::delimit(sink, d); // always do post-delimiting
                 return true;
             }
             return false;
         }
-
- template <typename Component>
- static std::string what(Component const& component)
+
+ template <typename Component, typename Context>
+ static std::string what(Component const& component, Context const& ctx)
         {
             return "stream";
         }
     };
-
+
 }}}
 
 #endif

Modified: branches/release/boost/spirit/home/karma/string/lit.hpp
==============================================================================
--- branches/release/boost/spirit/home/karma/string/lit.hpp (original)
+++ branches/release/boost/spirit/home/karma/string/lit.hpp 2008-07-15 12:13:27 EDT (Tue, 15 Jul 2008)
@@ -1,6 +1,6 @@
 // Copyright (c) 2001-2008 Hartmut Kaiser
-//
-// Distributed under the Boost Software License, Version 1.0. (See accompanying
+//
+// Distributed under the Boost Software License, Version 1.0. (See accompanying
 // file LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt)
 
 #if !defined(BOOST_SPIRIT_KARMA_LIT_FEB_22_2007_0534PM)
@@ -35,32 +35,32 @@
         };
 
         // lit has a parameter attached
- template <typename Component, typename OutputIterator,
+ template <typename Component, typename OutputIterator,
             typename Context, typename Delimiter, typename Parameter>
- static bool
- generate(Component const& /*component*/, OutputIterator& sink,
- Context& /*ctx*/, Delimiter const& d, Parameter const& param)
+ static bool
+ generate(Component const& /*component*/, OutputIterator& sink,
+ Context& /*ctx*/, Delimiter const& d, Parameter const& param)
         {
             bool result = detail::string_generate(sink, param);
             if (result)
- karma::delimit(sink, d); // always do post-delimiting
+ karma::delimit(sink, d); // always do post-delimiting
             return result;
         }
 
- // this lit has no parameter attached, it needs to have been
+ // this lit has no parameter attached, it needs to have been
         // initialized from a direct literal
- template <typename Component, typename OutputIterator,
+ template <typename Component, typename OutputIterator,
             typename Context, typename Delimiter>
- static bool
- generate(Component const& component, OutputIterator& sink,
- Context& /*ctx*/, Delimiter const& d, unused_type)
+ static bool
+ generate(Component const& component, OutputIterator& sink,
+ Context& /*ctx*/, Delimiter const& d, unused_type)
         {
             BOOST_MPL_ASSERT_MSG(false, lit_not_usable_without_parameter, ());
             return false;
         }
 
- template <typename Component>
- static std::string what(Component const&)
+ template <typename Component, typename Context>
+ static std::string what(Component const& component, Context const& ctx)
         {
             return "any-string";
         }
@@ -78,21 +78,21 @@
             typedef unused_type type;
         };
 
- template <typename Component, typename OutputIterator,
+ template <typename Component, typename OutputIterator,
             typename Context, typename Delimiter, typename Parameter>
- static bool
- generate(Component const& component, OutputIterator& sink,
- Context& /*ctx*/, Delimiter const& d, Parameter const& /*param*/)
+ static bool
+ generate(Component const& component, OutputIterator& sink,
+ Context& /*ctx*/, Delimiter const& d, Parameter const& /*param*/)
         {
             bool result = detail::string_generate(sink,
                 fusion::at_c<0>(component.elements));
-
- karma::delimit(sink, d); // always do post-delimiting
+
+ karma::delimit(sink, d); // always do post-delimiting
             return result;
         }
 
- template <typename Component>
- static std::string what(Component const& component)
+ template <typename Component, typename Context>
+ static std::string what(Component const& component, Context const& ctx)
         {
             return std::string("\"")
                 + spirit::detail::to_narrow_string(
@@ -113,21 +113,21 @@
             typedef unused_type type;
         };
 
- template <typename Component, typename OutputIterator,
+ template <typename Component, typename OutputIterator,
             typename Context, typename Delimiter, typename Parameter>
- static bool
- generate(Component const& component, OutputIterator& sink,
- Context& ctx, Delimiter const& d, Parameter const& /*param*/)
+ static bool
+ generate(Component const& component, OutputIterator& sink,
+ Context& ctx, Delimiter const& d, Parameter const& /*param*/)
         {
             bool result = detail::string_generate(sink,
                 fusion::at_c<0>(component.elements)(unused, ctx));
-
- karma::delimit(sink, d); // always do post-delimiting
+
+ karma::delimit(sink, d); // always do post-delimiting
             return result;
         }
 
- template <typename Component>
- static std::string what(Component const&)
+ template <typename Component, typename Context>
+ static std::string what(Component const& component, Context const& ctx)
         {
             return "string";
         }
@@ -146,36 +146,36 @@
         };
 
         // case_any_string has a parameter attached
- template <typename Component, typename OutputIterator,
+ template <typename Component, typename OutputIterator,
             typename Context, typename Delimiter, typename Parameter>
- static bool
- generate(Component const& /*component*/, OutputIterator& sink,
- Context& /*ctx*/, Delimiter const& d, Parameter const& param)
+ static bool
+ generate(Component const& /*component*/, OutputIterator& sink,
+ Context& /*ctx*/, Delimiter const& d, Parameter const& param)
         {
             bool result = detail::string_generate(sink, param, Tag());
- karma::delimit(sink, d); // always do post-delimiting
+ karma::delimit(sink, d); // always do post-delimiting
             return result;
         }
 
- // this case_any_string has no parameter attached, it needs to have been
+ // this case_any_string has no parameter attached, it needs to have been
         // initialized from a direct literal
- template <typename Component, typename OutputIterator,
+ template <typename Component, typename OutputIterator,
             typename Context, typename Delimiter>
- static bool
- generate(Component const& component, OutputIterator& sink,
- Context& /*ctx*/, Delimiter const& d, unused_type)
+ static bool
+ generate(Component const& component, OutputIterator& sink,
+ Context& /*ctx*/, Delimiter const& d, unused_type)
         {
             BOOST_MPL_ASSERT_MSG(false, lit_not_usable_without_parameter, ());
             return false;
         }
 
 
- template <typename Component>
- static std::string what(Component const&)
+ template <typename Component, typename Context>
+ static std::string what(Component const& component, Context const& ctx)
         {
             typedef typename Tag::char_set char_set;
             typedef typename Tag::char_class char_class_;
- return std::string("any-") +
+ return std::string("any-") +
                 spirit::char_class::what<char_set>::is(char_class_())
                 + "case-string";
         }
@@ -200,18 +200,18 @@
         typedef std::basic_string<Char> string_type;
         typedef fusion::vector<string_type> vector_type;
 
- typedef
- component<karma::domain, karma::literal_string<Char>, vector_type>
+ typedef
+ component<karma::domain, karma::literal_string<Char>, vector_type>
         type;
-
+
         static type
         call(Elements const& elements)
         {
             typedef typename Modifier::char_set char_set;
-
+
             string_type val(fusion::at_c<0>(elements));
             typename string_type::iterator end = val.end();
- for (typename string_type::iterator it = val.begin();
+ for (typename string_type::iterator it = val.begin();
                  it != end; ++it)
             {
                 *it = char_set::tolower(*it);
@@ -233,18 +233,18 @@
         typedef std::basic_string<Char> string_type;
         typedef fusion::vector<string_type> vector_type;
 
- typedef
- component<karma::domain, karma::literal_string<Char>, vector_type>
+ typedef
+ component<karma::domain, karma::literal_string<Char>, vector_type>
         type;
-
+
         static type
         call(Elements const& elements)
         {
             typedef typename Modifier::char_set char_set;
-
+
             string_type val(fusion::at_c<0>(elements));
             typename string_type::iterator end = val.end();
- for (typename string_type::iterator it = val.begin();
+ for (typename string_type::iterator it = val.begin();
                  it != end; ++it)
             {
                 *it = char_set::toupper(*it);
@@ -269,11 +269,11 @@
         typedef typename Modifier::char_set char_set;
         typedef spirit::char_class::tag::lower char_class_;
         typedef spirit::char_class::key<char_set, char_class_> key_tag;
-
+
         typedef component<
             karma::domain, karma::case_any_string<Char, key_tag>, fusion::nil
> type;
-
+
         static type
         call(Elements const&)
         {
@@ -293,11 +293,11 @@
         typedef typename Modifier::char_set char_set;
         typedef spirit::char_class::tag::upper char_class_;
         typedef spirit::char_class::key<char_set, char_class_> key_tag;
-
+
         typedef component<
             karma::domain, karma::case_any_string<Char, key_tag>, fusion::nil
> type;
-
+
         static type
         call(Elements const&)
         {

Modified: branches/release/boost/spirit/home/karma/what.hpp
==============================================================================
--- branches/release/boost/spirit/home/karma/what.hpp (original)
+++ branches/release/boost/spirit/home/karma/what.hpp 2008-07-15 12:13:27 EDT (Tue, 15 Jul 2008)
@@ -28,7 +28,7 @@
         typedef typename component::director director;
 
         component c = spirit::as_component(karma::domain(), xpr);
- return director::what(c);
+ return director::what(c, unused);
     }
 }}}
 

Modified: branches/release/boost/spirit/home/lex/lexer/terminal_director.hpp
==============================================================================
--- branches/release/boost/spirit/home/lex/lexer/terminal_director.hpp (original)
+++ branches/release/boost/spirit/home/lex/lexer/terminal_director.hpp 2008-07-15 12:13:27 EDT (Tue, 15 Jul 2008)
@@ -45,8 +45,8 @@
                 first, last, context, skipper, attr);
         }
 
- template <typename Component>
- static std::string what(Component const& component)
+ template <typename Component, typename Context>
+ static std::string what(Component const& component, Context const& ctx)
         {
             return subject(component).held->what();
         }

Modified: branches/release/boost/spirit/home/lex/qi/state/state_switcher.hpp
==============================================================================
--- branches/release/boost/spirit/home/lex/qi/state/state_switcher.hpp (original)
+++ branches/release/boost/spirit/home/lex/qi/state/state_switcher.hpp 2008-07-15 12:13:27 EDT (Tue, 15 Jul 2008)
@@ -71,8 +71,8 @@
             return true;
         }
 
- template <typename Component>
- static std::string what(Component const& component)
+ template <typename Component, typename Context>
+ static std::string what(Component const& component, Context const& ctx)
         {
             std::string result("set_state(\"");
             result += spirit::detail::to_narrow_string(
@@ -148,8 +148,8 @@
                 last, context, skipper, attr);
         }
 
- template <typename Component>
- static std::string what(Component const& component)
+ template <typename Component, typename Context>
+ static std::string what(Component const& component, Context const& ctx)
         {
             std::string result("in_state(\"");
             result += spirit::detail::to_narrow_string(
@@ -160,7 +160,7 @@
                 spirit::result_of::subject<Component>::type::director
             director;
 
- result += director::what(subject(component));
+ result += director::what(subject(component), ctx);
             result += "]";
             return result;
         }

Modified: branches/release/boost/spirit/home/lex/qi/utility/plain_token.hpp
==============================================================================
--- branches/release/boost/spirit/home/lex/qi/utility/plain_token.hpp (original)
+++ branches/release/boost/spirit/home/lex/qi/utility/plain_token.hpp 2008-07-15 12:13:27 EDT (Tue, 15 Jul 2008)
@@ -56,8 +56,8 @@
             return false;
         }
         
- template <typename Component>
- static std::string what(Component const& component)
+ template <typename Component, typename Context>
+ static std::string what(Component const& component, Context const& ctx)
         {
             std::string result("token(\"");
             result += lexical_cast<std::string>(

Modified: branches/release/boost/spirit/home/lex/tokenize_and_parse.hpp
==============================================================================
--- branches/release/boost/spirit/home/lex/tokenize_and_parse.hpp (original)
+++ branches/release/boost/spirit/home/lex/tokenize_and_parse.hpp 2008-07-15 12:13:27 EDT (Tue, 15 Jul 2008)
@@ -82,21 +82,6 @@
     }
 
     ///////////////////////////////////////////////////////////////////////////
- template <
- typename Iterator, typename LexerExpr,
- template <typename, typename> class Def
- >
- inline bool
- tokenize_and_parse(Iterator& first, Iterator last, LexerExpr const& lex,
- qi::grammar_class<Def>& gc)
- {
- typedef typename LexerExpr::iterator_type iterator_type;
- Def<iterator_type, unused_type> def(gc);
- qi::grammar<Def<iterator_type, unused_type> > g(def);
- return tokenize_and_parse(first, last, lex, g);
- }
-
- ///////////////////////////////////////////////////////////////////////////
     template <typename Iterator, typename LexerExpr, typename ParserExpr,
         typename Attribute>
     inline bool
@@ -123,21 +108,6 @@
     }
 
     ///////////////////////////////////////////////////////////////////////////
- template <
- typename Iterator, typename LexerExpr,
- template <typename, typename> class Def, typename Attribute
- >
- inline bool
- tokenize_and_parse(Iterator& first, Iterator last, LexerExpr const& lex,
- qi::grammar_class<Def>& gc, Attribute& attr)
- {
- typedef typename LexerExpr::iterator_type iterator_type;
- Def<iterator_type, unused_type> def(gc);
- qi::grammar<Def<iterator_type, unused_type> > g(def);
- return tokenize_and_parse(first, last, lex, g, attr);
- }
-
- ///////////////////////////////////////////////////////////////////////////
     //
     // The tokenize_and_phrase_parse() function is one of the main Spirit API
     // functions. It simplifies using a lexer as the underlying token source
@@ -229,21 +199,6 @@
 
     ///////////////////////////////////////////////////////////////////////////
     template <
- typename Iterator, typename LexerExpr,
- template <typename, typename> class Def, typename Skipper
- >
- inline bool
- tokenize_and_phrase_parse(Iterator& first, Iterator last,
- LexerExpr const& lex, qi::grammar_class<Def>& gc, Skipper const& skipper)
- {
- typedef typename LexerExpr::iterator_type iterator_type;
- Def<iterator_type, unused_type> def(gc);
- qi::grammar<Def<iterator_type, unused_type> > g(def);
- return tokenize_and_phrase_parse(first, last, lex, g, skipper);
- }
-
- ///////////////////////////////////////////////////////////////////////////
- template <
         typename Iterator, typename LexerExpr, typename ParserExpr,
         typename Attribute, typename Skipper
>
@@ -288,23 +243,6 @@
     }
 
     ///////////////////////////////////////////////////////////////////////////
- template <
- typename Iterator, typename LexerExpr,
- template <typename, typename> class Def,
- typename Skipper, typename Attribute
- >
- inline bool
- tokenize_and_phrase_parse(Iterator& first, Iterator last,
- LexerExpr const& lex, qi::grammar_class<Def>& gc, Skipper const& skipper,
- Attribute& attr)
- {
- typedef typename LexerExpr::iterator_type iterator_type;
- Def<iterator_type, unused_type> def(gc);
- qi::grammar<Def<iterator_type, unused_type> > g(def);
- return tokenize_and_phrase_parse(first, last, lex, g, skipper, attr);
- }
-
- ///////////////////////////////////////////////////////////////////////////
     //
     // The tokenize() function is one of the main Spirit API functions. It
     // simplifies using a lexer to tokenize a given input sequence. It's main

Modified: branches/release/boost/spirit/home/qi/action/action.hpp
==============================================================================
--- branches/release/boost/spirit/home/qi/action/action.hpp (original)
+++ branches/release/boost/spirit/home/qi/action/action.hpp 2008-07-15 12:13:27 EDT (Tue, 15 Jul 2008)
@@ -81,14 +81,14 @@
             return false;
         }
 
- template <typename Component>
- static std::string what(Component const& component)
+ template <typename Component, typename Context>
+ static std::string what(Component const& component, Context const& ctx)
         {
             typedef typename
                 result_of::left<Component>::type::director
             director;
 
- return director::what(spirit::left(component));
+ return director::what(spirit::left(component), ctx);
         }
     };
 }}}

Modified: branches/release/boost/spirit/home/qi/auxiliary/eps.hpp
==============================================================================
--- branches/release/boost/spirit/home/qi/auxiliary/eps.hpp (original)
+++ branches/release/boost/spirit/home/qi/auxiliary/eps.hpp 2008-07-15 12:13:27 EDT (Tue, 15 Jul 2008)
@@ -36,8 +36,8 @@
             return true;
         }
 
- template <typename Component>
- static std::string what(Component const&)
+ template <typename Component, typename Context>
+ static std::string what(Component const& component, Context const& ctx)
         {
             return "eps";
         }
@@ -65,8 +65,8 @@
             return fusion::at_c<0>(component.elements)(unused, context);
         }
 
- template <typename Component>
- static std::string what(Component const&)
+ template <typename Component, typename Context>
+ static std::string what(Component const& component, Context const& ctx)
         {
             return "semantic-predicate";
         }

Modified: branches/release/boost/spirit/home/qi/auxiliary/functor_director.hpp
==============================================================================
--- branches/release/boost/spirit/home/qi/auxiliary/functor_director.hpp (original)
+++ branches/release/boost/spirit/home/qi/auxiliary/functor_director.hpp 2008-07-15 12:13:27 EDT (Tue, 15 Jul 2008)
@@ -40,8 +40,8 @@
             return subject(component).held->parse(first, last, context, attr);
         }
 
- template <typename Component>
- static std::string what(Component const&)
+ template <typename Component, typename Context>
+ static std::string what(Component const& component, Context const& ctx)
         {
             return "functor";
         }

Modified: branches/release/boost/spirit/home/qi/auxiliary/lazy.hpp
==============================================================================
--- branches/release/boost/spirit/home/qi/auxiliary/lazy.hpp (original)
+++ branches/release/boost/spirit/home/qi/auxiliary/lazy.hpp 2008-07-15 12:13:27 EDT (Tue, 15 Jul 2008)
@@ -74,8 +74,8 @@
                 parse(subject, first, last, context, skipper, attr);
         }
 
- template <typename Component>
- static std::string what(Component const&)
+ template <typename Component, typename Context>
+ static std::string what(Component const& component, Context const& ctx)
         {
             //~ typedef typename
                 //~ result_of::subject<Component>::type
@@ -96,7 +96,7 @@
                     //~ qi::domain(), fusion::at_c<0>(component.elements)(unused, unused));
 
             std::string result = "lazy[";
- //~ result += component_type::director::what(subject);
+ //~ result += component_type::director::what(subject, ctx);
             result += "]";
             return result;
         }

Modified: branches/release/boost/spirit/home/qi/auxiliary/none.hpp
==============================================================================
--- branches/release/boost/spirit/home/qi/auxiliary/none.hpp (original)
+++ branches/release/boost/spirit/home/qi/auxiliary/none.hpp 2008-07-15 12:13:27 EDT (Tue, 15 Jul 2008)
@@ -35,8 +35,8 @@
             return false;
         }
 
- template <typename Component>
- static std::string what(Component const&)
+ template <typename Component, typename Context>
+ static std::string what(Component const& component, Context const& ctx)
         {
             return "none";
         }

Modified: branches/release/boost/spirit/home/qi/auxiliary/primitives.hpp
==============================================================================
--- branches/release/boost/spirit/home/qi/auxiliary/primitives.hpp (original)
+++ branches/release/boost/spirit/home/qi/auxiliary/primitives.hpp 2008-07-15 12:13:27 EDT (Tue, 15 Jul 2008)
@@ -20,7 +20,7 @@
     struct end_director_base
     {
         typedef mpl::false_ stores_iterator;
-
+
         template <typename Component, typename Context, typename Iterator>
         struct attribute
         {
@@ -46,7 +46,7 @@
         template <typename Iterator>
         bool test(Iterator& first, Iterator const& last);
     };
-
+
     ///////////////////////////////////////////////////////////////////////////
     // same as end_director_base above, but stores iterator
     ///////////////////////////////////////////////////////////////////////////
@@ -86,13 +86,13 @@
         template <typename Iterator>
         bool test(Iterator& first, Iterator const& last);
     };
-
+
     ///////////////////////////////////////////////////////////////////////////
     // ~eoi, ~eol: 'not end of line' or 'not end of input'
     template <typename Positive>
- struct negated_end_director
+ struct negated_end_director
       : end_director_base<
- negated_end_director<Positive>,
+ negated_end_director<Positive>,
             typename Positive::director::stores_iterator
>
     {
@@ -102,11 +102,11 @@
             return !Positive::director::test(first, last);
         }
 
- template <typename Component>
- static std::string what(Component const&component)
+ template <typename Component, typename Context>
+ static std::string what(Component const& component, Context const& ctx)
         {
- return "not " +
- Positive::director::what(fusion::at_c<0>(component.elements));
+ return "not " +
+ Positive::director::what(fusion::at_c<0>(component.elements), ctx);
         }
     };
 
@@ -119,15 +119,15 @@
         {
             return first == last;
         }
-
- template <typename Component>
- static std::string what(Component const&)
+
+ template <typename Component, typename Context>
+ static std::string what(Component const& component, Context const& ctx)
         {
             return "eoi";
         }
     };
-
-
+
+
     ///////////////////////////////////////////////////////////////////////////
     // the eol_director matches line endings
     ///////////////////////////////////////////////////////////////////////////
@@ -150,13 +150,13 @@
             return matched;
         }
 
- template <typename Component>
- static std::string what(Component const&)
+ template <typename Component, typename Context>
+ static std::string what(Component const& component, Context const& ctx)
         {
             return "eol";
         }
     };
-
+
 ///////////////////////////////////////////////////////////////////////////////
 }}}
 

Modified: branches/release/boost/spirit/home/qi/binary/binary.hpp
==============================================================================
--- branches/release/boost/spirit/home/qi/binary/binary.hpp (original)
+++ branches/release/boost/spirit/home/qi/binary/binary.hpp 2008-07-15 12:13:27 EDT (Tue, 15 Jul 2008)
@@ -136,8 +136,8 @@
             return true;
         }
 
- template <typename Component>
- static std::string what(Component const&)
+ template <typename Component, typename Context>
+ static std::string what(Component const& component, Context const& ctx)
         {
             return qi::detail::what<endian>::is();
         }
@@ -182,8 +182,8 @@
             return true;
         }
 
- template <typename Component>
- static std::string what(Component const&)
+ template <typename Component, typename Context>
+ static std::string what(Component const& component, Context const& ctx)
         {
             return qi::detail::what<endian>::is();
         }

Modified: branches/release/boost/spirit/home/qi/char/char.hpp
==============================================================================
--- branches/release/boost/spirit/home/qi/char/char.hpp (original)
+++ branches/release/boost/spirit/home/qi/char/char.hpp 2008-07-15 12:13:27 EDT (Tue, 15 Jul 2008)
@@ -35,8 +35,8 @@
             return true;
         }
 
- template <typename Component>
- static std::string what(Component const&)
+ template <typename Component, typename Context>
+ static std::string what(Component const& component, Context const& ctx)
         {
             return "any-char";
         }
@@ -60,8 +60,8 @@
             return detail::get_char(fusion::at_c<0>(component.elements)) == ch;
         }
 
- template <typename Component>
- static std::string what(Component const& component)
+ template <typename Component, typename Context>
+ static std::string what(Component const& component, Context const& ctx)
         {
             return std::string("'")
                 + spirit::detail::to_narrow_char(
@@ -82,8 +82,8 @@
             return component.ptr->test(ch);
         }
 
- template <typename Component>
- static std::string what(Component const&)
+ template <typename Component, typename Context>
+ static std::string what(Component const& component, Context const& ctx)
         {
             return "char-set";
         }
@@ -114,10 +114,13 @@
             return fusion::at_c<0>(component.elements)(unused, context) == ch;
         }
 
- template <typename Component>
- static std::string what(Component const&)
+ template <typename Component, typename Context>
+ static std::string what(Component const& component, Context const& ctx)
         {
- return "char";
+ return std::string("'")
+ + spirit::detail::to_narrow_char(
+ fusion::at_c<0>(component.elements)(unused, ctx))
+ + '\'';
         }
     };
 
@@ -135,8 +138,8 @@
                 !(fusion::at_c<1>(component.elements) < ch);
         }
 
- template <typename Component>
- static std::string what(Component const& component)
+ template <typename Component, typename Context>
+ static std::string what(Component const& component, Context const& ctx)
         {
             std::string result;
             result += std::string("'") + fusion::at_c<0>(component.elements) + '\'';
@@ -173,8 +176,8 @@
                 !(fusion::at_c<1>(component.elements)(unused, context) < ch);
         }
 
- template <typename Component>
- static std::string what(Component const&)
+ template <typename Component, typename Context>
+ static std::string what(Component const& component, Context const& ctx)
         {
             return "char-range";
         }
@@ -200,8 +203,8 @@
             ;
         }
 
- template <typename Component>
- static std::string what(Component const& component)
+ template <typename Component, typename Context>
+ static std::string what(Component const& component, Context const& ctx)
         {
             std::string result;
             result += std::string("'")
@@ -232,8 +235,8 @@
             ;
         }
 
- template <typename Component>
- static std::string what(Component const& component)
+ template <typename Component, typename Context>
+ static std::string what(Component const& component, Context const& ctx)
         {
             std::string result;
             result += std::string("'") + fusion::at_c<0>(component.elements) + '\'';

Modified: branches/release/boost/spirit/home/qi/char/char_class.hpp
==============================================================================
--- branches/release/boost/spirit/home/qi/char/char_class.hpp (original)
+++ branches/release/boost/spirit/home/qi/char/char_class.hpp 2008-07-15 12:13:27 EDT (Tue, 15 Jul 2008)
@@ -35,8 +35,8 @@
             return classify<char_set>::is(char_class_(), ch);
         }
 
- template <typename Component>
- static std::string what(Component const&)
+ template <typename Component, typename Context>
+ static std::string what(Component const& component, Context const& ctx)
         {
             typedef spirit::char_class::what<char_set> what_;
             return what_::is(char_class_());

Modified: branches/release/boost/spirit/home/qi/char/char_parser.hpp
==============================================================================
--- branches/release/boost/spirit/home/qi/char/char_parser.hpp (original)
+++ branches/release/boost/spirit/home/qi/char/char_parser.hpp 2008-07-15 12:13:27 EDT (Tue, 15 Jul 2008)
@@ -70,11 +70,11 @@
                 fusion::at_c<0>(component.elements), ch, context);
         }
 
- template <typename Component>
- static std::string what(Component const& component)
+ template <typename Component, typename Context>
+ static std::string what(Component const& component, Context const& ctx)
         {
             return std::string("not ")
- + Positive::director::what(fusion::at_c<0>(component.elements));
+ + Positive::director::what(fusion::at_c<0>(component.elements), ctx);
         }
     };
 }}}

Modified: branches/release/boost/spirit/home/qi/detail/expect_function.hpp
==============================================================================
--- branches/release/boost/spirit/home/qi/detail/expect_function.hpp (original)
+++ branches/release/boost/spirit/home/qi/detail/expect_function.hpp 2008-07-15 12:13:27 EDT (Tue, 15 Jul 2008)
@@ -41,7 +41,7 @@
                     is_first = false;
                     return true;
                 }
- Exception x = {first, last, director::what(component) };
+ Exception x = {first, last, director::what(component, context) };
                 throw x;
             }
             is_first = false;
@@ -62,7 +62,7 @@
                     is_first = false;
                     return true;
                 }
- Exception x = {first, last, director::what(component) };
+ Exception x = {first, last, director::what(component, context) };
                 throw x;
             }
             is_first = false;

Modified: branches/release/boost/spirit/home/qi/directive/lexeme.hpp
==============================================================================
--- branches/release/boost/spirit/home/qi/directive/lexeme.hpp (original)
+++ branches/release/boost/spirit/home/qi/directive/lexeme.hpp 2008-07-15 12:13:27 EDT (Tue, 15 Jul 2008)
@@ -49,8 +49,8 @@
                 spirit::subject(component), first, last, context, unused, attr);
         }
 
- template <typename Component>
- static std::string what(Component const& component)
+ template <typename Component, typename Context>
+ static std::string what(Component const& component, Context const& ctx)
         {
             std::string result = "lexeme[";
 
@@ -58,7 +58,7 @@
                 result_of::subject<Component>::type::director
             director;
 
- result += director::what(subject(component));
+ result += director::what(subject(component), ctx);
             result += "]";
             return result;
         }

Modified: branches/release/boost/spirit/home/qi/directive/omit.hpp
==============================================================================
--- branches/release/boost/spirit/home/qi/directive/omit.hpp (original)
+++ branches/release/boost/spirit/home/qi/directive/omit.hpp 2008-07-15 12:13:27 EDT (Tue, 15 Jul 2008)
@@ -40,8 +40,8 @@
                 spirit::subject(component), first, last, context, skipper, unused);
         }
 
- template <typename Component>
- static std::string what(Component const& component)
+ template <typename Component, typename Context>
+ static std::string what(Component const& component, Context const& ctx)
         {
             std::string result = "omit[";
 
@@ -49,7 +49,7 @@
                 result_of::subject<Component>::type::director
             director;
 
- result += director::what(subject(component));
+ result += director::what(subject(component), ctx);
             result += "]";
             return result;
         }

Modified: branches/release/boost/spirit/home/qi/directive/raw.hpp
==============================================================================
--- branches/release/boost/spirit/home/qi/directive/raw.hpp (original)
+++ branches/release/boost/spirit/home/qi/directive/raw.hpp 2008-07-15 12:13:27 EDT (Tue, 15 Jul 2008)
@@ -47,8 +47,8 @@
             return false;
         }
 
- template <typename Component>
- static std::string what(Component const& component)
+ template <typename Component, typename Context>
+ static std::string what(Component const& component, Context const& ctx)
         {
             std::string result = "raw[";
 
@@ -56,7 +56,7 @@
                 result_of::subject<Component>::type::director
             director;
 
- result += director::what(subject(component));
+ result += director::what(subject(component), ctx);
             result += "]";
             return result;
         }

Modified: branches/release/boost/spirit/home/qi/nonterminal/grammar.hpp
==============================================================================
--- branches/release/boost/spirit/home/qi/nonterminal/grammar.hpp (original)
+++ branches/release/boost/spirit/home/qi/nonterminal/grammar.hpp 2008-07-15 12:13:27 EDT (Tue, 15 Jul 2008)
@@ -9,6 +9,7 @@
 
 #include <boost/spirit/home/support/unused.hpp>
 #include <boost/spirit/home/qi/nonterminal/nonterminal.hpp>
+#include <boost/spirit/home/qi/nonterminal/grammar_fwd.hpp>
 #include <boost/spirit/home/qi/domain.hpp>
 #include <boost/spirit/home/qi/nonterminal/rule.hpp>
 #include <boost/spirit/home/qi/nonterminal/nonterminal_director.hpp>
@@ -18,100 +19,10 @@
 
 namespace boost { namespace spirit { namespace qi
 {
- template <typename Definition>
+ template <typename Iterator, typename T0 , typename T1 , typename T2>
     struct grammar
       : nonterminal<
- grammar<Definition>
- , typename Definition::sig_type
- , typename Definition::locals_type
- >, noncopyable
- {
- typedef typename Definition::sig_type sig_type;
- typedef typename Definition::locals_type locals_type;
- typedef typename Definition::skipper_type skipper_type;
- typedef typename Definition::start_type start_type;
- typedef typename Definition::iterator_type iterator_type;
-
- template <typename Definition_>
- explicit grammar(Definition_ const& definition)
- : definition(definition)
- , start(definition.start)
- {
- }
-
- template <typename Definition_, typename Start>
- grammar(Definition_ const& definition, Start const& start)
- : definition(definition)
- , start(start)
- {
- }
-
- private:
-
- template <typename Iterator, typename Context, typename Skipper>
- bool parse(
- Iterator& first, Iterator const& last
- , Context& context, Skipper const& skipper) const
- {
- return start.parse(first, last, context, skipper);
- }
-
- std::string what() const
- {
- if (definition.name().empty())
- {
- return start.what();
- }
- else
- {
- return definition.name();
- }
- }
-
- friend struct nonterminal_director;
- Definition const& definition;
- start_type const& start;
- };
-
- template <
- typename Iterator
- , typename T0 = unused_type
- , typename T1 = unused_type
- , typename T2 = unused_type
- >
- struct grammar_def : noncopyable
- {
- typedef Iterator iterator_type;
- typedef qi::rule<Iterator, T0, T1, T2> start_type;
- typedef typename start_type::sig_type sig_type;
- typedef typename start_type::locals_type locals_type;
- typedef typename start_type::skipper_type skipper_type;
-
- grammar_def(std::string const& name_ = std::string())
- : name_(name_) {}
-
- std::string name() const
- {
- return name_;
- }
-
- void name(std::string const& name__)
- {
- name_ = name__;
- }
-
- std::string name_;
- };
-
- template <
- typename Iterator
- , typename T0 = unused_type
- , typename T1 = unused_type
- , typename T2 = unused_type
- >
- struct grammar_
- : nonterminal<
- grammar_<Iterator, T0, T1, T2>
+ grammar<Iterator, T0, T1, T2>
           , typename qi::rule<Iterator, T0, T1, T2>::sig_type
           , typename qi::rule<Iterator, T0, T1, T2>::locals_type
>, noncopyable
@@ -121,9 +32,9 @@
         typedef typename start_type::sig_type sig_type;
         typedef typename start_type::locals_type locals_type;
         typedef typename start_type::skipper_type skipper_type;
- typedef grammar_<Iterator, T0, T1, T2> base_type;
+ typedef grammar<Iterator, T0, T1, T2> base_type;
 
- grammar_(start_type const& start, std::string const& name_ = std::string())
+ grammar(start_type const& start, std::string const& name_ = std::string())
           : start(start), name_(name_) {}
 
         std::string name() const
@@ -136,8 +47,8 @@
             name_ = name__;
         }
 
- std::string name_;
         start_type const& start;
+ std::string name_;
 
     private:
 
@@ -163,80 +74,6 @@
 
         friend struct nonterminal_director;
     };
-
- ///////////////////////////////////////////////////////////////////////////
- // The grammar_class template
- ///////////////////////////////////////////////////////////////////////////
- template <template <typename, typename> class Def>
- struct grammar_class {};
-
- template <typename Iterator, template <typename, typename> class Def>
- inline bool
- parse(
- Iterator& first
- , Iterator last
- , grammar_class<Def>& gc)
- {
- Def<Iterator, unused_type> def(gc);
- grammar<Def<Iterator, unused_type> > g(def);
- return parse(first, last, g);
- }
-
- template <typename Iterator
- , template <typename, typename> class Def, typename Attr>
- inline bool
- parse(
- Iterator& first
- , Iterator last
- , grammar_class<Def>& gc
- , Attr& attr)
- {
- Def<Iterator, unused_type> def(gc);
- grammar<Def<Iterator, unused_type> > g(def);
- return parse(first, last, g, attr);
- }
-
- template <typename Iterator
- , template <typename, typename> class Def, typename Skipper>
- inline bool
- phrase_parse(
- Iterator& first
- , Iterator last
- , grammar_class<Def>& gc
- , Skipper const& skipper_)
- {
- typedef typename
- result_of::as_component<qi::domain, Skipper>::type
- skipper_type;
-
- skipper_type skipper = spirit::as_component(qi::domain(), skipper_);
-
- Def<Iterator, skipper_type> def(gc);
- grammar<Def<Iterator, skipper_type> > g(def);
- return phrase_parse(first, last, g, skipper);
- }
-
- template <typename Iterator
- , template <typename, typename> class Def, typename Attr, typename Skipper>
- inline bool
- phrase_parse(
- Iterator& first
- , Iterator last
- , grammar_class<Def>& gc
- , Attr& attr
- , Skipper const& skipper_)
- {
- typedef typename
- result_of::as_component<qi::domain, Skipper>::type
- skipper_type;
-
- skipper_type skipper = spirit::as_component(qi::domain(), skipper_);
-
- Def<Iterator, skipper_type> def(gc);
- grammar<Def<Iterator, skipper_type> > g(def);
- return phrase_parse(first, last, g, attr, skipper);
- }
-
 }}}
 
 #endif

Added: branches/release/boost/spirit/home/qi/nonterminal/grammar_fwd.hpp
==============================================================================
--- (empty file)
+++ branches/release/boost/spirit/home/qi/nonterminal/grammar_fwd.hpp 2008-07-15 12:13:27 EDT (Tue, 15 Jul 2008)
@@ -0,0 +1,24 @@
+/*=============================================================================
+ Copyright (c) 2001-2007 Joel de Guzman
+
+ Distributed under the Boost Software License, Version 1.0. (See accompanying
+ file LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt)
+==============================================================================*/
+#if !defined(BOOST_SPIRIT_GRAMMAR_FWD_JULY_11_2008_1034AM)
+#define BOOST_SPIRIT_GRAMMAR_FWD_JULY_11_2008_1034AM
+
+#include <boost/spirit/home/support/unused.hpp>
+
+namespace boost { namespace spirit { namespace qi
+{
+ // forward declaration
+ template <
+ typename Iterator
+ , typename T0 = unused_type
+ , typename T1 = unused_type
+ , typename T2 = unused_type
+ >
+ struct grammar;
+}}}
+
+#endif

Modified: branches/release/boost/spirit/home/qi/nonterminal/nonterminal_director.hpp
==============================================================================
--- branches/release/boost/spirit/home/qi/nonterminal/nonterminal_director.hpp (original)
+++ branches/release/boost/spirit/home/qi/nonterminal/nonterminal_director.hpp 2008-07-15 12:13:27 EDT (Tue, 15 Jul 2008)
@@ -159,8 +159,8 @@
             return x.ptr->what();
         }
 
- template <typename Component>
- static std::string what(Component const& component)
+ template <typename Component, typename Context>
+ static std::string what(Component const& component, Context const& ctx)
         {
             return what_nonterminal(subject(component).held);
         }

Modified: branches/release/boost/spirit/home/qi/nonterminal/rule.hpp
==============================================================================
--- branches/release/boost/spirit/home/qi/nonterminal/rule.hpp (original)
+++ branches/release/boost/spirit/home/qi/nonterminal/rule.hpp 2008-07-15 12:13:27 EDT (Tue, 15 Jul 2008)
@@ -9,6 +9,7 @@
 
 #include <boost/spirit/home/support/unused.hpp>
 #include <boost/spirit/home/qi/nonterminal/nonterminal.hpp>
+#include <boost/spirit/home/qi/nonterminal/grammar_fwd.hpp>
 #include <boost/spirit/home/qi/nonterminal/detail/rule.hpp>
 #include <boost/spirit/home/qi/nonterminal/detail/error_handler.hpp>
 #include <boost/spirit/home/qi/domain.hpp>
@@ -23,9 +24,6 @@
 
 namespace boost { namespace spirit { namespace qi
 {
- // forward declarations
- template <typename Definition>
- struct grammar;
     namespace detail { struct rule_decorator; }
 
     template <
@@ -86,7 +84,7 @@
 
             // temp workaround for mpl problem
             BOOST_STATIC_ASSERT(is_component::value);
-
+
             define(xpr, mpl::false_());
             return *this;
         }
@@ -143,11 +141,8 @@
 
     private:
 
- template <typename Definition>
- friend struct grammar;
-
         template <typename Iterator_, typename T0_, typename T1_, typename T2_>
- friend struct grammar_;
+ friend struct grammar;
 
         friend struct detail::rule_decorator;
 
@@ -176,8 +171,8 @@
         {
             // If the following line produces a compilation error stating the
             // 4th parameter is not convertible to the expected type, then you
- // are probably trying to use this rule instance with a skipper
- // which is not compatible with the skipper type used while
+ // are probably trying to use this rule instance with a skipper
+ // which is not compatible with the skipper type used while
             // defining the type of this rule instance.
             return ptr->parse(first, last, context, skipper);
         }

Modified: branches/release/boost/spirit/home/qi/numeric/int.hpp
==============================================================================
--- branches/release/boost/spirit/home/qi/numeric/int.hpp (original)
+++ branches/release/boost/spirit/home/qi/numeric/int.hpp 2008-07-15 12:13:27 EDT (Tue, 15 Jul 2008)
@@ -42,8 +42,8 @@
                 ::call(first, last, attr);
         }
 
- template <typename Component>
- static std::string what(Component const&)
+ template <typename Component, typename Context>
+ static std::string what(Component const& component, Context const& ctx)
         {
             return "integer";
         }

Modified: branches/release/boost/spirit/home/qi/numeric/real.hpp
==============================================================================
--- branches/release/boost/spirit/home/qi/numeric/real.hpp (original)
+++ branches/release/boost/spirit/home/qi/numeric/real.hpp 2008-07-15 12:13:27 EDT (Tue, 15 Jul 2008)
@@ -49,8 +49,8 @@
             return detail::real_impl<T, RealPolicies>::parse(first, last, attr, p);
         }
 
- template <typename Component>
- static std::string what(Component const&)
+ template <typename Component, typename Context>
+ static std::string what(Component const& component, Context const& ctx)
         {
             return "real number";
         }

Modified: branches/release/boost/spirit/home/qi/numeric/uint.hpp
==============================================================================
--- branches/release/boost/spirit/home/qi/numeric/uint.hpp (original)
+++ branches/release/boost/spirit/home/qi/numeric/uint.hpp 2008-07-15 12:13:27 EDT (Tue, 15 Jul 2008)
@@ -42,8 +42,8 @@
                 ::call(first, last, attr);
         }
 
- template <typename Component>
- static std::string what(Component const&)
+ template <typename Component, typename Context>
+ static std::string what(Component const& component, Context const& ctx)
         {
             return "unsigned integer";
         }

Modified: branches/release/boost/spirit/home/qi/operator/alternative.hpp
==============================================================================
--- branches/release/boost/spirit/home/qi/operator/alternative.hpp (original)
+++ branches/release/boost/spirit/home/qi/operator/alternative.hpp 2008-07-15 12:13:27 EDT (Tue, 15 Jul 2008)
@@ -82,12 +82,12 @@
             return fusion::any(component.elements, f);
         }
 
- template <typename Component>
- static std::string what(Component const& component)
+ template <typename Component, typename Context>
+ static std::string what(Component const& component, Context const& ctx)
         {
             std::string result = "alternatives[";
             fusion::for_each(component.elements,
- spirit::detail::what_function(result));
+ spirit::detail::what_function<Context>(result, ctx));
             result += "]";
             return result;
         }

Modified: branches/release/boost/spirit/home/qi/operator/and_predicate.hpp
==============================================================================
--- branches/release/boost/spirit/home/qi/operator/and_predicate.hpp (original)
+++ branches/release/boost/spirit/home/qi/operator/and_predicate.hpp 2008-07-15 12:13:27 EDT (Tue, 15 Jul 2008)
@@ -39,8 +39,8 @@
                 subject(component), i, last, context, skipper, unused);
         }
 
- template <typename Component>
- static std::string what(Component const& component)
+ template <typename Component, typename Context>
+ static std::string what(Component const& component, Context const& ctx)
         {
             std::string result = "and-predicate[";
 
@@ -48,7 +48,7 @@
                 result_of::subject<Component>::type::director
             director;
 
- result += director::what(subject(component));
+ result += director::what(subject(component), ctx);
             result += "]";
             return result;
         }

Modified: branches/release/boost/spirit/home/qi/operator/difference.hpp
==============================================================================
--- branches/release/boost/spirit/home/qi/operator/difference.hpp (original)
+++ branches/release/boost/spirit/home/qi/operator/difference.hpp 2008-07-15 12:13:27 EDT (Tue, 15 Jul 2008)
@@ -66,8 +66,8 @@
             return ldirector::parse(left(component), first, last, context, skipper, attr);
         }
 
- template <typename Component>
- static std::string what(Component const& component)
+ template <typename Component, typename Context>
+ static std::string what(Component const& component, Context const& ctx)
         {
             std::string result = "difference[";
 
@@ -79,9 +79,9 @@
                 result_of::right<Component>::type::director
             rdirector;
 
- result += ldirector::what(left(component));
+ result += ldirector::what(left(component), ctx);
             result += ", ";
- result += rdirector::what(right(component));
+ result += rdirector::what(right(component), ctx);
             result += "]";
             return result;
         }

Modified: branches/release/boost/spirit/home/qi/operator/kleene.hpp
==============================================================================
--- branches/release/boost/spirit/home/qi/operator/kleene.hpp (original)
+++ branches/release/boost/spirit/home/qi/operator/kleene.hpp 2008-07-15 12:13:27 EDT (Tue, 15 Jul 2008)
@@ -66,8 +66,8 @@
             return true;
         }
 
- template <typename Component>
- static std::string what(Component const& component)
+ template <typename Component, typename Context>
+ static std::string what(Component const& component, Context const& ctx)
         {
             std::string result = "kleene[";
 
@@ -75,7 +75,7 @@
                 result_of::subject<Component>::type::director
             director;
 
- result += director::what(subject(component));
+ result += director::what(subject(component), ctx);
             result += "]";
             return result;
         }

Modified: branches/release/boost/spirit/home/qi/operator/list.hpp
==============================================================================
--- branches/release/boost/spirit/home/qi/operator/list.hpp (original)
+++ branches/release/boost/spirit/home/qi/operator/list.hpp 2008-07-15 12:13:27 EDT (Tue, 15 Jul 2008)
@@ -72,8 +72,8 @@
         }
 
 
- template <typename Component>
- static std::string what(Component const& component)
+ template <typename Component, typename Context>
+ static std::string what(Component const& component, Context const& ctx)
         {
             std::string result = "list[";
 
@@ -85,9 +85,9 @@
                 result_of::right<Component>::type::director
             rdirector;
 
- result += ldirector::what(left(component));
+ result += ldirector::what(left(component), ctx);
             result += ", ";
- result += rdirector::what(right(component));
+ result += rdirector::what(right(component), ctx);
             result += "]";
             return result;
         }

Modified: branches/release/boost/spirit/home/qi/operator/not_predicate.hpp
==============================================================================
--- branches/release/boost/spirit/home/qi/operator/not_predicate.hpp (original)
+++ branches/release/boost/spirit/home/qi/operator/not_predicate.hpp 2008-07-15 12:13:27 EDT (Tue, 15 Jul 2008)
@@ -39,8 +39,8 @@
                 subject(component), i, last, context, skipper, unused);
         }
 
- template <typename Component>
- static std::string what(Component const& component)
+ template <typename Component, typename Context>
+ static std::string what(Component const& component, Context const& ctx)
         {
             std::string result = "not-predicate[";
 
@@ -48,7 +48,7 @@
                 result_of::subject<Component>::type::director
             director;
 
- result += director::what(subject(component));
+ result += director::what(subject(component), ctx);
             result += "]";
             return result;
         }

Modified: branches/release/boost/spirit/home/qi/operator/optional.hpp
==============================================================================
--- branches/release/boost/spirit/home/qi/operator/optional.hpp (original)
+++ branches/release/boost/spirit/home/qi/operator/optional.hpp 2008-07-15 12:13:27 EDT (Tue, 15 Jul 2008)
@@ -67,8 +67,8 @@
             return true;
         }
 
- template <typename Component>
- static std::string what(Component const& component)
+ template <typename Component, typename Context>
+ static std::string what(Component const& component, Context const& ctx)
         {
             std::string result = "optional[";
 
@@ -76,7 +76,7 @@
                 result_of::subject<Component>::type::director
             director;
 
- result += director::what(subject(component));
+ result += director::what(subject(component), ctx);
             result += "]";
             return result;
         }

Modified: branches/release/boost/spirit/home/qi/operator/permutation.hpp
==============================================================================
--- branches/release/boost/spirit/home/qi/operator/permutation.hpp (original)
+++ branches/release/boost/spirit/home/qi/operator/permutation.hpp 2008-07-15 12:13:27 EDT (Tue, 15 Jul 2008)
@@ -81,12 +81,12 @@
             return result;
         }
 
- template <typename Component>
- static std::string what(Component const& component)
+ template <typename Component, typename Context>
+ static std::string what(Component const& component, Context const& ctx)
         {
             std::string result = "permutation[";
             fusion::for_each(component.elements,
- spirit::detail::what_function(result));
+ spirit::detail::what_function<Context>(result, ctx));
             result += "]";
             return result;
         }

Modified: branches/release/boost/spirit/home/qi/operator/plus.hpp
==============================================================================
--- branches/release/boost/spirit/home/qi/operator/plus.hpp (original)
+++ branches/release/boost/spirit/home/qi/operator/plus.hpp 2008-07-15 12:13:27 EDT (Tue, 15 Jul 2008)
@@ -73,8 +73,8 @@
             return false;
         }
 
- template <typename Component>
- static std::string what(Component const& component)
+ template <typename Component, typename Context>
+ static std::string what(Component const& component, Context const& ctx)
         {
             std::string result = "plus[";
 
@@ -82,7 +82,7 @@
                 result_of::subject<Component>::type::director
             director;
 
- result += director::what(subject(component));
+ result += director::what(subject(component), ctx);
             result += "]";
             return result;
         }

Modified: branches/release/boost/spirit/home/qi/operator/sequence_base.hpp
==============================================================================
--- branches/release/boost/spirit/home/qi/operator/sequence_base.hpp (original)
+++ branches/release/boost/spirit/home/qi/operator/sequence_base.hpp 2008-07-15 12:13:27 EDT (Tue, 15 Jul 2008)
@@ -75,12 +75,12 @@
             return true;
         }
 
- template <typename Component>
- static std::string what(Component const& component)
+ template <typename Component, typename Context>
+ static std::string what(Component const& component, Context const& ctx)
         {
             std::string result = Derived::what_();
             fusion::for_each(component.elements,
- spirit::detail::what_function(result));
+ spirit::detail::what_function<Context>(result, ctx));
             result += "]";
             return result;
         }

Modified: branches/release/boost/spirit/home/qi/operator/sequential_or.hpp
==============================================================================
--- branches/release/boost/spirit/home/qi/operator/sequential_or.hpp (original)
+++ branches/release/boost/spirit/home/qi/operator/sequential_or.hpp 2008-07-15 12:13:27 EDT (Tue, 15 Jul 2008)
@@ -60,12 +60,12 @@
         }
 
 
- template <typename Component>
- static std::string what(Component const& component)
+ template <typename Component, typename Context>
+ static std::string what(Component const& component, Context const& ctx)
         {
             std::string result = "sequential-or[";
             fusion::for_each(component.elements,
- spirit::detail::what_function(result));
+ spirit::detail::what_function<Context>(result, ctx));
             result += "]";
             return result;
         }

Modified: branches/release/boost/spirit/home/qi/stream/stream.hpp
==============================================================================
--- branches/release/boost/spirit/home/qi/stream/stream.hpp (original)
+++ branches/release/boost/spirit/home/qi/stream/stream.hpp 2008-07-15 12:13:27 EDT (Tue, 15 Jul 2008)
@@ -61,8 +61,8 @@
             return in.good() || in.eof();
         }
 
- template <typename Component>
- static std::string what(Component const&)
+ template <typename Component, typename Context>
+ static std::string what(Component const& component, Context const& ctx)
         {
             return "any-stream";
         }

Modified: branches/release/boost/spirit/home/qi/string/lit.hpp
==============================================================================
--- branches/release/boost/spirit/home/qi/string/lit.hpp (original)
+++ branches/release/boost/spirit/home/qi/string/lit.hpp 2008-07-15 12:13:27 EDT (Tue, 15 Jul 2008)
@@ -53,8 +53,8 @@
             );
         }
 
- template <typename Component>
- static std::string what(Component const& component)
+ template <typename Component, typename Context>
+ static std::string what(Component const& component, Context const& ctx)
         {
             return std::string("\"")
                 + spirit::detail::to_narrow_string(
@@ -102,10 +102,14 @@
             );
         }
 
- template <typename Component>
- static std::string what(Component const&)
+ template <typename Component, typename Context>
+ static std::string what(Component const& component, Context const& ctx)
         {
- return "string";
+ return std::string("\"")
+ + spirit::detail::to_narrow_string(
+ fusion::at_c<0>(component.elements)(unused, ctx))
+ + std::string("\"")
+ ;
         }
     };
 
@@ -141,8 +145,8 @@
             );
         }
 
- template <typename Component>
- static std::string what(Component const& component)
+ template <typename Component, typename Context>
+ static std::string what(Component const& component, Context const& ctx)
         {
             return std::string("case-insensitive \"")
                 + spirit::detail::to_narrow_string(

Modified: branches/release/boost/spirit/home/qi/string/symbols.hpp
==============================================================================
--- branches/release/boost/spirit/home/qi/string/symbols.hpp (original)
+++ branches/release/boost/spirit/home/qi/string/symbols.hpp 2008-07-15 12:13:27 EDT (Tue, 15 Jul 2008)
@@ -62,8 +62,8 @@
             return false;
         }
 
- template <typename Component>
- static std::string what(Component const&)
+ template <typename Component, typename Context>
+ static std::string what(Component const& component, Context const& ctx)
         {
             // perhaps we should show some of the contents?
             return "symbols";

Modified: branches/release/boost/spirit/home/qi/what.hpp
==============================================================================
--- branches/release/boost/spirit/home/qi/what.hpp (original)
+++ branches/release/boost/spirit/home/qi/what.hpp 2008-07-15 12:13:27 EDT (Tue, 15 Jul 2008)
@@ -26,7 +26,7 @@
         typedef typename result_of::as_component<qi::domain, Expr>::type component;
         typedef typename component::director director;
         component c = spirit::as_component(qi::domain(), xpr);
- return director::what(c);
+ return director::what(c, unused);
     }
 }}}
 

Modified: branches/release/boost/spirit/home/support/detail/what_function.hpp
==============================================================================
--- branches/release/boost/spirit/home/support/detail/what_function.hpp (original)
+++ branches/release/boost/spirit/home/support/detail/what_function.hpp 2008-07-15 12:13:27 EDT (Tue, 15 Jul 2008)
@@ -11,10 +11,11 @@
 
 namespace boost { namespace spirit { namespace detail
 {
+ template <typename Context>
     struct what_function
     {
- what_function(std::string& str)
- : str(str), first(true)
+ what_function(std::string& str, Context const& ctx)
+ : str(str), first(true), ctx(ctx)
         {
         }
 
@@ -26,10 +27,11 @@
             else
                 str += ", ";
             typedef typename Component::director director;
- str += director::what(component);
+ str += director::what(component, ctx);
         }
 
         std::string& str;
+ Context const& ctx;
         mutable bool first;
     };
 }}}

Added: branches/release/libs/spirit/doc/html/images/lexerflow.png
==============================================================================
Binary file. No diff available.

Modified: branches/release/libs/spirit/doc/lex.qbk
==============================================================================
--- branches/release/libs/spirit/doc/lex.qbk (original)
+++ branches/release/libs/spirit/doc/lex.qbk 2008-07-15 12:13:27 EDT (Tue, 15 Jul 2008)
@@ -6,18 +6,18 @@
     file LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt)
 ===============================================================================/]
 
-[section __lex__]
+[section:lex __lex__]
 
 [include lex/introduction.qbk]
 
-[section __lex__ Tutorials]
+[section:tutorials __lex__ Tutorials]
 [include lex/lexer_tutorials.qbk]
 [include lex/lexer_quickstart1.qbk]
 [include lex/lexer_quickstart2.qbk]
 [include lex/lexer_quickstart3.qbk]
 [endsect]
 
-[section Abstracts]
+[section:abstracts Abstracts]
 [section Lexer Primitives]
 [include lex/lexer_primitives.qbk]
 [include lex/tokens_values.qbk]
@@ -31,11 +31,11 @@
 [include lex/lexer_states.qbk]
 [endsect]
 
-[section Quick Reference]
+[section:quick_reference Quick Reference]
 [endsect]
 
-[section Reference]
-[section Concepts]
+[section:reference Reference]
+[section:concepts Concepts]
 [include reference/lex/lexer.qbk]
 [include reference/lex/token.qbk]
 [include reference/lex/tokendef.qbk]

Modified: branches/release/libs/spirit/doc/lex/introduction.qbk
==============================================================================
--- branches/release/libs/spirit/doc/lex/introduction.qbk (original)
+++ branches/release/libs/spirit/doc/lex/introduction.qbk 2008-07-15 12:13:27 EDT (Tue, 15 Jul 2008)
@@ -6,7 +6,7 @@
     file LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt)
 ===============================================================================/]
 
-[section Introduction to __lex__]
+[section:lexer_introduction Introduction to __lex__]
 
 Lexical scanning is the process of analyzing the stream of input characters and
 separating it into strings called tokens, separated by whitespace.
@@ -49,7 +49,7 @@
 * Type 3: Regular grammars
 
 The complexity of these grammars increases from regular grammars being the
-simplest to unrestricted grammars being the most complex. Similarily, the
+simplest to unrestricted grammars being the most complex. Similarly, the
 complexity of the recognizers for these grammars increases. Although, a few
 features of some programming languages (such as C++) are Type 1, fortunately
 for the most part programming languages can be described using only the Types 3
@@ -134,4 +134,21 @@
 generators (such as __re2c__, __ragel__, etc.). But it is very flexible and
 allows to speed up the development of your application.
 
+[heading The Library Structure of __lex__]
+
+The [link spirit.lexerflow figure] below shows a high level overview of how the
+__lex__ library might be used in an application. __lex__ allows to create
+lexical analyzers based on patterns. These patterns are regular expression
+based rules used to define the different tokens to be recognized in the
+character input sequence. The input sequence is expected to be provided to the
+lexical analyzer as an arbitrary standard forward iterator. The lexical
+analyzer itself exposes a standard forward iterator as well. The difference
+here is that the exposed iterator provides access to the token sequence instead
+of to the character sequence. The tokens in this sequence are constructed on
+the fly by analyzing the underlying character sequence and
+matching this to the patterns as defined by the application.
+
+[fig ./images/lexerflow.png..The Library structure and Common Flow of Information while using __lex__ in an application..spirit.lexerflow]
+
+
 [endsect]

Modified: branches/release/libs/spirit/doc/lex/lexer_attributes.qbk
==============================================================================
--- branches/release/libs/spirit/doc/lex/lexer_attributes.qbk (original)
+++ branches/release/libs/spirit/doc/lex/lexer_attributes.qbk 2008-07-15 12:13:27 EDT (Tue, 15 Jul 2008)
@@ -6,7 +6,7 @@
     file LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt)
 ===============================================================================/]
 
-[section Lexer Attributes]
+[section:lexer_attributes Lexer Attributes]
 
 
 [endsect]

Modified: branches/release/libs/spirit/doc/lex/lexer_primitives.qbk
==============================================================================
--- branches/release/libs/spirit/doc/lex/lexer_primitives.qbk (original)
+++ branches/release/libs/spirit/doc/lex/lexer_primitives.qbk 2008-07-15 12:13:27 EDT (Tue, 15 Jul 2008)
@@ -6,9 +6,10 @@
     file LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt)
 ===============================================================================/]
 
-[section Lexer Primitives]
+[section:lexer_primitives Lexer Primitives]
 
 [/ Describe the primitive lexer constructs, such as token_def, token_set? ]
+
 [/ Describe the primitive lexer constructs usable in parsers, such as
    in_state[], set_state(), token(), etc. ]
 

Modified: branches/release/libs/spirit/doc/lex/lexer_quickstart1.qbk
==============================================================================
--- branches/release/libs/spirit/doc/lex/lexer_quickstart1.qbk (original)
+++ branches/release/libs/spirit/doc/lex/lexer_quickstart1.qbk 2008-07-15 12:13:27 EDT (Tue, 15 Jul 2008)
@@ -6,7 +6,7 @@
     file LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt)
 ===============================================================================/]
 
-[section Quickstart 1 - A word counter using __lex__]
+[section:lexer_quickstart1 Quickstart 1 - A word counter using __lex__]
 
 __lex__ is very modular, which follows the general building principle of the
 __spirit__ libraries. You never pay for features you don't use. It is nicely

Modified: branches/release/libs/spirit/doc/lex/lexer_quickstart2.qbk
==============================================================================
--- branches/release/libs/spirit/doc/lex/lexer_quickstart2.qbk (original)
+++ branches/release/libs/spirit/doc/lex/lexer_quickstart2.qbk 2008-07-15 12:13:27 EDT (Tue, 15 Jul 2008)
@@ -6,7 +6,7 @@
     file LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt)
 ===============================================================================/]
 
-[section Quickstart 2 - A better word counter using __lex__]
+[section:lexer_quickstart2 Quickstart 2 - A better word counter using __lex__]
 
 People knowing __flex__ will probably complain about the example from the
 section __sec_lex_quickstart_1__ as being overly complex and not being

Modified: branches/release/libs/spirit/doc/lex/lexer_quickstart3.qbk
==============================================================================
--- branches/release/libs/spirit/doc/lex/lexer_quickstart3.qbk (original)
+++ branches/release/libs/spirit/doc/lex/lexer_quickstart3.qbk 2008-07-15 12:13:27 EDT (Tue, 15 Jul 2008)
@@ -6,7 +6,7 @@
     file LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt)
 ===============================================================================/]
 
-[section Quickstart 3 - Counting Words Using a Parser]
+[section:lexer_quickstart3 Quickstart 3 - Counting Words Using a Parser]
 
 The whole purpose of integrating __lex__ as part of the __spirit__ library was
 to add a library allowing to merge lexical analysis with the parsing

Modified: branches/release/libs/spirit/doc/lex/lexer_semantic_actions.qbk
==============================================================================
--- branches/release/libs/spirit/doc/lex/lexer_semantic_actions.qbk (original)
+++ branches/release/libs/spirit/doc/lex/lexer_semantic_actions.qbk 2008-07-15 12:13:27 EDT (Tue, 15 Jul 2008)
@@ -6,5 +6,5 @@
     file LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt)
 ===============================================================================/]
 
-[section Lexer Semantic Actions]
+[section:lexer_semantic_actions Lexer Semantic Actions]
 [endsect]

Modified: branches/release/libs/spirit/doc/lex/lexer_states.qbk
==============================================================================
--- branches/release/libs/spirit/doc/lex/lexer_states.qbk (original)
+++ branches/release/libs/spirit/doc/lex/lexer_states.qbk 2008-07-15 12:13:27 EDT (Tue, 15 Jul 2008)
@@ -6,7 +6,7 @@
     file LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt)
 ===============================================================================/]
 
-[section Lexer States]
+[section:lexer_states Lexer States]
 
 
 [heading Controlling the Lexer State from Lexer Semantic Actions]

Modified: branches/release/libs/spirit/doc/lex/lexer_static_model.qbk
==============================================================================
--- branches/release/libs/spirit/doc/lex/lexer_static_model.qbk (original)
+++ branches/release/libs/spirit/doc/lex/lexer_static_model.qbk 2008-07-15 12:13:27 EDT (Tue, 15 Jul 2008)
@@ -6,7 +6,7 @@
     file LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt)
 ===============================================================================/]
 
-[section The /Static/ Lexer Model]
+[section:lexer_static_model The /Static/ Lexer Model]
 
 The documentation of __lex__ so far mostly was about describing the features of
 the /dynamic/ model, where the tables needed for lexical analysis are generated

Modified: branches/release/libs/spirit/doc/lex/lexer_tutorials.qbk
==============================================================================
--- branches/release/libs/spirit/doc/lex/lexer_tutorials.qbk (original)
+++ branches/release/libs/spirit/doc/lex/lexer_tutorials.qbk 2008-07-15 12:13:27 EDT (Tue, 15 Jul 2008)
@@ -6,7 +6,7 @@
     file LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt)
 ===============================================================================/]
 
-[section __lex__ Tutorials Overview]
+[section:lexer_tutorials __lex__ Tutorials Overview]
 
 The __lex__ library implements several components on top of possibly different
 lexer generator libraries. It exposes a pair of iterators, which, when

Modified: branches/release/libs/spirit/doc/lex/parsing_using_a_lexer.qbk
==============================================================================
--- branches/release/libs/spirit/doc/lex/parsing_using_a_lexer.qbk (original)
+++ branches/release/libs/spirit/doc/lex/parsing_using_a_lexer.qbk 2008-07-15 12:13:27 EDT (Tue, 15 Jul 2008)
@@ -6,7 +6,7 @@
     file LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt)
 ===============================================================================/]
 
-[section Parsing using a Lexer]
+[section:lexer_parsing Parsing using a Lexer]
 
 [/ write about integration of lexer component with __qi__]
 

Modified: branches/release/libs/spirit/doc/lex/token_definition.qbk
==============================================================================
--- branches/release/libs/spirit/doc/lex/token_definition.qbk (original)
+++ branches/release/libs/spirit/doc/lex/token_definition.qbk 2008-07-15 12:13:27 EDT (Tue, 15 Jul 2008)
@@ -6,6 +6,6 @@
     file LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt)
 ===============================================================================/]
 
-[section Ways to define Tokens]
+[section:lexer_token_definition Ways to define Tokens]
 
 [endsect]

Modified: branches/release/libs/spirit/doc/lex/tokenizing.qbk
==============================================================================
--- branches/release/libs/spirit/doc/lex/tokenizing.qbk (original)
+++ branches/release/libs/spirit/doc/lex/tokenizing.qbk 2008-07-15 12:13:27 EDT (Tue, 15 Jul 2008)
@@ -6,7 +6,7 @@
     file LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt)
 ===============================================================================/]
 
-[section Tokenizing Input Data]
+[section:lexer_tokenizing Tokenizing Input Data]
 
 [heading The tokenize() function]
 

Modified: branches/release/libs/spirit/doc/lex/tokens_values.qbk
==============================================================================
--- branches/release/libs/spirit/doc/lex/tokens_values.qbk (original)
+++ branches/release/libs/spirit/doc/lex/tokens_values.qbk 2008-07-15 12:13:27 EDT (Tue, 15 Jul 2008)
@@ -6,7 +6,7 @@
     file LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt)
 ===============================================================================/]
 
-[section About Tokens and Token Values]
+[section:lexer_token_values About Tokens and Token Values]
 
 As already discussed, lexical scanning is the process of analyzing the stream
 of input characters and separating it into strings called tokens, most of the

Modified: branches/release/libs/spirit/doc/qi_and_karma.qbk
==============================================================================
--- branches/release/libs/spirit/doc/qi_and_karma.qbk (original)
+++ branches/release/libs/spirit/doc/qi_and_karma.qbk 2008-07-15 12:13:27 EDT (Tue, 15 Jul 2008)
@@ -18,6 +18,9 @@
 [include qi_and_karma/num_list3.qbk]
 [include qi_and_karma/num_list4.qbk]
 [include qi_and_karma/roman.qbk]
+[include qi_and_karma/employee.qbk]
+[include qi_and_karma/mini_xml.qbk]
+[include qi_and_karma/error_handling.qbk]
 [endsect]
 
 [section Abstracts]

Modified: branches/release/libs/spirit/doc/qi_and_karma/complex.qbk
==============================================================================
--- branches/release/libs/spirit/doc/qi_and_karma/complex.qbk (original)
+++ branches/release/libs/spirit/doc/qi_and_karma/complex.qbk 2008-07-15 12:13:27 EDT (Tue, 15 Jul 2008)
@@ -35,7 +35,6 @@
 
 [import ../../example/qi/complex_number.cpp]
 
-
 Here goes, this time with actions:
 
 [tutorial_complex_number]

Added: branches/release/libs/spirit/doc/qi_and_karma/employee.qbk
==============================================================================
--- (empty file)
+++ branches/release/libs/spirit/doc/qi_and_karma/employee.qbk 2008-07-15 12:13:27 EDT (Tue, 15 Jul 2008)
@@ -0,0 +1,218 @@
+[/==============================================================================
+ Copyright (C) 2001-2008 Joel de Guzman
+ Copyright (C) 2001-2008 Hartmut Kaiser
+
+ Distributed under the Boost Software License, Version 1.0. (See accompanying
+ file LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt)
+===============================================================================/]
+
+[section Employee - Parsing into structs]
+
+It's a common question in the __spirit_list__: how do I parse and place the
+results into a C++ struct? Of course, at this point, you already know various
+ways to do it, using semantic actions. There are many ways to skin a cat.
+Spirit2, being fully attributed, makes it even easier. The next example
+demonstrates some features of Spirit2 that makes this easy. In the process,
+you'll learn about:
+
+* More about attributes
+* Auto rules
+* Some more built-in parsers
+* Directives
+
+[import ../../example/qi/employee.cpp]
+
+First, let's create a struct representing an employee:
+
+[tutorial_employee_struct]
+
+Then, we need to tell __fusion__ about our employee struct to make it a first-
+class fusion citizen. If you don't know fusion yet, it is a __boost__ library
+for working with heterogenous collections of data, commonly referred to as
+tuples. Spirit uses fusion extensively as part of its infrastructure.
+
+In fusion's view, a struct is just a form of a tuple. You can adapt any struct
+to be a fully conforming fusion tuple:
+
+[tutorial_employee_adapt_struct]
+
+Now we'll write a parser for our employee. Inputs will be of the form:
+
+ employee{ age, "surname", "forename", salary }
+
+Here goes:
+
+[tutorial_employee_parser]
+
+The full cpp file for this example can be found here: [@../../example/qi/employee.cpp]
+
+Let's walk through this one step at a time (not necessarily from top to bottom).
+
+ template <typename Iterator>
+ struct employee_parser : grammar<Iterator, employee(), space_type>
+
+`employee_parser` is a grammar. Like before, we make it a template so that we can
+reuse it for different iterator types. The grammar's signature is:
+
+ employee()
+
+meaning, the parser generates employee structs. `employee_parser` skips white
+spaces using `space_type` as its skip parser.
+
+ employee_parser() : employee_parser::base_type(start)
+
+Initializes the base class.
+
+ rule<Iterator, std::string(), space_type> quoted_string;
+ rule<Iterator, employee(), space_type> start;
+
+Declares two rules: `quoted_string` and `start`. `start` has the same template
+parameters as the grammar itself. `quoted_string` has a `std::string` attribute.
+
+[heading Lexeme]
+
+ lexeme['"' >> +(char_ - '"') >> '"'];
+
+`lexeme` inhibits space skipping from the open brace to the closing brace.
+The expression parses quoted strings.
+
+ +(char_ - '"')
+
+parses one or more chars, except the double quote. It stops when it sees
+a double quote.
+
+[heading Difference]
+
+The expression:
+
+ a - b
+
+parses `a` but not `b`. Its attribute is just `A`, the attribute of `a`. `b`'s
+attribute is ignored. Hence, the attribute of:
+
+ char_ - '"'
+
+is just `char`.
+
+[heading Plus]
+
+ +a
+
+is the close kin of the kleene star we got so used to in our tutorial. Like it's
+kin, the kleene star, its attribute is a `std::vector<A>` where `A` is the
+attribute of `a`. So, putting all these together, the attribute of
+
+ +(char_ - '"')
+
+is then:
+
+ std::vector<char>
+
+[heading Sequence Attribute]
+
+Now what's the attribute of
+
+ '"' >> +(char_ - '"') >> '"'
+
+?
+
+Well, typically, the attribute of:
+
+ a >> b >> c
+
+is:
+
+ fusion::vector<A, B, C>
+
+where `A` is the attribute of `a`, `B` is the attribute of `b` and `C` is the
+attribute of `c`. What is `fusion::vector`? - a tuple.
+
+[note If you don't know what I am talking about, see: [@http://tinyurl.com/6xun4j
+Fusion Vector]. It might be a good idea to have a look into __fusion__ at this
+point. You'll definitely see more of it in the coming pages.]
+
+[heading Attribute Collapsing]
+
+Some parsers, especially those very little literal parsers you see, like `'"'`,
+do not have attributes.
+
+Nodes without attributes are disregarded. In a sequence, like above, all nodes
+with no attributes are filtered out of the `fusion:vector`. So, since `'"'` has
+no attribute, and `+(char_ - '"')` has a `std::vector<char>` attribute, the
+whole expression's attribute should have been:
+
+ fusion::vector<std::vector<char> >
+
+But wait, there's one more collapsing rule: If after the attribute is a single
+element `fusion::vector`, The element is stripped naked from its container. So,
+to make a long story short, the attribute of the expression:
+
+ '"' >> +(char_ - '"') >> '"'
+
+is:
+
+ std::vector<char>
+
+[heading Auto Rules]
+
+It is typical to see rules like:
+
+ r = p[_val = _1];
+
+If you have a rule definition like above where the attribute of the RHS (right
+hand side) of the rule is compatibe with the attribute of the LHS (left hand
+side), then you can rewrite it as:
+
+ r %= p;
+
+The attribute of `p` automatically uses the attribute of `r`.
+
+So, going back to our `quoted_string` rule:
+
+ quoted_string %= lexeme['"' >> +(char_ - '"') >> '"'];
+
+is a simplified version of:
+
+ quoted_string = lexeme['"' >> +(char_ - '"') >> '"'][val_ = _1];
+
+The attribute of the `quoted_string` rule: `std::string` *is compatible* with
+the attribute of the RHS: `std::vector<char>`. The RHS extracts the parsed
+attribute directly into the rule's attribute, in-situ.
+
+[heading Finally]
+
+We're down to one rule, the start rule:
+
+ start %=
+ lit("employee")
+ >> '{'
+ >> int_ >> ','
+ >> quoted_string >> ','
+ >> quoted_string >> ','
+ >> double_
+ >> '}'
+ ;
+
+Applying our collapsing rules above, the RHS has an attribute of:
+
+ fusion::vector<int, std::string, std::string, double>
+
+These nodes do not have an attribute:
+
+* `lit("employee")`
+* `'{'`
+* `'}'`
+
+[note In case you are wondering, `lit("employee")` is the same as "employee". We
+had to wrap it inside `lit` because immediately after it is `>> '{'`. You can't
+right-shift a `char[]` and a `char` - you know, C++ syntax rules.]
+
+Recall that the attribute of `start` is the `employee` struct:
+
+[tutorial_employee_struct]
+
+Now everything is clear, right? The `struct employee` *IS* compatible with
+`fusion::vector<int, std::string, std::string, double>`. So, the RHS of `start`
+uses start's attribute (a `struct employee`) in-situ when it does its work.
+
+[endsect]

Modified: branches/release/libs/spirit/doc/qi_and_karma/error_handling.qbk
==============================================================================
--- branches/release/libs/spirit/doc/qi_and_karma/error_handling.qbk (original)
+++ branches/release/libs/spirit/doc/qi_and_karma/error_handling.qbk 2008-07-15 12:13:27 EDT (Tue, 15 Jul 2008)
@@ -6,5 +6,116 @@
     file LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt)
 ===============================================================================/]
 
-[section Error Handling]
+[section Mini XML - Error Handling]
+
+A parser will not be complete without error handling. Spirit2 provides some
+facilities to make it easy to adapt a grammar for error handling. We'll wrap up
+the Qi tutorial with another version of the mini xml parser, this time, with
+error handling.
+
+[@../../example/qi/mini_xml1.cpp] and here: [@../../example/qi/mini_xml2.cpp]
+
+[import ../../example/qi/mini_xml3.cpp]
+
+Here's the grammar:
+
+[tutorial_xml3_grammar]
+
+What's new?
+
+[heading Readable Names]
+
+First, when we call the base class, we give the grammar a name:
+
+ : mini_xml_grammar::base_type(xml, "xml")
+
+Then, we name all our rules:
+
+ xml.name("xml");
+ node.name("node");
+ text.name("text");
+ start_tag.name("start_tag");
+ end_tag.name("end_tag");
+
+[heading On Error]
+
+`on_error` declares our error handler:
+
+ on_error<Action>(rule, handler)
+
+This will specify what we will do when we get an error. We will print out an
+error message using phoenix:
+
+ on_error<fail>
+ (
+ xml
+ , std::cout
+ << val("Error! Expecting ")
+ << _4 // what failed?
+ << val(" here: \"")
+ << construct<std::string>(_3, _2) // iterators to error-pos, end
+ << val("\"")
+ << std::endl
+ );
+
+we choose to `fail` in our example for the `Action`: Quit and fail. Return a
+no_match (false). It can be one of:
+
+[table
+ [[`Action`] [Description]]
+ [[fail] [Quit and fail. Return a no_match.]]
+ [[retry] [Attempt error recovery, possibly moving the iterator position.]]
+ [[accept] [Force success, moving the iterator position appropriately.]]
+ [[rethrow] [Rethrows the error.]]
+]
+
+
+`rule` is the rule we attach the handler to. In our case, we are attaching to the
+`xml` rule.
+
+`handler` is the actual error handling function. It expects 4 arguments:
+
+[table
+ [[Arg] [Description]]
+ [[first] [The position of the iterator when the rule with the handler was entered.]]
+ [[last] [The end of input.]]
+ [[error-pos] [The actual position of the iterator where the error occurred.]]
+ [[what] [What failed: a string decribing the failure.]]
+]
+
+[heading Expectation Points]
+
+You might not have noticed it, but some of our expressions changed from using
+the `>>` to `>`. Look, for example:
+
+ end_tag =
+ "</"
+ > lit(_r1)
+ > '>'
+ ;
+
+What is it? It's the /expectation/ operator. You will have some "deterministic
+points" in the grammar. Those are the places where backtracking *cannot* occur.
+For our example above, when you get a `"</"`, you definitely must see a valid
+end-tag label next. It should be the one you got from the start-tag. After that,
+you definitely must have a `'>'` next. Otherwise, there is no point in
+proceeding forward and trying other branches, regardless where they are. The
+input is definitely erroneous. When this happens, an expectation_failure
+exception is thrown. Somewhere outward, the error handler will catch the
+exception.
+
+Try building the parser: [@../../example/qi/mini_xml2.cpp]. You can find some
+examples in: [@../../example/qi/mini_xml_samples] for testing purposes.
+"4.toyxml" has an error in it:
+
+ <foo><bar></foo></bar>
+
+Running the example with this gives you:
+
+ Error! Expecting "bar" here: "foo></bar>"
+ Error! Expecting end_tag here: "<bar></foo></bar>"
+ -------------------------
+ Parsing failed
+ -------------------------
+
 [endsect]

Added: branches/release/libs/spirit/doc/qi_and_karma/mini_xml.qbk
==============================================================================
--- (empty file)
+++ branches/release/libs/spirit/doc/qi_and_karma/mini_xml.qbk 2008-07-15 12:13:27 EDT (Tue, 15 Jul 2008)
@@ -0,0 +1,237 @@
+[/==============================================================================
+ Copyright (C) 2001-2008 Joel de Guzman
+ Copyright (C) 2001-2008 Hartmut Kaiser
+
+ Distributed under the Boost Software License, Version 1.0. (See accompanying
+ file LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt)
+===============================================================================/]
+
+[section Mini XML - ASTs!]
+
+Stop and think about it... We've come very close to generating an AST in our
+last example. We parsed a single structure and generated an in-memory
+representation of it in the form of a struct: the `struct employee`. If we
+changed the implementation to parse one or more employees, the result would be a
+`std::vector<employee>`. We can go on and add more hierarchy: teams,
+departments, corporations. Then we'll have an AST representation of it all.
+
+In this example (actually two examples), we'll now explore parsers how to create
+ASTs. We will parse a minimalistic XML like language and compile the results
+into our data structures in the form of a tree.
+
+Along the way, we'll see new features:
+
+* Inherited attributes
+* Variant attributes
+* Local Variables
+* Not Predicate
+* Lazy Lit
+
+The full cpp files for these examples can be found here:
+[@../../example/qi/mini_xml1.cpp] and here: [@../../example/qi/mini_xml2.cpp]
+
+There are a couple of sample toy-xml files in: [@../../example/qi/mini_xml_samples]
+for testing purposes. "4.toyxml" has an error in it.
+
+[import ../../example/qi/mini_xml1.cpp]
+[import ../../example/qi/mini_xml2.cpp]
+
+[heading First Cut]
+
+Without further delay, here's the first version of the XML grammar:
+
+[tutorial_xml1_grammar]
+
+Going bottom up, let's examine the `text` rule:
+
+ rule<Iterator, std::string(), space_type> text;
+
+and its definition:
+
+ text = lexeme[+(char_ - '<') [_val += _1]];
+
+The semantic action collects the chars and appends them (via +=) to the
+`std::string` attribute of the rule (represented by the placeholder `_val`).
+
+[heading Alternates]
+
+ rule<Iterator, mini_xml_node(), space_type> node;
+
+and its definition:
+
+ node = (xml | text) [_val = _1];
+
+We'll see what a `mini_xml_node` structure later. Looking at the rule
+definition, we see some alternation goiing on here. An xml `node` is
+either an `xml` OR `text`. Hmmm... hold on to that thought...
+
+ rule<Iterator, std::string(), space_type> start_tag;
+
+Again, with an attribute of `std::string`. Then, it's definition:
+
+ start_tag =
+ '<'
+ >> !char_('/')
+ >> lexeme[+(char_ - '>') [_val += _1]]
+ >> '>'
+ ;
+
+[heading Not Predicate]
+
+`start_tag` is similar to the `text` rule apart from the added `'<'` and `'>'`.
+But wait, to make sure that the `start_tag` does not parse `end_tag`s too, we
+add: `!char_('/')`. This is a "Not Predicate":
+
+ !p
+
+It will try the parser, `p`. If it is successful, fail, otherwise, pass. In
+other words, it negates the result of `p`. Like the `eps`, it does not consume
+any input though. It will always rewind the iterator position to where it
+was upon entry. So, the expression:
+
+ !char_('/')
+
+basically says: we should not have a `'/'` at this point.
+
+[heading Inherited Attribute]
+
+The `end_tag`:
+
+ rule<Iterator, void(std::string), space_type> end_tag;
+
+Ohh! Now we see an inherited attribute there: `std::string`. The `end_tag` does
+not have a synthesized attribute. Let's see its definition:
+
+ end_tag =
+ "</"
+ >> lit(_r1)
+ >> '>'
+ ;
+
+`_r1` is yet another __phoenix__ placeholder for the 1st inherited attribute (we
+have only one, use `_r2`, `_r3`, etc. if you have more).
+
+[heading A Lazy Lit]
+
+Check out how we used `lit` here, this time, not with a literal string, but with
+the value of the 1st inherited attribute, which is specified as `std::string` in
+our rule declaration.
+
+Finally, our `xml` rule:
+
+ rule<Iterator, mini_xml(), space_type> xml;
+
+`mini_xml` is our attribute here. We'll see later what it is. Let's see its
+definition:
+
+ xml =
+ start_tag [at_c<0>(_val) = _1]
+ >> *node [push_back(at_c<1>(_val), _1)]
+ >> end_tag(at_c<0>(_val))
+ ;
+
+Those who know __fusion__ now will notice `at_c<0>` and `at_c<1>`. This gives us
+a hint that `mini_xml` is a sort of a tuple - a fusion sequence. `at_c<N>` here
+is a lazy version of the tuple accessors, provided by __phoenix__.
+
+[heading How it all works]
+
+So, what's happening?
+
+# Upon parsing `start_tag`, the parsed start-tag string is placed in
+ `at_c<0>(_val)`.
+
+# Then we parse zero or more `node`s. At each step, we `push_back` the result
+ into `at_c<1>(_val)`.
+
+# Finally, we parse the `end_tag` giving it an inherited attribute: `at_c<0>(_val)`.
+ This is the string we obtained from the `start_tag`. Investigate `end_tag` above.
+ It will fail to parse if it gets something different from what we got from the
+ `start_tag`. This ensures that our tags are balanced.
+
+To give the last item some more light, what happens is this:
+
+ end_tag(at_c<0>(_val))
+
+calls:
+
+ end_tag =
+ "</"
+ >> lit(_r1)
+ >> '>'
+ ;
+
+passing in `at_c<0>(_val)`, the string from start tag. This is referred to in the
+`end_tag` body as `_r1`.
+
+[heading The Structures]
+
+Let's see our structures. It will definitely be hierarchical: xml is
+hierarchical. It will also be recursive: xml is recursive.
+
+[tutorial_xml1_structures]
+
+[heading Of Alternates and Variants]
+
+So that's how a `mini_xml_node` looks like. We had a hint that it is either
+a `string` or a `mini_xml`. For this, we use __boost_variant__. `boost::recursive_wrapper`
+wraps `mini_xml`, making it a recursive data structure.
+
+Yep, you got that right: the attribute of an alternate:
+
+ a | b
+
+is a
+
+ boost::variant<A, B>
+
+where `A` is the attribute of `a` and `B` is the attribute of `b`.
+
+[heading Adapting structs again]
+
+`mini_xml` is no brainier. It is a plain ol' struct. But as we've seen in our
+employee example, we can adapt that to be a __fusion__ sequence:
+
+[tutorial_xml1_adapt_structures]
+
+[heading One More Take]
+
+Here's another version. The AST structure remains the same, but this time,
+you'll see that we make use of auto-rules making the grammar semantic-action-
+less. Here it is:
+
+[tutorial_xml2_grammar]
+
+This one shouldn't be any more difficult to understand after going through the
+first xml parser example. The rules are almost the same, except that, we got rid
+of semantic actions and used auto-rules (see the employee example if you missed
+that). There are a couple of new stuff, though. It's all in the `xml` rule:
+
+[heading Local Variables]
+
+ rule<Iterator, mini_xml(), locals<std::string>, space_type> xml;
+
+Wow, we have four template parameters now. What's that `locals` guy doing there?
+Well, it declares that the rule `xml` will have one local variable: a `string`.
+Let's see how this is used in action:
+
+ xml %=
+ start_tag[_a = _1]
+ >> *node
+ >> end_tag(_a)
+ ;
+
+# Upon parsing `start_tag`, the parsed start-tag string is placed in
+ the local variable specified by (yet another) __phoenix__ placeholder:
+ `_a`. We have only one local variable. If we had more, these are designated
+ by `_b`..`_z`.
+
+# Then we parse zero or more `node`s.
+
+# Finally, we parse the `end_tag` giving it an inherited attribute: `_a`, our
+ local variable.
+
+There are no actions involved in stuffing data into our `xml` attribute. It's
+all taken cared of thatnks to the auto-rule.
+
+[endsect]

Modified: branches/release/libs/spirit/doc/qi_and_karma/roman.qbk
==============================================================================
--- branches/release/libs/spirit/doc/qi_and_karma/roman.qbk (original)
+++ branches/release/libs/spirit/doc/qi_and_karma/roman.qbk 2008-07-15 12:13:27 EDT (Tue, 15 Jul 2008)
@@ -17,14 +17,14 @@
 [heading Symbol Table]
 
 The symbol table holds a dictionary of symbols where each symbol is a sequence
-of characters (a `char`, `wchar\_t`, `int`, enumeration etc.) . The template
+of characters (a `char`, `wchar_t`, `int`, enumeration etc.) . The template
 class, parameterized by the character type, can work efficiently with 8, 16, 32
 and even 64 bit characters. Mutable data of type T is associated with each
 symbol.
 
 Traditionally, symbol table management is maintained seperately outside the BNF
 grammar through semantic actions. Contrary to standard practice, the Spirit
-symbol table class symbols is-a parser. An instance of which may be used
+symbol table class symbols is-a parser. An object of which may be used
 anywhere in the EBNF grammar specification. It is an example of a dynamic
 parser. A dynamic parser is characterized by its ability to modify its behavior
 at run time. Initially, an empty symbols object matches nothing. At any time,
@@ -57,4 +57,114 @@
 Now we can use `hundreds`, `tens` and `ones` anywhere in our parser expressions.
 They are all parsers.
 
+[heading Rules]
+
+Up until now, we've been inlining our parser expressions, passing them directly
+to the `phrase_parse` function. The expression evaluates into a temporary,
+unnamed parser which is passed into the `phrase_parse` function, used, and then
+destroyed. This is fine for small parsers. When the expressions get complicated,
+you'd want to break the expressions into smaller easier to understand pieces,
+name them, and refer to them from other parser expressions by name.
+
+A parser expression can be assigned to, what is called, a "rule". There are
+various ways to declare rules. The simplest form is:
+
+ rule<Iterator> r;
+
+At the very least, the rule needs to know the iterator type it will be working
+on. This rule cannot be used with `phrase_parse`. It can only be used with the
+`parse` function -- a version that does not do white space skipping (does not
+have the skipper argument). If you want to have it skip white spaces, you need
+to pass in the type skip parser, as in the next form:
+
+ rule<Iterator, Skipper> r;
+
+Example:
+
+ rule<std::string::iterator, space_type> r;
+
+This type of rule can be used for both `phrase_parse` and `parse`.
+
+For our next example, there's one more rule form you should know about:
+
+ rule<Iterator, Signature> r;
+
+or
+
+ rule<Iterator, Signature, Skipper> r;
+
+[tip All rule template arguments after Iterator can be supplied in any order.]
+
+The Signature specifies the attributes of the rule. You've seen that our parsers
+can have an attribute. Recall that the `double_` parser has an attribute of
+`double`. To be precise, these are /synthesized/ attributes. The parser
+"synthesizes" the attribute value. Think of them as function return values.
+
+There's another type of attribute called "inherited" attribute. We won't need
+them for now, but it's good that you be aware of such attributes. You can think
+of them as function arguments. And, rightly so, the rule signature is a function
+signature of the form:
+
+ result(argN, argN,..., argN)
+
+After having declared a rule, you can now assign any parser expression to it.
+Example:
+
+ r = double_ >> *(',' >> double_);
+
+[heading Grammars]
+
+A grammar encapsulates one or more rules. It has the same template parameters as
+the rule. You declare a grammar by:
+
+# deriving a struct (or class) from the `grammar` class template
+# declare one or more rules as member variables
+# initialize the base grammar class by giving it the start rule (its the first
+ rule that gets called when the grammar starts parsing)
+# initialize your rules in your constructor
+
+The roman numeral grammar is a very nice and simple example of a grammar:
+
+[tutorial_roman_grammar]
+
+Things to take notice of:
+
+* The grammar and start rule signature is `unsigned()`. It has a synthesized
+ attribute (return value) of type `unsigned` with no inherited attributes
+ (arguments).
+
+* We did not specify a skip-parser. We don't want to skip in between the
+ numerals.
+
+* `roman::base_type` is a typedef for `grammar<Iterator, unsigned()>`. If
+ `roman` was not a template, you can simply write: base_type(start)
+
+* But it's best to make your grammar templates, so that they can be reused
+ for different iterator types.
+
+* `_val` is another __phoenix__ placeholder representing the rule's synthesized
+ attribute.
+
+* `eps` is a special spirit parser that consumes no input but is always
+ successful. We use it to initialize `_val`, the rule's synthesized
+ attribute, to zero before anything else. The actual parser starts at
+ `+char_('M')`, parsing roman thousands. Using `eps` this way is good
+ for doing pre and post initializations.
+
+* The expression `a || b` reads: match a or b and in sequence. That is, if both
+ `a` and `b` match, it must be in sequence; this is equivalent to `a >> !b | b`,
+ but more efficient.
+
+[heading Let's Parse!]
+
+[tutorial_roman_grammar_parse]
+
+`roman_parser` is an object of type `roman` -our roman numeral parser. This time
+around, we are using the no-skipping version of the parse functions. We do not
+want to skip any spaces! We are also passing in an attribute, `unsigned result`,
+which will receive the parsed value.
+
+The full cpp file for this example can be found here: [@../../example/qi/roman.cpp]
+
+
 [endsect]

Modified: branches/release/libs/spirit/doc/spirit2.qbk
==============================================================================
--- branches/release/libs/spirit/doc/spirit2.qbk (original)
+++ branches/release/libs/spirit/doc/spirit2.qbk 2008-07-15 12:13:27 EDT (Tue, 15 Jul 2008)
@@ -24,6 +24,7 @@
 [/ Some links ]
 
 [def __spirit__ [@http://spirit.sourceforge.net Spirit]]
+[def __spirit_list__ [@http://www.nabble.com/The-Spirit-Parser-Library-f3430.html Spirit General List]]
 [def __phoenix__ [@../../phoenix/doc/html/index.html Phoenix]]
 [def __phoenix2__ [@../../phoenix/doc/html/index.html Phoenix2]]
 [def __fusion__ [@http://spirit.sourceforge.net/dl_more/fusion_v2/libs/fusion/doc/html/index.html Fusion]]
@@ -49,7 +50,7 @@
 [def __re2c__ [@http://re2c.sourceforge.net/ re2c]]
 [def __ragel__ [@http://www.cs.queensu.ca/~thurston/ragel/ Ragel]]
 
-[def __boost_variant__ [@http://www.boost.org/doc/html/variant.html `boost::variant<>`]]
+[def __boost_variant__ [@http://www.boost.org/doc/html/variant.html `boost.variant<>`]]
 [def __boost_iterator_range__ [@http://www.boost.org/libs/range/doc/utility_class.html#iter_range `boost::iterator_range<>`]]
 [def __boost_bind__ [@http://www.boost.org/libs/bind/index.html Boost.Bind]]
 [def __boost_lambda__ [@http://www.boost.org/libs/lambda/index.html Boost.Lambda]]
@@ -69,32 +70,32 @@
 [def __sec_qi_and_karma__ [link spirit.qi_and_karma Qi and Karma]]
 [def __sec_qi_karma_attributes__ [link spirit.qi_and_karma.abstracts.attributes Attributes]]
 
-[def __sec_lex__ [link spirit.__lex__ Lex]]
-[def __sec_lex_quickstart_1__ [link spirit.__lex__.__lex___tutorials.quickstart_1___a_word_counter_using___lex__ Lex Quickstart 1 - A word counter using __lex__]]
-[def __sec_lex_quickstart_2__ [link spirit.__lex__.__lex___tutorials.quickstart_2___a_better_word_counter_using___lex__ Lex Quickstart 2 - A better word counter using __lex__]]
-[def __sec_lex_quickstart_3__ [link spirit.__lex__.__lex___tutorials.quickstart_3___counting_words_using_a_parser Lex Quickstart 3 - Counting Words Using a Parser]]
-
-[def __sec_lex_static_model__ [link spirit.__lex__.abstracts.the__static__lexer_model The /Static/ Model]]
-[def __sec_lex_primitives__ [link spirit.__lex__.abstracts.lexer_primitives Lexer Primitives]]
-[def __sec_lex_tokenvalues__ [link spirit.__lex__.abstracts.lexer_primitives.about_tokens_and_token_values About Tokens and Token Values]]
-[def __sec_lex_attributes__ [link spirit.__lex__.abstracts.lexer_attributes Lexer Attributes]]
+[def __sec_lex__ [link spirit.lex Lex]]
+[def __sec_lex_quickstart_1__ [link spirit.lex.tutorials.lexer_quickstart1 Lex Quickstart 1 - A word counter using __lex__]]
+[def __sec_lex_quickstart_2__ [link spirit.lex.tutorials.lexer_quickstart2 Lex Quickstart 2 - A better word counter using __lex__]]
+[def __sec_lex_quickstart_3__ [link spirit.lex.tutorials.lexer_quickstart3 Lex Quickstart 3 - Counting Words Using a Parser]]
+
+[def __sec_lex_static_model__ [link spirit.lex.abstracts.lexer_static_model The /Static/ Model]]
+[def __sec_lex_primitives__ [link spirit.lex.abstracts.lexer_primitives Lexer Primitives]]
+[def __sec_lex_tokenvalues__ [link spirit.lex.abstracts.lexer_primitives.lexer_token_values About Tokens and Token Values]]
+[def __sec_lex_attributes__ [link spirit.lex.abstracts.lexer_attributes Lexer Attributes]]
 
-[def __sec_ref_lex_token__ [link spirit.__lex__.reference.concepts.token Token Reference]]
-[def __sec_ref_lex_token_def__ [link spirit.__lex__.reference.concepts.tokendef TokenDef Reference]]
+[def __sec_ref_lex_token__ [link spirit.lex.reference.concepts.token Token Reference]]
+[def __sec_ref_lex_token_def__ [link spirit.lex.reference.concepts.tokendef TokenDef Reference]]
 
 [/ References to API descriptions ]
 
 [def __api_tokenize_and_parse__ [link spirit.qi_and_karma.abstracts.parsing_and_generating.the_tokenize_and_phrase_parse___function `tokenize_and_parse()`]]
-[def __api_generate_static__ [link spirit.__lex__.abstracts.tokenizing_input_data.the_generate_static___function `generate_static()`]]
+[def __api_generate_static__ [link spirit.lex.abstracts.tokenizing_input_data.the_generate_static___function `generate_static()`]]
 
 
 [/ References to classes ]
 
-[def __class_token_def__ [link spirit.__lex__.reference.tokendef_class `token_def<>`]]
+[def __class_token_def__ [link spirit.lex.reference.tokendef_class `token_def<>`]]
 
-[def __class_lexertl_token__ [link spirit.__lex__.reference.token_class `lexertl_token<>`]]
-[def __class_lexertl_lexer__ [link spirit.__lex__.reference.lexer_class.the_lexertl_lexer_class_implementing_the_dynamic_model `lexertl_lexer<>`]]
-[def __class_lexertl_static_lexer__ [link spirit.__lex__.reference.lexer_class.the_lexertl_static_lexer_class_implementing_the_static_model `lexertl_static_lexer<>`]]
+[def __class_lexertl_token__ [link spirit.lex.reference.token_class `lexertl_token<>`]]
+[def __class_lexertl_lexer__ [link spirit.lex.reference.lexer_class.the_lexertl_lexer_class_implementing_the_dynamic_model `lexertl_lexer<>`]]
+[def __class_lexertl_static_lexer__ [link spirit.lex.reference.lexer_class.the_lexertl_static_lexer_class_implementing_the_static_model `lexertl_static_lexer<>`]]
 
 
 [/ Some images ]

Modified: branches/release/libs/spirit/example/karma/calc2_ast_dump.cpp
==============================================================================
--- branches/release/libs/spirit/example/karma/calc2_ast_dump.cpp (original)
+++ branches/release/libs/spirit/example/karma/calc2_ast_dump.cpp 2008-07-15 12:13:27 EDT (Tue, 15 Jul 2008)
@@ -32,9 +32,9 @@
 // Our calculator parser grammar
 ///////////////////////////////////////////////////////////////////////////////
 template <typename Iterator>
-struct calculator : qi::grammar_def<Iterator, expression_ast(), space_type>
+struct calculator : qi::grammar<Iterator, expression_ast(), space_type>
 {
- calculator()
+ calculator() : calculator::base_type(expression)
     {
         expression =
             term [_val = _1]
@@ -66,9 +66,9 @@
 ///////////////////////////////////////////////////////////////////////////////
 template <typename OuputIterator>
 struct dump_ast
- : karma::grammar_def<OuputIterator, expression_ast(), space_type>
+ : karma::grammar<OuputIterator, expression_ast(), space_type>
 {
- dump_ast()
+ dump_ast() : dump_ast::base_type(ast_node)
     {
         ast_node %=
                 int_ [_1 = _int(_val)]
@@ -111,15 +111,13 @@
     typedef std::string::const_iterator iterator_type;
     typedef calculator<iterator_type> calculator;
 
- calculator def;
- qi::grammar<calculator> calc(def, def.expression);
+ calculator calc;
 
     // Our generator grammar definitions
     typedef std::back_insert_iterator<std::string> output_iterator_type;
     typedef dump_ast<output_iterator_type> dump_ast;
-
- dump_ast dump_ast_def;
- karma::grammar<dump_ast> ast_grammar(dump_ast_def, dump_ast_def.ast_node);
+
+ dump_ast ast_grammar;
 
     std::string str;
     while (std::getline(std::cin, str))

Modified: branches/release/libs/spirit/example/karma/calc2_ast_rpn.cpp
==============================================================================
--- branches/release/libs/spirit/example/karma/calc2_ast_rpn.cpp (original)
+++ branches/release/libs/spirit/example/karma/calc2_ast_rpn.cpp 2008-07-15 12:13:27 EDT (Tue, 15 Jul 2008)
@@ -32,9 +32,9 @@
 // Our calculator parser grammar
 ///////////////////////////////////////////////////////////////////////////////
 template <typename Iterator>
-struct calculator : qi::grammar_def<Iterator, expression_ast(), space_type>
+struct calculator : qi::grammar<Iterator, expression_ast(), space_type>
 {
- calculator()
+ calculator() : calculator::base_type(expression)
     {
         expression =
             term [_val = _1]
@@ -67,9 +67,9 @@
 ///////////////////////////////////////////////////////////////////////////////
 template <typename OuputIterator>
 struct ast_rpn
- : karma::grammar_def<OuputIterator, expression_ast(), space_type>
+ : karma::grammar<OuputIterator, expression_ast(), space_type>
 {
- ast_rpn()
+ ast_rpn() : ast_rpn::base_type(ast_node)
     {
         ast_node %=
                 int_ [_1 = _int(_val)]
@@ -114,15 +114,13 @@
     typedef std::string::const_iterator iterator_type;
     typedef calculator<iterator_type> calculator;
 
- calculator def;
- qi::grammar<calculator> calc(def, def.expression);
+ calculator calc;
 
     // Our generator grammar definitions
     typedef std::back_insert_iterator<std::string> output_iterator_type;
     typedef ast_rpn<output_iterator_type> ast_rpn;
     
- ast_rpn ast_rpn_def;
- karma::grammar<ast_rpn> ast_grammar(ast_rpn_def, ast_rpn_def.ast_node);
+ ast_rpn ast_grammar;
 
     std::string str;
     while (std::getline(std::cin, str))

Modified: branches/release/libs/spirit/example/karma/calc2_ast_vm.cpp
==============================================================================
--- branches/release/libs/spirit/example/karma/calc2_ast_vm.cpp (original)
+++ branches/release/libs/spirit/example/karma/calc2_ast_vm.cpp 2008-07-15 12:13:27 EDT (Tue, 15 Jul 2008)
@@ -34,9 +34,9 @@
 // Our calculator parser grammar
 ///////////////////////////////////////////////////////////////////////////////
 template <typename Iterator>
-struct calculator : qi::grammar_def<Iterator, expression_ast(), space_type>
+struct calculator : qi::grammar<Iterator, expression_ast(), space_type>
 {
- calculator()
+ calculator() : calculator::base_type(expression)
     {
         expression =
             term [_val = _1]
@@ -133,9 +133,9 @@
 ///////////////////////////////////////////////////////////////////////////////
 template <typename OuputIterator, typename Delimiter>
 struct generate_byte_code
- : karma::grammar_def<OuputIterator, expression_ast(), Delimiter>
+ : karma::grammar<OuputIterator, expression_ast(), Delimiter>
 {
- generate_byte_code()
+ generate_byte_code() : generate_byte_code::base_type(ast_node)
     {
         ast_node %=
                 (dword(op_int) << dword) [_1 = _int(_val)]
@@ -172,11 +172,8 @@
     // Our generator grammar definitions
     typedef char* output_iterator_type;
     typedef generate_byte_code<output_iterator_type, Delimiter> generate_byte_code;
-
- generate_byte_code generate_byte_code_def;
- karma::grammar<generate_byte_code> gen_vm(
- generate_byte_code_def, generate_byte_code_def.ast_node);
 
+ generate_byte_code gen_vm;
     return karma::generate_delimited((*code.begin()).bytes, gen_vm, ast, d);
 }
 
@@ -195,8 +192,7 @@
     typedef std::string::const_iterator iterator_type;
     typedef calculator<iterator_type> calculator;
 
- calculator def;
- qi::grammar<calculator> calc(def, def.expression);
+ calculator calc;
 
     std::string str;
     while (std::getline(std::cin, str))

Modified: branches/release/libs/spirit/example/karma/mini_xml_karma.cpp
==============================================================================
--- branches/release/libs/spirit/example/karma/mini_xml_karma.cpp (original)
+++ branches/release/libs/spirit/example/karma/mini_xml_karma.cpp 2008-07-15 12:13:27 EDT (Tue, 15 Jul 2008)
@@ -71,9 +71,9 @@
 ///////////////////////////////////////////////////////////////////////////////
 template <typename Iterator>
 struct mini_xml_parser :
- qi::grammar_def<Iterator, mini_xml(), space_type>
+ qi::grammar<Iterator, mini_xml(), space_type>
 {
- mini_xml_parser()
+ mini_xml_parser() : mini_xml_parser::base_type(xml)
     {
         text = lexeme[+(char_ - '<') [_val += _1]];
         node = (xml | text) [_val = _1];
@@ -128,9 +128,9 @@
 ///////////////////////////////////////////////////////////////////////////////
 template <typename OutputIterator>
 struct mini_xml_generator
- : karma::grammar_def<OutputIterator, mini_xml()>
+ : karma::grammar<OutputIterator, mini_xml()>
 {
- mini_xml_generator()
+ mini_xml_generator() : mini_xml_generator::base_type(xml)
     {
         node %=
                 lit[_1 = _string(_r0)]
@@ -180,8 +180,7 @@
         std::back_inserter(storage));
 
     typedef mini_xml_parser<std::string::const_iterator> mini_xml_parser;
- mini_xml_parser def; // Our grammar definition
- qi::grammar<mini_xml_parser> xmlin(def, def.xml); // Our grammar
+ mini_xml_parser xmlin; // Our grammar definition
     mini_xml ast; // our tree
 
     std::string::const_iterator iter = storage.begin();
@@ -197,8 +196,7 @@
         typedef std::back_insert_iterator<std::string> outiter_type;
         typedef mini_xml_generator<outiter_type> mini_xml_generator;
 
- mini_xml_generator gen; // Our grammar definition
- karma::grammar<mini_xml_generator> xmlout(gen, gen.xml); // Our grammar
+ mini_xml_generator xmlout; // Our grammar definition
 
         std::string generated;
         bool r = karma::generate(std::back_inserter(generated), xmlout, ast);

Modified: branches/release/libs/spirit/example/lex/example1.cpp
==============================================================================
--- branches/release/libs/spirit/example/lex/example1.cpp (original)
+++ branches/release/libs/spirit/example/lex/example1.cpp 2008-07-15 12:13:27 EDT (Tue, 15 Jul 2008)
@@ -61,10 +61,11 @@
 ///////////////////////////////////////////////////////////////////////////////
 template <typename Iterator>
 struct example1_grammar
- : grammar_def<Iterator, in_state_skipper<token_def<> > >
+ : grammar<Iterator, in_state_skipper<token_def<> > >
 {
     template <typename TokenDef>
     example1_grammar(TokenDef const& tok)
+ : example1_grammar::base_type(start)
     {
         start = '{' >> *(tok.identifier >> -char_(',')) >> '}';
     }
@@ -97,10 +98,9 @@
     // now we use the types defined above to create the lexer and grammar
     // object instances needed to invoke the parsing process
     example1_tokens tokens; // Our token definition
- example1_grammar def (tokens); // Our grammar definition
+ example1_grammar calc(tokens); // Our grammar definition
 
     lexer<example1_tokens> lex(tokens); // Our lexer
- grammar<example1_grammar> calc(def); // Our parser
 
     std::string str (read_from_file("example1.input"));
 

Modified: branches/release/libs/spirit/example/lex/example2.cpp
==============================================================================
--- branches/release/libs/spirit/example/lex/example2.cpp (original)
+++ branches/release/libs/spirit/example/lex/example2.cpp 2008-07-15 12:13:27 EDT (Tue, 15 Jul 2008)
@@ -63,11 +63,12 @@
 // Grammar definition
 ///////////////////////////////////////////////////////////////////////////////
 template <typename Iterator>
-struct example2_grammar : grammar_def<Iterator>
+struct example2_grammar : grammar<Iterator>
 {
     template <typename TokenDef>
     example2_grammar(TokenDef const& tok)
- : paragraphs(0), commands(0), questions(0), statements(0)
+ : example2_grammar::base_type(story),
+ paragraphs(0), commands(0), questions(0), statements(0)
     {
         story
             = +paragraph
@@ -131,10 +132,9 @@
     // now we use the types defined above to create the lexer and grammar
     // object instances needed to invoke the parsing process
     example2_tokens tokens; // Our token definition
- example2_grammar def (tokens); // Our grammar definition
+ example2_grammar calc(tokens); // Our grammar definition
 
     lexer<example2_tokens> lex(tokens); // Our lexer
- grammar<example2_grammar> calc(def, def.story); // Our grammar
 
     std::string str (read_from_file("example2.input"));
 
@@ -153,9 +153,9 @@
         std::cout << "-------------------------\n";
         std::cout << "Parsing succeeded\n";
         std::cout << "There were "
- << def.commands << " commands, "
- << def.questions << " questions, and "
- << def.statements << " statements.\n";
+ << calc.commands << " commands, "
+ << calc.questions << " questions, and "
+ << calc.statements << " statements.\n";
         std::cout << "-------------------------\n";
     }
     else

Modified: branches/release/libs/spirit/example/lex/example3.cpp
==============================================================================
--- branches/release/libs/spirit/example/lex/example3.cpp (original)
+++ branches/release/libs/spirit/example/lex/example3.cpp 2008-07-15 12:13:27 EDT (Tue, 15 Jul 2008)
@@ -73,10 +73,11 @@
 ///////////////////////////////////////////////////////////////////////////////
 template <typename Iterator, typename Lexer>
 struct example3_grammar
- : grammar_def<Iterator, in_state_skipper<typename Lexer::token_set> >
+ : grammar<Iterator, in_state_skipper<typename Lexer::token_set> >
 {
     template <typename TokenDef>
     example3_grammar(TokenDef const& tok)
+ : example3_grammar::base_type(start)
     {
         start
             = +(couplet | tok.ellipses)
@@ -105,17 +106,17 @@
 {
     // iterator type used to expose the underlying input stream
     typedef std::string::iterator base_iterator_type;
-
+
     // This is the token type to return from the lexer iterator
     typedef lexertl_token<base_iterator_type> token_type;
-
+
     // This is the lexer type to use to tokenize the input.
     // Here we use the lexertl based lexer engine.
     typedef lexertl_lexer<token_type> lexer_type;
-
+
     // This is the token definition type (derived from the given lexer type).
     typedef example3_tokens<lexer_type> example3_tokens;
-
+
     // this is the iterator type exposed by the lexer
     typedef lexer<example3_tokens>::iterator_type iterator_type;
 
@@ -125,10 +126,9 @@
     // now we use the types defined above to create the lexer and grammar
     // object instances needed to invoke the parsing process
     example3_tokens tokens; // Our token definition
- example3_grammar def (tokens); // Our grammar definition
+ example3_grammar calc(tokens); // Our grammar definition
 
     lexer<example3_tokens> lex(tokens); // Our lexer
- grammar<example3_grammar> calc(def); // Our grammar
 
     std::string str (read_from_file("example3.input"));
 
@@ -137,7 +137,7 @@
     std::string::iterator it = str.begin();
     iterator_type iter = lex.begin(it, str.end());
     iterator_type end = lex.end();
-
+
     // Parsing is done based on the the token stream, not the character
     // stream read from the input.
     // Note, how we use the token_set defined above as the skip parser.

Modified: branches/release/libs/spirit/example/lex/example4.cpp
==============================================================================
--- branches/release/libs/spirit/example/lex/example4.cpp (original)
+++ branches/release/libs/spirit/example/lex/example4.cpp 2008-07-15 12:13:27 EDT (Tue, 15 Jul 2008)
@@ -101,10 +101,11 @@
 ///////////////////////////////////////////////////////////////////////////////
 template <typename Iterator, typename Lexer>
 struct example4_grammar
- : grammar_def<Iterator, in_state_skipper<typename Lexer::token_set> >
+ : grammar<Iterator, in_state_skipper<typename Lexer::token_set> >
 {
     template <typename TokenDef>
     example4_grammar(TokenDef const& tok)
+ : example4_grammar::base_type(program)
     {
         program
             = +block
@@ -202,10 +203,9 @@
     // now we use the types defined above to create the lexer and grammar
     // object instances needed to invoke the parsing process
     example4_tokens tokens; // Our token definition
- example4_grammar def (tokens); // Our grammar definition
+ example4_grammar calc(tokens); // Our grammar definition
 
     lexer<example4_tokens> lex(tokens); // Our lexer
- grammar<example4_grammar> calc(def, def.program); // Our grammar
 
     std::string str (read_from_file("example4.input"));
 

Modified: branches/release/libs/spirit/example/lex/example5.cpp
==============================================================================
--- branches/release/libs/spirit/example/lex/example5.cpp (original)
+++ branches/release/libs/spirit/example/lex/example5.cpp 2008-07-15 12:13:27 EDT (Tue, 15 Jul 2008)
@@ -100,10 +100,11 @@
 ///////////////////////////////////////////////////////////////////////////////
 template <typename Iterator, typename Lexer>
 struct example5_base_grammar
- : grammar_def<Iterator, in_state_skipper<typename Lexer::token_set> >
+ : grammar<Iterator, in_state_skipper<typename Lexer::token_set> >
 {
     template <typename TokenDef>
     example5_base_grammar(TokenDef const& tok)
+ : example5_base_grammar::base_type(program)
     {
         program
             = +block
@@ -150,7 +151,7 @@
     }
 
     typedef
- grammar_def<Iterator, in_state_skipper<typename Lexer::token_set> >
+ grammar<Iterator, in_state_skipper<typename Lexer::token_set> >
     base_type;
     typedef typename base_type::skipper_type skipper_type;
     
@@ -245,10 +246,9 @@
     // now we use the types defined above to create the lexer and grammar
     // object instances needed to invoke the parsing process
     example5_tokens tokens; // Our token definition
- example5_grammar def (tokens); // Our grammar definition
+ example5_grammar calc(tokens); // Our grammar definition
 
     lexer<example5_tokens> lex(tokens); // Our lexer
- grammar<example5_grammar> calc(def, def.program); // Our grammar
 
     std::string str (read_from_file("example5.input"));
 

Modified: branches/release/libs/spirit/example/lex/example6.cpp
==============================================================================
--- branches/release/libs/spirit/example/lex/example6.cpp (original)
+++ branches/release/libs/spirit/example/lex/example6.cpp 2008-07-15 12:13:27 EDT (Tue, 15 Jul 2008)
@@ -122,10 +122,11 @@
 ///////////////////////////////////////////////////////////////////////////////
 template <typename Iterator, typename Lexer>
 struct example6_grammar
- : grammar_def<Iterator, in_state_skipper<typename Lexer::token_set> >
+ : grammar<Iterator, in_state_skipper<typename Lexer::token_set> >
 {
     template <typename TokenDef>
     example6_grammar(TokenDef const& tok)
+ : example6_grammar::base_type(program)
     {
         program
             = +block
@@ -225,10 +226,9 @@
     // now we use the types defined above to create the lexer and grammar
     // object instances needed to invoke the parsing process
     example6_tokens tokens; // Our token definition
- example6_grammar def (tokens); // Our grammar definition
+ example6_grammar calc(tokens); // Our grammar definition
 
     lexer<example6_tokens> lex(tokens); // Our lexer
- grammar<example6_grammar> calc(def, def.program); // Our grammar
 
     std::string str (read_from_file("example6.input"));
 

Modified: branches/release/libs/spirit/example/lex/print_numbers.cpp
==============================================================================
--- branches/release/libs/spirit/example/lex/print_numbers.cpp (original)
+++ branches/release/libs/spirit/example/lex/print_numbers.cpp 2008-07-15 12:13:27 EDT (Tue, 15 Jul 2008)
@@ -52,11 +52,11 @@
 ///////////////////////////////////////////////////////////////////////////////
 // Grammar definition
 ///////////////////////////////////////////////////////////////////////////////
-template <typename Iterator, typename Skipper>
-struct print_numbers_grammar : grammar_def<Iterator, Skipper>
+template <typename Iterator>
+struct print_numbers_grammar : grammar<Iterator>
 {
- template <typename Class>
- print_numbers_grammar(Class& self)
+ print_numbers_grammar()
+ : grammar<Iterator>(start)
     {
         start = *( token(lex::min_token_id) [ std::cout << _1 << "\n" ]
                   | token(lex::min_token_id+1)
@@ -90,7 +90,7 @@
     // now we use the types defined above to create the lexer and grammar
     // object instances needed to invoke the parsing process
     print_numbers_tokens<lexer_type> print_tokens; // Our token definition
- grammar_class<print_numbers_grammar> print; // Our grammar definition
+ print_numbers_grammar<iterator_type> print; // Our grammar definition
 
     // Parsing is done based on the the token stream, not the character
     // stream read from the input.

Modified: branches/release/libs/spirit/example/lex/static_lexer/word_count_static.cpp
==============================================================================
--- branches/release/libs/spirit/example/lex/static_lexer/word_count_static.cpp (original)
+++ branches/release/libs/spirit/example/lex/static_lexer/word_count_static.cpp 2008-07-15 12:13:27 EDT (Tue, 15 Jul 2008)
@@ -44,11 +44,11 @@
 // definition class instance passed to the constructor to allow accessing the
 // embedded token_def<> instances.
 template <typename Iterator>
-struct word_count_grammar : grammar_def<Iterator>
+struct word_count_grammar : grammar<Iterator>
 {
     template <typename TokenDef>
     word_count_grammar(TokenDef const& tok)
- : c(0), w(0), l(0)
+ : grammar<Iterator>(start), c(0), w(0), l(0)
     {
         using boost::spirit::arg_names::_1;
         using boost::phoenix::ref;
@@ -92,8 +92,8 @@
 
     // Now we use the types defined above to create the lexer and grammar
     // object instances needed to invoke the parsing process.
- word_count_tokens<lexer_type> word_count; // Our token definition
- word_count_grammar<iterator_type> def (word_count); // Our grammar definition
+ word_count_tokens<lexer_type> word_count; // Our token definition
+ word_count_grammar<iterator_type> g (word_count); // Our grammar definition
 
     // Read in the file into memory.
     std::string str (read_from_file(1 == argc ? "word_count.input" : argv[1]));
@@ -101,12 +101,11 @@
     char const* last = &first[str.size()];
     
     // Parsing is done based on the the token stream, not the character stream.
- qi::grammar<word_count_grammar<iterator_type> > g(def);
     bool r = tokenize_and_parse(first, last, make_lexer(word_count), g);
 
     if (r) { // success
- std::cout << "lines: " << def.l << ", words: " << def.w
- << ", characters: " << def.c << "\n";
+ std::cout << "lines: " << g.l << ", words: " << g.w
+ << ", characters: " << g.c << "\n";
     }
     else {
         std::string rest(first, last);

Modified: branches/release/libs/spirit/example/lex/strip_comments.cpp
==============================================================================
--- branches/release/libs/spirit/example/lex/strip_comments.cpp (original)
+++ branches/release/libs/spirit/example/lex/strip_comments.cpp 2008-07-15 12:13:27 EDT (Tue, 15 Jul 2008)
@@ -95,10 +95,11 @@
 // Grammar definition
 ///////////////////////////////////////////////////////////////////////////////
 template <typename Iterator>
-struct strip_comments_grammar : grammar_def<Iterator>
+struct strip_comments_grammar : grammar<Iterator>
 {
     template <typename TokenDef>
     strip_comments_grammar(TokenDef const& tok)
+ : grammar<Iterator>(start)
     {
         // The in_state("COMMENT")[...] parser component switches the lexer
         // state to be 'COMMENT' during the matching of the embedded parser.
@@ -134,15 +135,14 @@
 
     // now we use the types defined above to create the lexer and grammar
     // object instances needed to invoke the parsing process
- strip_comments_tokens<lexer_type> strip_comments; // Our token definition
- strip_comments_grammar<iterator_type> def (strip_comments); // Our grammar definition
+ strip_comments_tokens<lexer_type> strip_comments; // Our token definition
+ strip_comments_grammar<iterator_type> g (strip_comments); // Our grammar definition
 
     // Parsing is done based on the the token stream, not the character
     // stream read from the input.
     std::string str (read_from_file(1 == argc ? "strip_comments.input" : argv[1]));
     base_iterator_type first = str.begin();
 
- qi::grammar<strip_comments_grammar<iterator_type> > g(def);
     bool r = tokenize_and_parse(first, str.end(), make_lexer(strip_comments), g);
 
     if (r) {

Modified: branches/release/libs/spirit/example/lex/word_count.cpp
==============================================================================
--- branches/release/libs/spirit/example/lex/word_count.cpp (original)
+++ branches/release/libs/spirit/example/lex/word_count.cpp 2008-07-15 12:13:27 EDT (Tue, 15 Jul 2008)
@@ -99,11 +99,11 @@
 ///////////////////////////////////////////////////////////////////////////////
 //[wcp_grammar_definition
 template <typename Iterator>
-struct word_count_grammar : grammar_def<Iterator>
+struct word_count_grammar : grammar<Iterator>
 {
     template <typename TokenDef>
     word_count_grammar(TokenDef const& tok)
- : c(0), w(0), l(0)
+ : grammar<Iterator>(start), c(0), w(0), l(0)
     {
         using boost::phoenix::ref;
         using boost::phoenix::size;
@@ -144,8 +144,8 @@
 
     // now we use the types defined above to create the lexer and grammar
     // object instances needed to invoke the parsing process
- word_count_tokens<lexer_type> word_count; // Our token definition
- word_count_grammar<iterator_type> def (word_count); // Our grammar definition
+ word_count_tokens<lexer_type> word_count; // Our token definition
+ word_count_grammar<iterator_type> g (word_count); // Our grammar definition
 
     // read in the file int memory
     std::string str (read_from_file(1 == argc ? "word_count.input" : argv[1]));
@@ -156,12 +156,11 @@
     // stream read from the input. The function `tokenize_and_parse()` wraps
     // the passed iterator range `[first, last)` by the lexical analyzer and
     // uses its exposed iterators to parse the toke stream.
- qi::grammar<word_count_grammar<iterator_type> > g(def);
     bool r = tokenize_and_parse(first, last, make_lexer(word_count), g);
 
     if (r) {
- std::cout << "lines: " << def.l << ", words: " << def.w
- << ", characters: " << def.c << "\n";
+ std::cout << "lines: " << g.l << ", words: " << g.w
+ << ", characters: " << g.c << "\n";
     }
     else {
         std::string rest(first, last);

Modified: branches/release/libs/spirit/example/qi/Jamfile
==============================================================================
--- branches/release/libs/spirit/example/qi/Jamfile (original)
+++ branches/release/libs/spirit/example/qi/Jamfile 2008-07-15 12:13:27 EDT (Tue, 15 Jul 2008)
@@ -4,12 +4,16 @@
 # Distributed under the Boost Software License, Version 1.0. (See accompanying
 # file LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt)
 #==============================================================================
-project spirit-qi-example ;
+project spirit-qi-example
+ : requirements <toolset>gcc:<cxxflags>-ftemplate-depth-300
+ :
+ :
+ ;
 
-exe actions : actions.cpp ;
+exe actions_ : actions.cpp ;
 exe sum : sum.cpp ;
 exe complex_number : complex_number.cpp ;
-exe employee : employee.cpp ;
+exe employee : employee.cpp ;
 exe roman : roman.cpp ;
 exe mini_xml1 : mini_xml1.cpp ;
 exe mini_xml2 : mini_xml2.cpp ;
@@ -20,7 +24,9 @@
 
 exe calc1 : calc1.cpp ;
 exe calc2 : calc2.cpp ;
+exe calc2_ast : calc2_ast.cpp ;
 exe calc3 : calc3.cpp ;
+exe calc3_lexer : calc3_lexer.cpp ;
 exe calc4 : calc4.cpp ;
 exe calc5 : calc5.cpp ;
 

Modified: branches/release/libs/spirit/example/qi/calc1.cpp
==============================================================================
--- branches/release/libs/spirit/example/qi/calc1.cpp (original)
+++ branches/release/libs/spirit/example/qi/calc1.cpp 2008-07-15 12:13:27 EDT (Tue, 15 Jul 2008)
@@ -27,9 +27,9 @@
 // Our calculator grammar
 ///////////////////////////////////////////////////////////////////////////////
 template <typename Iterator>
-struct calculator : grammar_def<Iterator, space_type>
+struct calculator : grammar<Iterator, space_type>
 {
- calculator()
+ calculator() : calculator::base_type(expression)
     {
         expression =
             term
@@ -70,8 +70,7 @@
     typedef std::string::const_iterator iterator_type;
     typedef calculator<iterator_type> calculator;
 
- calculator def; // Our grammar definition
- grammar<calculator> calc(def, def.expression); // Our grammar
+ calculator calc; // Our grammar
 
     std::string str;
     while (std::getline(std::cin, str))

Modified: branches/release/libs/spirit/example/qi/calc2.cpp
==============================================================================
--- branches/release/libs/spirit/example/qi/calc2.cpp (original)
+++ branches/release/libs/spirit/example/qi/calc2.cpp 2008-07-15 12:13:27 EDT (Tue, 15 Jul 2008)
@@ -42,9 +42,9 @@
 // Our calculator grammar
 ///////////////////////////////////////////////////////////////////////////////
 template <typename Iterator>
-struct calculator : grammar_def<Iterator, space_type>
+struct calculator : grammar<Iterator, space_type>
 {
- calculator()
+ calculator() : calculator::base_type(expression)
     {
         expression =
             term
@@ -85,8 +85,7 @@
     typedef std::string::const_iterator iterator_type;
     typedef calculator<iterator_type> calculator;
 
- calculator def; // Our grammar definition
- grammar<calculator> calc(def, def.expression); // Our grammar
+ calculator calc; // Our grammar
 
     std::string str;
     while (std::getline(std::cin, str))

Modified: branches/release/libs/spirit/example/qi/calc2_ast.cpp
==============================================================================
--- branches/release/libs/spirit/example/qi/calc2_ast.cpp (original)
+++ branches/release/libs/spirit/example/qi/calc2_ast.cpp 2008-07-15 12:13:27 EDT (Tue, 15 Jul 2008)
@@ -130,9 +130,9 @@
 // Our calculator grammar
 ///////////////////////////////////////////////////////////////////////////////
 template <typename Iterator>
-struct calculator : grammar_def<Iterator, expression_ast(), space_type>
+struct calculator : grammar<Iterator, expression_ast(), space_type>
 {
- calculator()
+ calculator() : calculator::base_type(expression)
     {
         expression =
             term [_val = _1]
@@ -173,8 +173,7 @@
     typedef std::string::const_iterator iterator_type;
     typedef calculator<iterator_type> calculator;
 
- calculator def; // Our grammar definition
- grammar<calculator> calc(def, def.expression); // Our grammar
+ calculator calc; // Our grammar
 
     std::string str;
     while (std::getline(std::cin, str))

Modified: branches/release/libs/spirit/example/qi/calc3.cpp
==============================================================================
--- branches/release/libs/spirit/example/qi/calc3.cpp (original)
+++ branches/release/libs/spirit/example/qi/calc3.cpp 2008-07-15 12:13:27 EDT (Tue, 15 Jul 2008)
@@ -31,9 +31,9 @@
 // Our calculator grammar
 ///////////////////////////////////////////////////////////////////////////////
 template <typename Iterator>
-struct calculator : grammar_def<Iterator, int(), space_type>
+struct calculator : grammar<Iterator, int(), space_type>
 {
- calculator()
+ calculator() : calculator::base_type(expression)
     {
         expression =
             term [_val = _1]
@@ -74,8 +74,7 @@
     typedef std::string::const_iterator iterator_type;
     typedef calculator<iterator_type> calculator;
 
- calculator def; // Our grammar definition
- grammar<calculator> calc(def, def.expression); // Our grammar
+ calculator calc; // Our grammar
 
     std::string str;
     int result;

Modified: branches/release/libs/spirit/example/qi/calc3_lexer.cpp
==============================================================================
--- branches/release/libs/spirit/example/qi/calc3_lexer.cpp (original)
+++ branches/release/libs/spirit/example/qi/calc3_lexer.cpp 2008-07-15 12:13:27 EDT (Tue, 15 Jul 2008)
@@ -88,10 +88,11 @@
 // use a defined tokenset from above as the skip parser.
 ///////////////////////////////////////////////////////////////////////////////
 template <typename Iterator, typename Lexer>
-struct calculator : grammar_def<Iterator, int(), typename Lexer::token_set>
+struct calculator : grammar<Iterator, int(), typename Lexer::token_set>
 {
     template <typename TokenDef>
- calculator(TokenDef const& tok)
+ calculator(TokenDef const& tok)
+ : calculator::base_type(expression)
     {
         // grammar
         expression =
@@ -143,7 +144,7 @@
     
     // This is the lexer type to use to tokenize the input.
     // Here we use the lexertl based lexer engine.
- typedef lexertl_lexer<base_iterator_type, token_type> lexer_type;
+ typedef lexertl_lexer<token_type> lexer_type;
     
     // This is the token definition type (derived from the given lexer type).
     typedef calculator_tokens<lexer_type> calculator_tokens;
@@ -157,10 +158,9 @@
     // now we use the types defined above to create the lexer and grammar
     // object instances needed to invoke the parsing process
     calculator_tokens tokens; // Our token definition
- calculator def (tokens); // Our grammar definition
+ calculator calc(tokens); // Our grammar definition
 
     lexer<calculator_tokens> lex(tokens); // Our lexer
- grammar<calculator> calc(def, def.expression); // Our grammar
 
     // get input line by line and feed the parser to evaluate the expressions
     // read in from the input

Modified: branches/release/libs/spirit/example/qi/calc4.cpp
==============================================================================
--- branches/release/libs/spirit/example/qi/calc4.cpp (original)
+++ branches/release/libs/spirit/example/qi/calc4.cpp 2008-07-15 12:13:27 EDT (Tue, 15 Jul 2008)
@@ -33,9 +33,9 @@
 // Our calculator grammar
 ///////////////////////////////////////////////////////////////////////////////
 template <typename Iterator>
-struct calculator : grammar_def<Iterator, int(), space_type>
+struct calculator : grammar<Iterator, int(), space_type>
 {
- calculator()
+ calculator() : calculator::base_type(expression)
     {
         expression =
             term [_val = _1]
@@ -93,7 +93,7 @@
     typedef calculator<iterator_type> calculator;
 
     calculator def; // Our grammar definition
- grammar<calculator> calc(def, def.expression); // Our grammar
+ calculator calc; // Our grammar
 
     std::string str;
     int result;

Modified: branches/release/libs/spirit/example/qi/calc5.cpp
==============================================================================
--- branches/release/libs/spirit/example/qi/calc5.cpp (original)
+++ branches/release/libs/spirit/example/qi/calc5.cpp 2008-07-15 12:13:27 EDT (Tue, 15 Jul 2008)
@@ -114,10 +114,11 @@
 // Our calculator grammar and compiler
 ///////////////////////////////////////////////////////////////////////////////
 template <typename Iterator>
-struct calculator : grammar_def<Iterator, space_type>
+struct calculator : grammar<Iterator, space_type>
 {
     calculator(std::vector<int>& code)
- : code(code)
+ : calculator::base_type(expression)
+ , code(code)
     {
         expression =
             term
@@ -203,9 +204,7 @@
 
     vmachine mach; // Our virtual machine
     std::vector<int> code; // Our VM code
- calculator def(code); // Our grammar definition
- grammar<calculator>
- calc(def, def.expression); // Our grammar
+ calculator calc(code); // Our grammar
 
     std::string str;
     while (std::getline(std::cin, str))

Modified: branches/release/libs/spirit/example/qi/calc6/calc6.cpp
==============================================================================
--- branches/release/libs/spirit/example/qi/calc6/calc6.cpp (original)
+++ branches/release/libs/spirit/example/qi/calc6/calc6.cpp 2008-07-15 12:13:27 EDT (Tue, 15 Jul 2008)
@@ -74,8 +74,7 @@
 
     vmachine mach; // Our virtual machine
     std::vector<int> code; // Our VM code
- statement def(code); // Our grammar definition
- grammar<statement> calc(def); // Our grammar
+ statement calc(code); // Our grammar
 
     std::string str;
     std::string program;
@@ -88,10 +87,10 @@
 
     if (::compile(calc, program))
     {
- mach.execute(code, def.nvars);
+ mach.execute(code, calc.nvars);
 
         std::cout << "Results------------------\n\n";
- def.vars.for_each(var_printer(mach.get_stack()));
+ calc.vars.for_each(var_printer(mach.get_stack()));
         std::cout << "-------------------------\n\n";
     }
 

Modified: branches/release/libs/spirit/example/qi/calc6/calc6.hpp
==============================================================================
--- branches/release/libs/spirit/example/qi/calc6/calc6.hpp (original)
+++ branches/release/libs/spirit/example/qi/calc6/calc6.hpp 2008-07-15 12:13:27 EDT (Tue, 15 Jul 2008)
@@ -125,7 +125,7 @@
 // Our expression grammar and compiler
 ///////////////////////////////////////////////////////////////////////////////
 template <typename Iterator>
-struct expression : grammar_def<Iterator, space_type>
+struct expression : grammar<Iterator, space_type>
 {
     expression(std::vector<int>& code, symbols<char, int>& vars);
 
@@ -160,7 +160,7 @@
 };
 
 template <typename Iterator>
-struct statement : grammar_def<Iterator, space_type>
+struct statement : grammar<Iterator, space_type>
 {
     statement(std::vector<int>& code);
 
@@ -168,8 +168,7 @@
     symbols<char, int> vars;
     int nvars;
 
- expression<Iterator> expr_def;
- grammar<expression<Iterator> > expr;
+ expression<Iterator> expr;
     rule<Iterator, space_type> start, var_decl;
     rule<Iterator, std::string(), space_type> identifier;
     rule<Iterator, int(), space_type> var_ref;

Modified: branches/release/libs/spirit/example/qi/calc6/calc6b.hpp
==============================================================================
--- branches/release/libs/spirit/example/qi/calc6/calc6b.hpp (original)
+++ branches/release/libs/spirit/example/qi/calc6/calc6b.hpp 2008-07-15 12:13:27 EDT (Tue, 15 Jul 2008)
@@ -14,7 +14,8 @@
 ///////////////////////////////////////////////////////////////////////////////
 template <typename Iterator>
 expression<Iterator>::expression(std::vector<int>& code, symbols<char, int>& vars)
- : code(code)
+ : expression::base_type(expr)
+ , code(code)
   , vars(vars)
   , op(code)
 {

Modified: branches/release/libs/spirit/example/qi/calc6/calc6c.hpp
==============================================================================
--- branches/release/libs/spirit/example/qi/calc6/calc6c.hpp (original)
+++ branches/release/libs/spirit/example/qi/calc6/calc6c.hpp 2008-07-15 12:13:27 EDT (Tue, 15 Jul 2008)
@@ -14,10 +14,10 @@
 ///////////////////////////////////////////////////////////////////////////////
 template <typename Iterator>
 statement<Iterator>::statement(std::vector<int>& code)
- : code(code)
+ : statement::base_type(start)
+ , code(code)
   , nvars(0)
- , expr_def(code, vars)
- , expr(expr_def, expr_def.expr)
+ , expr(code, vars)
   , add_var(vars)
   , op(code)
 {

Modified: branches/release/libs/spirit/example/qi/calc7/calc7.cpp
==============================================================================
--- branches/release/libs/spirit/example/qi/calc7/calc7.cpp (original)
+++ branches/release/libs/spirit/example/qi/calc7/calc7.cpp 2008-07-15 12:13:27 EDT (Tue, 15 Jul 2008)
@@ -70,9 +70,7 @@
 
     vmachine mach; // Our virtual machine
     std::vector<int> code; // Our VM code
- statement def(code); // Our grammar definition
- grammar<statement>
- calc(def, def.statement_list); // Our grammar
+ statement calc(code); // Our grammar
 
     std::string str;
     std::string program;
@@ -85,10 +83,10 @@
 
     if (::compile(calc, program))
     {
- mach.execute(code, def.nvars);
+ mach.execute(code, calc.nvars);
 
         std::cout << "Results------------------\n\n";
- def.vars.for_each(var_printer(mach.get_stack()));
+ calc.vars.for_each(var_printer(mach.get_stack()));
         std::cout << "-------------------------\n\n";
     }
 

Modified: branches/release/libs/spirit/example/qi/calc7/calc7.hpp
==============================================================================
--- branches/release/libs/spirit/example/qi/calc7/calc7.hpp (original)
+++ branches/release/libs/spirit/example/qi/calc7/calc7.hpp 2008-07-15 12:13:27 EDT (Tue, 15 Jul 2008)
@@ -144,7 +144,7 @@
 // Our expression grammar and compiler
 ///////////////////////////////////////////////////////////////////////////////
 template <typename Iterator>
-struct expression : grammar_def<Iterator, space_type>
+struct expression : grammar<Iterator, space_type>
 {
     expression(std::vector<int>& code, symbols<char, int>& vars);
 
@@ -181,7 +181,7 @@
 };
 
 template <typename Iterator>
-struct statement : grammar_def<Iterator, space_type>
+struct statement : grammar<Iterator, space_type>
 {
     statement(std::vector<int>& code);
 
@@ -189,8 +189,7 @@
     symbols<char, int> vars;
     int nvars;
 
- expression<Iterator> expr_def;
- grammar<expression<Iterator> > expr;
+ expression<Iterator> expr;
     rule<Iterator, space_type>
         statement_, statement_list, var_decl, compound_statement
     ;

Modified: branches/release/libs/spirit/example/qi/calc7/calc7b.hpp
==============================================================================
--- branches/release/libs/spirit/example/qi/calc7/calc7b.hpp (original)
+++ branches/release/libs/spirit/example/qi/calc7/calc7b.hpp 2008-07-15 12:13:27 EDT (Tue, 15 Jul 2008)
@@ -14,7 +14,8 @@
 ///////////////////////////////////////////////////////////////////////////////
 template <typename Iterator>
 expression<Iterator>::expression(std::vector<int>& code, symbols<char, int>& vars)
- : code(code)
+ : expression::base_type(expr)
+ , code(code)
   , vars(vars)
   , op(code)
 {

Modified: branches/release/libs/spirit/example/qi/calc7/calc7c.hpp
==============================================================================
--- branches/release/libs/spirit/example/qi/calc7/calc7c.hpp (original)
+++ branches/release/libs/spirit/example/qi/calc7/calc7c.hpp 2008-07-15 12:13:27 EDT (Tue, 15 Jul 2008)
@@ -14,10 +14,10 @@
 ///////////////////////////////////////////////////////////////////////////////
 template <typename Iterator>
 statement<Iterator>::statement(std::vector<int>& code)
- : code(code)
+ : statement::base_type(statement_list)
+ , code(code)
   , nvars(0)
- , expr_def(code, vars)
- , expr(expr_def, expr_def.expr)
+ , expr(code, vars)
   , add_var(vars)
   , op(code)
 {

Modified: branches/release/libs/spirit/example/qi/employee.cpp
==============================================================================
--- branches/release/libs/spirit/example/qi/employee.cpp (original)
+++ branches/release/libs/spirit/example/qi/employee.cpp 2008-07-15 12:13:27 EDT (Tue, 15 Jul 2008)
@@ -34,6 +34,7 @@
 ///////////////////////////////////////////////////////////////////////////////
 // Our employee struct
 ///////////////////////////////////////////////////////////////////////////////
+//[tutorial_employee_struct
 struct employee
 {
     int age;
@@ -41,9 +42,11 @@
     std::string forename;
     double salary;
 };
+//]
 
 // We need to tell fusion about our employee struct
 // to make it a first-class fusion citizen
+//[tutorial_employee_adapt_struct
 BOOST_FUSION_ADAPT_STRUCT(
     employee,
     (int, age)
@@ -51,14 +54,16 @@
     (std::string, forename)
     (double, salary)
 )
+//]
 
 ///////////////////////////////////////////////////////////////////////////////
 // Our employee parser
 ///////////////////////////////////////////////////////////////////////////////
+//[tutorial_employee_parser
 template <typename Iterator>
-struct employee_parser : grammar_def<Iterator, employee(), space_type>
+struct employee_parser : grammar<Iterator, employee(), space_type>
 {
- employee_parser()
+ employee_parser() : employee_parser::base_type(start)
     {
         quoted_string %= lexeme['"' >> +(char_ - '"') >> '"'];
 
@@ -76,6 +81,7 @@
     rule<Iterator, std::string(), space_type> quoted_string;
     rule<Iterator, employee(), space_type> start;
 };
+//]
 
 ////////////////////////////////////////////////////////////////////////////
 // Main program
@@ -95,8 +101,7 @@
     typedef std::string::const_iterator iterator_type;
     typedef employee_parser<iterator_type> employee_parser;
 
- employee_parser def; // Our grammar definition
- grammar<employee_parser> g(def); // Our grammar
+ employee_parser g; // Our grammar
     std::string str;
     while (getline(std::cin, str))
     {

Modified: branches/release/libs/spirit/example/qi/mini_c/mini_c.cpp
==============================================================================
--- branches/release/libs/spirit/example/qi/mini_c/mini_c.cpp (original)
+++ branches/release/libs/spirit/example/qi/mini_c/mini_c.cpp 2008-07-15 12:13:27 EDT (Tue, 15 Jul 2008)
@@ -19,13 +19,12 @@
 template <typename Grammar>
 bool compile(Grammar const& prog, std::string const& expr)
 {
- typedef white_space_def<std::string::const_iterator> white_space_def;
- white_space_def white_; // Our skipper definition
- grammar<white_space_def> white_space(white_); // Our skipper
+ typedef white_space<std::string::const_iterator> white_space;
+ white_space ws; // Our skipper
 
     std::string::const_iterator iter = expr.begin();
     std::string::const_iterator end = expr.end();
- bool r = phrase_parse(iter, end, prog, white_space);
+ bool r = phrase_parse(iter, end, prog, ws);
 
     if (r && iter == end)
     {
@@ -80,14 +79,13 @@
 
     vmachine mach; // Our virtual machine
     std::vector<int> code; // Our VM code
- program def(code); // Our grammar definition
- grammar<program> prog(def); // Our grammar
+ program prog(code); // Our grammar definition
 
     if (::compile(prog, source_code))
     {
         std::string fmain("main");
         std::string::iterator fbegin = fmain.begin();
- function_info* f = def.functions.lookup()->find(fbegin, fmain.end());
+ function_info* f = prog.functions.lookup()->find(fbegin, fmain.end());
         if (f == 0)
         {
             std::cerr << "Error: main function not defined" << std::endl;

Modified: branches/release/libs/spirit/example/qi/mini_c/mini_c.hpp
==============================================================================
--- branches/release/libs/spirit/example/qi/mini_c/mini_c.hpp (original)
+++ branches/release/libs/spirit/example/qi/mini_c/mini_c.hpp 2008-07-15 12:13:27 EDT (Tue, 15 Jul 2008)
@@ -246,9 +246,9 @@
 // White-space and comments grammar definition
 ///////////////////////////////////////////////////////////////////////////////
 template <typename Iterator>
-struct white_space_def : grammar_def<Iterator>
+struct white_space : grammar<Iterator>
 {
- white_space_def()
+ white_space() : white_space::base_type(start)
     {
         start =
                 space // tab/space/cr/lf
@@ -263,14 +263,14 @@
 // Our expression grammar and compiler
 ///////////////////////////////////////////////////////////////////////////////
 template <typename Iterator>
-struct expression : grammar_def<Iterator, grammar<white_space_def<Iterator> > >
+struct expression : grammar<Iterator, white_space<Iterator> >
 {
     expression(
         std::vector<int>& code
       , symbols<char, int>& vars
       , symbols<char, function_info>& functions);
 
- typedef grammar<white_space_def<Iterator> > white_space;
+ typedef white_space<Iterator> white_space;
 
     rule<Iterator, white_space>
         expr, equality_expr, relational_expr
@@ -290,11 +290,11 @@
 // Our statement grammar and compiler
 ///////////////////////////////////////////////////////////////////////////////
 template <typename Iterator>
-struct statement : grammar_def<Iterator, grammar<white_space_def<Iterator> > >
+struct statement : grammar<Iterator, white_space<Iterator> >
 {
     statement(std::vector<int>& code, symbols<char, function_info>& functions);
 
- typedef grammar<white_space_def<Iterator> > white_space;
+ typedef white_space<Iterator> white_space;
 
     std::vector<int>& code;
     symbols<char, int> vars;
@@ -302,8 +302,7 @@
     int nvars;
     bool has_return;
 
- expression<Iterator> expr_def;
- grammar<expression<Iterator> > expr;
+ expression<Iterator> expr;
     rule<Iterator, white_space>
         statement_, statement_list, var_decl, compound_statement
       , return_statement;
@@ -323,11 +322,11 @@
 // Our program grammar and compiler
 ///////////////////////////////////////////////////////////////////////////////
 template <typename Iterator>
-struct program : grammar_def<Iterator, grammar<white_space_def<Iterator> > >
+struct program : grammar<Iterator, white_space<Iterator> >
 {
     program(std::vector<int>& code);
 
- typedef grammar<white_space_def<Iterator> > white_space;
+ typedef white_space<Iterator> white_space;
 
     std::vector<int>& code;
     rule<Iterator, std::string(), white_space> identifier;
@@ -341,8 +340,7 @@
     function_locals;
 
     symbols<char, function_info> functions;
- statement<Iterator> statement_def;
- grammar<statement<Iterator> > statement;
+ statement<Iterator> statement;
 
     rule<Iterator, function_locals, white_space> function;
     boost::phoenix::function<function_adder> add_function;

Modified: branches/release/libs/spirit/example/qi/mini_c/mini_cb.hpp
==============================================================================
--- branches/release/libs/spirit/example/qi/mini_c/mini_cb.hpp (original)
+++ branches/release/libs/spirit/example/qi/mini_c/mini_cb.hpp 2008-07-15 12:13:27 EDT (Tue, 15 Jul 2008)
@@ -17,7 +17,8 @@
     std::vector<int>& code
   , symbols<char, int>& vars
   , symbols<char, function_info>& functions)
- : code(code)
+ : expression::base_type(expr)
+ , code(code)
   , vars(vars)
   , functions(functions)
   , op(code)

Modified: branches/release/libs/spirit/example/qi/mini_c/mini_cc.hpp
==============================================================================
--- branches/release/libs/spirit/example/qi/mini_c/mini_cc.hpp (original)
+++ branches/release/libs/spirit/example/qi/mini_c/mini_cc.hpp 2008-07-15 12:13:27 EDT (Tue, 15 Jul 2008)
@@ -15,11 +15,11 @@
 template <typename Iterator>
 statement<Iterator>::statement(
     std::vector<int>& code, symbols<char, function_info>& functions)
- : code(code)
+ : statement::base_type(statement_list)
+ , code(code)
   , functions(functions)
   , nvars(0)
- , expr_def(code, vars, functions)
- , expr(expr_def, expr_def.expr)
+ , expr(code, vars, functions)
   , add_var(var_adder(vars, nvars))
   , op(code)
 {

Modified: branches/release/libs/spirit/example/qi/mini_c/mini_cd.hpp
==============================================================================
--- branches/release/libs/spirit/example/qi/mini_c/mini_cd.hpp (original)
+++ branches/release/libs/spirit/example/qi/mini_c/mini_cd.hpp 2008-07-15 12:13:27 EDT (Tue, 15 Jul 2008)
@@ -14,16 +14,16 @@
 ///////////////////////////////////////////////////////////////////////////////
 template <typename Iterator>
 program<Iterator>::program(std::vector<int>& code)
- : code(code)
- , statement_def(code, functions)
- , statement(statement_def, statement_def.statement_list)
+ : program::base_type(start)
+ , code(code)
+ , statement(code, functions)
   , add_function(function_adder(functions))
- , state_reset(function_state_reset(code, statement_def.vars, statement_def.nvars))
+ , state_reset(function_state_reset(code, statement.vars, statement.nvars))
   , op(code)
 {
- bool& has_return = statement_def.has_return;
- int& nvars = statement_def.nvars;
- boost::phoenix::function<var_adder>& add_var = statement_def.add_var;
+ bool& has_return = statement.has_return;
+ int& nvars = statement.nvars;
+ boost::phoenix::function<var_adder>& add_var = statement.add_var;
 
     identifier %=
         raw[lexeme[alpha >> *(alnum | '_')]]

Modified: branches/release/libs/spirit/example/qi/mini_xml1.cpp
==============================================================================
--- branches/release/libs/spirit/example/qi/mini_xml1.cpp (original)
+++ branches/release/libs/spirit/example/qi/mini_xml1.cpp 2008-07-15 12:13:27 EDT (Tue, 15 Jul 2008)
@@ -41,6 +41,7 @@
 ///////////////////////////////////////////////////////////////////////////////
 // Our mini XML tree representation
 ///////////////////////////////////////////////////////////////////////////////
+//[tutorial_xml1_structures
 struct mini_xml;
 
 typedef
@@ -55,14 +56,17 @@
     std::string name; // tag name
     std::vector<mini_xml_node> children; // children
 };
+//]
 
 // We need to tell fusion about our mini_xml struct
 // to make it a first-class fusion citizen
+//[tutorial_xml1_adapt_structures
 BOOST_FUSION_ADAPT_STRUCT(
     mini_xml,
     (std::string, name)
     (std::vector<mini_xml_node>, children)
 )
+//]
 
 ///////////////////////////////////////////////////////////////////////////////
 // Print out the mini xml tree
@@ -127,16 +131,18 @@
 ///////////////////////////////////////////////////////////////////////////////
 // Our mini XML grammar definition
 ///////////////////////////////////////////////////////////////////////////////
+//[tutorial_xml1_grammar
 template <typename Iterator>
-struct mini_xml_def : grammar_def<Iterator, mini_xml(), space_type>
+struct mini_xml_grammar : grammar<Iterator, mini_xml(), space_type>
 {
- mini_xml_def()
+ mini_xml_grammar() : mini_xml_grammar::base_type(xml)
     {
         text = lexeme[+(char_ - '<') [_val += _1]];
         node = (xml | text) [_val = _1];
 
         start_tag =
                 '<'
+ >> !char_('/')
>> lexeme[+(char_ - '>') [_val += _1]]
>> '>'
         ;
@@ -160,6 +166,7 @@
     rule<Iterator, std::string(), space_type> start_tag;
     rule<Iterator, void(std::string), space_type> end_tag;
 };
+//]
 
 ///////////////////////////////////////////////////////////////////////////////
 // Main program
@@ -193,9 +200,8 @@
         std::istream_iterator<char>(),
         std::back_inserter(storage));
 
- typedef mini_xml_def<std::string::const_iterator> mini_xml_def;
- mini_xml_def def; // Our grammar definition
- grammar<mini_xml_def> xml(def, def.xml); // Our grammar
+ typedef mini_xml_grammar<std::string::const_iterator> mini_xml_grammar;
+ mini_xml_grammar xml; // Our grammar
     mini_xml ast; // our tree
 
     std::string::const_iterator iter = storage.begin();

Modified: branches/release/libs/spirit/example/qi/mini_xml2.cpp
==============================================================================
--- branches/release/libs/spirit/example/qi/mini_xml2.cpp (original)
+++ branches/release/libs/spirit/example/qi/mini_xml2.cpp 2008-07-15 12:13:27 EDT (Tue, 15 Jul 2008)
@@ -127,17 +127,20 @@
 ///////////////////////////////////////////////////////////////////////////////
 // Our mini XML grammar definition
 ///////////////////////////////////////////////////////////////////////////////
+//[tutorial_xml2_grammar
 template <typename Iterator>
-struct mini_xml_def
- : grammar_def<Iterator, mini_xml(), locals<std::string>, space_type>
+struct mini_xml_grammar
+ : grammar<Iterator, mini_xml(), locals<std::string>, space_type>
 {
- mini_xml_def()
+ mini_xml_grammar()
+ : mini_xml_grammar::base_type(xml)
     {
         text %= lexeme[+(char_ - '<')];
         node %= xml | text;
 
         start_tag %=
                 '<'
+ >> !char_('/')
>> lexeme[+(char_ - '>')]
>> '>'
         ;
@@ -161,6 +164,7 @@
     rule<Iterator, std::string(), space_type> start_tag;
     rule<Iterator, void(std::string), space_type> end_tag;
 };
+//]
 
 ///////////////////////////////////////////////////////////////////////////////
 // Main program
@@ -194,9 +198,8 @@
         std::istream_iterator<char>(),
         std::back_inserter(storage));
 
- typedef mini_xml_def<std::string::const_iterator> mini_xml_def;
- mini_xml_def def; // Our grammar definition
- grammar<mini_xml_def> xml(def, def.xml); // Our grammar
+ typedef mini_xml_grammar<std::string::const_iterator> mini_xml_grammar;
+ mini_xml_grammar xml; // Our grammar
     mini_xml ast; // our tree
 
     std::string::const_iterator iter = storage.begin();

Added: branches/release/libs/spirit/example/qi/mini_xml3.cpp
==============================================================================
--- (empty file)
+++ branches/release/libs/spirit/example/qi/mini_xml3.cpp 2008-07-15 12:13:27 EDT (Tue, 15 Jul 2008)
@@ -0,0 +1,248 @@
+/*=============================================================================
+ Copyright (c) 2001-2007 Joel de Guzman
+
+ Distributed under the Boost Software License, Version 1.0. (See accompanying
+ file LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt)
+=============================================================================*/
+///////////////////////////////////////////////////////////////////////////////
+//
+// A mini XML-like parser
+//
+// [ JDG March 25, 2007 ] spirit2
+//
+///////////////////////////////////////////////////////////////////////////////
+
+#include <boost/config/warning_disable.hpp>
+#include <boost/spirit/include/qi.hpp>
+#include <boost/spirit/include/phoenix_core.hpp>
+#include <boost/spirit/include/phoenix_operator.hpp>
+#include <boost/spirit/include/phoenix_fusion.hpp>
+#include <boost/spirit/include/phoenix_stl.hpp>
+#include <boost/spirit/include/phoenix_object.hpp>
+#include <boost/fusion/include/adapt_struct.hpp>
+#include <boost/variant/recursive_variant.hpp>
+#include <boost/foreach.hpp>
+
+#include <iostream>
+#include <fstream>
+#include <string>
+#include <vector>
+
+using namespace boost::spirit;
+using namespace boost::spirit::qi;
+using namespace boost::spirit::ascii;
+using namespace boost::spirit::arg_names;
+
+namespace fusion = boost::fusion;
+namespace phoenix = boost::phoenix;
+
+using phoenix::at_c;
+using phoenix::push_back;
+using phoenix::val;
+using phoenix::construct;
+
+///////////////////////////////////////////////////////////////////////////////
+// Our mini XML tree representation
+///////////////////////////////////////////////////////////////////////////////
+struct mini_xml;
+
+typedef
+ boost::variant<
+ boost::recursive_wrapper<mini_xml>
+ , std::string
+ >
+mini_xml_node;
+
+struct mini_xml
+{
+ std::string name; // tag name
+ std::vector<mini_xml_node> children; // children
+};
+
+// We need to tell fusion about our mini_xml struct
+// to make it a first-class fusion citizen
+BOOST_FUSION_ADAPT_STRUCT(
+ mini_xml,
+ (std::string, name)
+ (std::vector<mini_xml_node>, children)
+)
+
+///////////////////////////////////////////////////////////////////////////////
+// Print out the mini xml tree
+///////////////////////////////////////////////////////////////////////////////
+int const tabsize = 4;
+
+void tab(int indent)
+{
+ for (int i = 0; i < indent; ++i)
+ std::cout << ' ';
+}
+
+struct mini_xml_printer
+{
+ mini_xml_printer(int indent = 0)
+ : indent(indent)
+ {
+ }
+
+ void operator()(mini_xml const& xml) const;
+
+ int indent;
+};
+
+struct mini_xml_node_printer : boost::static_visitor<>
+{
+ mini_xml_node_printer(int indent = 0)
+ : indent(indent)
+ {
+ }
+
+ void operator()(mini_xml const& xml) const
+ {
+ mini_xml_printer(indent+tabsize)(xml);
+ }
+
+ void operator()(std::string const& text) const
+ {
+ tab(indent+tabsize);
+ std::cout << "text: \"" << text << '"' << std::endl;
+ }
+
+ int indent;
+};
+
+void mini_xml_printer::operator()(mini_xml const& xml) const
+{
+ tab(indent);
+ std::cout << "tag: " << xml.name << std::endl;
+ tab(indent);
+ std::cout << '{' << std::endl;
+
+ BOOST_FOREACH(mini_xml_node const& node, xml.children)
+ {
+ boost::apply_visitor(mini_xml_node_printer(indent), node);
+ }
+
+ tab(indent);
+ std::cout << '}' << std::endl;
+}
+
+///////////////////////////////////////////////////////////////////////////////
+// Our mini XML grammar definition
+///////////////////////////////////////////////////////////////////////////////
+//[tutorial_xml3_grammar
+template <typename Iterator>
+struct mini_xml_grammar
+ : grammar<Iterator, mini_xml(), locals<std::string>, space_type>
+{
+ mini_xml_grammar()
+ : mini_xml_grammar::base_type(xml, "xml")
+ {
+ text %= lexeme[+(char_ - '<')];
+ node %= xml | text;
+
+ start_tag %=
+ '<'
+ >> !char_('/')
+ > lexeme[+(char_ - '>')]
+ > '>'
+ ;
+
+ end_tag =
+ "</"
+ > lit(_r1)
+ > '>'
+ ;
+
+ xml %=
+ start_tag[_a = _1]
+ > *node
+ > end_tag(_a)
+ ;
+
+ xml.name("xml");
+ node.name("node");
+ text.name("text");
+ start_tag.name("start_tag");
+ end_tag.name("end_tag");
+
+ on_error<fail>
+ (
+ xml
+ , std::cout
+ << val("Error! Expecting ")
+ << _4 // what failed?
+ << val(" here: \"")
+ << construct<std::string>(_3, _2) // iterators to error-pos, end
+ << val("\"")
+ << std::endl
+ );
+ }
+
+ rule<Iterator, mini_xml(), locals<std::string>, space_type> xml;
+ rule<Iterator, mini_xml_node(), space_type> node;
+ rule<Iterator, std::string(), space_type> text;
+ rule<Iterator, std::string(), space_type> start_tag;
+ rule<Iterator, void(std::string), space_type> end_tag;
+};
+//]
+
+///////////////////////////////////////////////////////////////////////////////
+// Main program
+///////////////////////////////////////////////////////////////////////////////
+int main(int argc, char **argv)
+{
+ char const* filename;
+ if (argc > 1)
+ {
+ filename = argv[1];
+ }
+ else
+ {
+ std::cerr << "Error: No input file provided." << std::endl;
+ return 1;
+ }
+
+ std::ifstream in(filename, std::ios_base::in);
+
+ if (!in)
+ {
+ std::cerr << "Error: Could not open input file: "
+ << filename << std::endl;
+ return 1;
+ }
+
+ std::string storage; // We will read the contents here.
+ in.unsetf(std::ios::skipws); // No white space skipping!
+ std::copy(
+ std::istream_iterator<char>(in),
+ std::istream_iterator<char>(),
+ std::back_inserter(storage));
+
+ typedef mini_xml_grammar<std::string::const_iterator> mini_xml_grammar;
+ mini_xml_grammar xml; // Our grammar
+ mini_xml ast; // our tree
+
+ std::string::const_iterator iter = storage.begin();
+ std::string::const_iterator end = storage.end();
+ bool r = phrase_parse(iter, end, xml, ast, space);
+
+ if (r && iter == end)
+ {
+ std::cout << "-------------------------\n";
+ std::cout << "Parsing succeeded\n";
+ std::cout << "-------------------------\n";
+ mini_xml_printer printer;
+ printer(ast);
+ return 0;
+ }
+ else
+ {
+ std::cout << "-------------------------\n";
+ std::cout << "Parsing failed\n";
+ std::cout << "-------------------------\n";
+ return 1;
+ }
+}
+
+

Added: branches/release/libs/spirit/example/qi/mini_xml_samples/4.toyxml
==============================================================================
--- (empty file)
+++ branches/release/libs/spirit/example/qi/mini_xml_samples/4.toyxml 2008-07-15 12:13:27 EDT (Tue, 15 Jul 2008)
@@ -0,0 +1 @@
+<foo><bar></foo></bar>
\ No newline at end of file

Modified: branches/release/libs/spirit/example/qi/roman.cpp
==============================================================================
--- branches/release/libs/spirit/example/qi/roman.cpp (original)
+++ branches/release/libs/spirit/example/qi/roman.cpp 2008-07-15 12:13:27 EDT (Tue, 15 Jul 2008)
@@ -103,26 +103,31 @@
 
 ///////////////////////////////////////////////////////////////////////////////
 // roman (numerals) grammar
+//
+// Note the use of the || operator. The expression
+// a || b reads match a or b and in sequence. Try
+// defining the roman numerals grammar in YACC or
+// PCCTS. Spirit rules! :-)
 ///////////////////////////////////////////////////////////////////////////////
+//[tutorial_roman_grammar
 template <typename Iterator>
-struct roman : grammar_def<Iterator, unsigned()>
+struct roman : grammar<Iterator, unsigned()>
 {
- roman()
+ roman() : roman::base_type(start)
     {
- start
- = +char_('M') [_val += 1000]
- || hundreds [_val += _1]
- || tens [_val += _1]
- || ones [_val += _1];
-
- // Note the use of the || operator. The expression
- // a || b reads match a or b and in sequence. Try
- // defining the roman numerals grammar in YACC or
- // PCCTS. Spirit rules! :-)
+ start = eps [_val = 0] >>
+ (
+ +char_('M') [_val += 1000]
+ || hundreds [_val += _1]
+ || tens [_val += _1]
+ || ones [_val += _1]
+ )
+ ;
     }
 
     rule<Iterator, unsigned()> start;
 };
+//]
 
 ///////////////////////////////////////////////////////////////////////////////
 // Main program
@@ -138,8 +143,7 @@
     typedef std::string::const_iterator iterator_type;
     typedef roman<iterator_type> roman;
 
- roman def; // Our grammar definition
- grammar<roman> roman_parser(def); // Our grammar
+ roman roman_parser; // Our grammar
 
     std::string str;
     unsigned result;
@@ -150,7 +154,8 @@
 
         std::string::const_iterator iter = str.begin();
         std::string::const_iterator end = str.end();
- bool r = parse(iter, end, roman_parser[ref(result) = _1]);
+ //[tutorial_roman_grammar_parse
+ bool r = parse(iter, end, roman_parser, result);
 
         if (r && iter == end)
         {
@@ -167,6 +172,7 @@
             std::cout << "stopped at: \": " << rest << "\"\n";
             std::cout << "-------------------------\n";
         }
+ //]
     }
 
     std::cout << "Bye... :-) \n\n";

Modified: branches/release/libs/spirit/test/karma/grammar.cpp
==============================================================================
--- branches/release/libs/spirit/test/karma/grammar.cpp (original)
+++ branches/release/libs/spirit/test/karma/grammar.cpp 2008-07-15 12:13:27 EDT (Tue, 15 Jul 2008)
@@ -29,9 +29,9 @@
 
 typedef spirit_test::output_iterator<char>::type outiter_type;
 
-struct num_list : grammar_def<outiter_type, space_type>
+struct num_list : grammar<outiter_type, space_type>
 {
- num_list()
+ num_list() : num_list::base_type(start)
     {
         using boost::spirit::int_;
         num1 = int_(123);
@@ -47,8 +47,7 @@
 main()
 {
     { // simple grammar test
- num_list def;
- grammar<num_list> nlist(def);
+ num_list nlist;
         BOOST_TEST(test_delimited("123 , 456 , 789 ", nlist, space));
     }
 

Modified: branches/release/libs/spirit/test/karma/grammar_fail.cpp
==============================================================================
--- branches/release/libs/spirit/test/karma/grammar_fail.cpp (original)
+++ branches/release/libs/spirit/test/karma/grammar_fail.cpp 2008-07-15 12:13:27 EDT (Tue, 15 Jul 2008)
@@ -19,7 +19,7 @@
 using namespace boost::spirit::karma;
 using namespace boost::spirit::ascii;
 
-struct num_list : grammar_def<char const*, rule<char const*> >
+struct num_list : grammar<char const*, rule<char const*> >
 {
     num_list()
     {

Modified: branches/release/libs/spirit/test/karma/real_numerics.cpp
==============================================================================
--- branches/release/libs/spirit/test/karma/real_numerics.cpp (original)
+++ branches/release/libs/spirit/test/karma/real_numerics.cpp 2008-07-15 12:13:27 EDT (Tue, 15 Jul 2008)
@@ -5,6 +5,7 @@
 
 //#define KARMA_FAIL_COMPILATION
 
+#include <boost/version.hpp>
 #include <boost/config/warning_disable.hpp>
 #include <boost/detail/lightweight_test.hpp>
 #include <boost/math/concepts/real_concept.hpp>
@@ -65,6 +66,9 @@
     static bool const force_sign = true;
 };
 
+// support for using real_concept with a Karma generator has been implemented
+// in Boost versions > 1.36 only
+#if BOOST_VERSION > 103600
 ///////////////////////////////////////////////////////////////////////////////
 // We need to specialize is_real_lit_tag to allow to use a real_concept as a
 // literal below
@@ -74,6 +78,7 @@
     struct is_real_lit_tag<boost::math::concepts::real_concept, Domain>
       : boost::mpl::true_ {};
 }}
+#endif
 
 ///////////////////////////////////////////////////////////////////////////////
 int
@@ -390,6 +395,9 @@
         BOOST_TEST(test(" 0.0", upper[signed_], 0.0));
     }
 
+// support for using real_concept with a Karma generator has been implemented
+// in Boost versions > 1.36 only
+#if BOOST_VERSION > 103600
     {
         using boost::math::concepts::real_concept;
         typedef karma::real_spec<real_concept> custom_type;
@@ -435,6 +443,7 @@
         BOOST_TEST(test("12342.0", custom(real_concept(12342.))));
         BOOST_TEST(test("1.234e05", custom(real_concept(123420.))));
     }
-
+#endif
+
     return boost::report_errors();
 }

Modified: branches/release/libs/spirit/test/qi/grammar.cpp
==============================================================================
--- branches/release/libs/spirit/test/qi/grammar.cpp (original)
+++ branches/release/libs/spirit/test/qi/grammar.cpp 2008-07-15 12:13:27 EDT (Tue, 15 Jul 2008)
@@ -24,7 +24,7 @@
 using namespace boost::spirit::ascii;
 using namespace boost::spirit::arg_names;
 
-struct num_list : grammar_<char const*, space_type>
+struct num_list : grammar<char const*, space_type>
 {
     num_list() : base_type(start)
     {
@@ -36,9 +36,9 @@
     rule<char const*, space_type> start, num;
 };
 
-struct inh_g : grammar_def<char const*, int(int), space_type>
+struct inh_g : grammar<char const*, int(int), space_type>
 {
- inh_g()
+ inh_g() : base_type(start)
     {
         start = lit("inherited")[_val = _r1];
     }
@@ -46,9 +46,9 @@
     rule<char const*, int(int), space_type> start, num;
 };
 
-struct my_skipper : grammar_def<char const*>
+struct my_skipper : grammar<char const*>
 {
- my_skipper()
+ my_skipper() : base_type(start)
     {
         start = space;
     }
@@ -56,23 +56,23 @@
     rule<char const*> start, num;
 };
 
-struct num_list2 : grammar_def<char const*, grammar<my_skipper> >
+struct num_list2 : grammar<char const*, my_skipper>
 {
- num_list2()
+ num_list2() : base_type(start)
     {
         using boost::spirit::int_;
         num = int_;
         start = num >> *(',' >> num);
     }
 
- rule<char const*, grammar<my_skipper> > start, num;
+ rule<char const*, my_skipper> start, num;
 };
 
 template <typename Iterator, typename Skipper>
-struct num_list3 : grammar_def<Iterator, Skipper>
+struct num_list3 : grammar<Iterator, Skipper>
 {
     template <typename Class>
- num_list3(Class& self)
+ num_list3(Class& self) : grammar<Iterator, Skipper>(start)
     {
         using boost::spirit::int_;
         num = int_;
@@ -93,53 +93,28 @@
 
     { // simple grammar test with user-skipper
 
- num_list2 def;
- grammar<num_list2> nlist(def);
- my_skipper skipdef;
- grammar<my_skipper> skip(skipdef);
+ num_list2 nlist;
+ my_skipper skip;
         BOOST_TEST(test("123, 456, 789", nlist, skip));
     }
 
     { // direct access to the rules
 
- num_list def;
- BOOST_TEST(test("123", def.num));
- BOOST_TEST(test("123, 456, 789", def.start, space));
+ num_list g;
+ BOOST_TEST(test("123", g.num));
+ BOOST_TEST(test("123, 456, 789", g.start, space));
     }
 
     { // grammar with inherited attributes
 
- inh_g def;
- grammar<inh_g> g(def);
+ inh_g g;
         int n = -1;
- BOOST_TEST(test_attr("inherited", def.start(123), n, space)); // direct to the rule
+ BOOST_TEST(test_attr("inherited", g.start(123), n, space)); // direct to the rule
         BOOST_TEST(n == 123);
         BOOST_TEST(test_attr("inherited", g(123), n, space)); // using the grammar
         BOOST_TEST(n == 123);
     }
 
- { // grammar_class test (no skipper)
-
- grammar_class<num_list3> nlist;
-
- char const* first = "123,456,789";
- char const* last = first;
- while (*last)
- last++;
- BOOST_TEST(parse(first, last, nlist) && (first == last));
- }
-
- { // grammar_class test (w/skipper)
-
- grammar_class<num_list3> nlist;
-
- char const* first = "123, 456, 789";
- char const* last = first;
- while (*last)
- last++;
- BOOST_TEST(phrase_parse(first, last, nlist, space)
- && (first == last));
- }
     return boost::report_errors();
 }
 

Modified: branches/release/libs/spirit/test/qi/grammar_fail.cpp
==============================================================================
--- branches/release/libs/spirit/test/qi/grammar_fail.cpp (original)
+++ branches/release/libs/spirit/test/qi/grammar_fail.cpp 2008-07-15 12:13:27 EDT (Tue, 15 Jul 2008)
@@ -16,9 +16,9 @@
 using namespace boost::spirit::qi;
 using namespace boost::spirit::ascii;
 
-struct num_list : grammar_def<char const*, rule<char const*> >
+struct num_list : grammar<char const*, rule<char const*> >
 {
- num_list()
+ num_list() : base_type(start)
     {
         using boost::spirit::int_;
         num = int_;
@@ -34,8 +34,7 @@
     char const* input = "some input, it doesn't matter";
     char const* end = &input[strlen(input)+1];
 
- num_list def;
- grammar<num_list> g(def);
+ num_list g;
     bool r = phrase_parse(input, end, g,
         space | ('%' >> *~char_('\n') >> '\n'));
 


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