$include_dir="/home/hyper-archives/boost-commit/include"; include("$include_dir/msg-header.inc") ?>
Subject: [Boost-commit] svn:boost r52603 - in trunk/boost/spirit: . home home/karma home/karma/action home/karma/auxiliary home/karma/binary home/karma/char home/karma/detail home/karma/directive home/karma/nonterminal home/karma/nonterminal/detail home/karma/numeric home/karma/numeric/detail home/karma/operator home/karma/stream home/karma/stream/detail home/karma/string home/lex home/lex/lexer home/lex/lexer/detail home/lex/lexer/lexertl home/lex/qi home/lex/qi/state home/lex/qi/utility home/qi home/qi/action home/qi/auxiliary home/qi/binary home/qi/char home/qi/char/detail home/qi/debug home/qi/detail home/qi/directive home/qi/nonterminal home/qi/nonterminal/detail home/qi/numeric home/qi/numeric/detail home/qi/operator home/qi/stream home/qi/stream/detail home/qi/string home/qi/string/detail home/support home/support/algorithm home/support/auxiliary home/support/char_class home/support/char_encoding home/support/detail home/support/detail/integer home/support/detail/lexer home/support/detail/math home/support/iterators home/support/iterators/detail home/support/meta_grammar home/support/nonterminal home/support/nonterminal/detail include
From: hartmut.kaiser_at_[hidden]
Date: 2009-04-26 10:43:19
Author: hkaiser
Date: 2009-04-26 10:42:24 EDT (Sun, 26 Apr 2009)
New Revision: 52603
URL: http://svn.boost.org/trac/boost/changeset/52603
Log:
Merging Spirit V2.1
Added:
   trunk/boost/spirit/home/karma/delimit_out.hpp   (contents, props changed)
   trunk/boost/spirit/home/karma/detail/alternative_function.hpp   (contents, props changed)
   trunk/boost/spirit/home/karma/detail/default_width.hpp   (contents, props changed)
   trunk/boost/spirit/home/karma/detail/fail_function.hpp   (contents, props changed)
   trunk/boost/spirit/home/karma/detail/get_casetag.hpp   (contents, props changed)
   trunk/boost/spirit/home/karma/detail/pass_container.hpp   (contents, props changed)
   trunk/boost/spirit/home/karma/detail/unused_delimiter.hpp   (contents, props changed)
   trunk/boost/spirit/home/karma/directive/maxwidth.hpp   (contents, props changed)
   trunk/boost/spirit/home/karma/directive/upper_lower_case.hpp   (contents, props changed)
   trunk/boost/spirit/home/karma/generate_attr.hpp   (contents, props changed)
   trunk/boost/spirit/home/karma/generator.hpp   (contents, props changed)
   trunk/boost/spirit/home/karma/meta_compiler.hpp   (contents, props changed)
   trunk/boost/spirit/home/karma/nonterminal/detail/fcall.hpp   (contents, props changed)
   trunk/boost/spirit/home/karma/nonterminal/detail/generator_binder.hpp   (contents, props changed)
   trunk/boost/spirit/home/karma/operator/and_predicate.hpp   (contents, props changed)
   trunk/boost/spirit/home/karma/operator/not_predicate.hpp   (contents, props changed)
   trunk/boost/spirit/home/karma/reference.hpp   (contents, props changed)
   trunk/boost/spirit/home/karma/stream/detail/iterator_sink.hpp   (contents, props changed)
   trunk/boost/spirit/home/karma/stream/format_manip_attr.hpp   (contents, props changed)
   trunk/boost/spirit/home/lex/lexer/lexertl/functor.hpp   (contents, props changed)
   trunk/boost/spirit/home/lex/lexer/lexertl/generate_static.hpp   (contents, props changed)
   trunk/boost/spirit/home/lex/lexer/lexertl/iterator.hpp   (contents, props changed)
   trunk/boost/spirit/home/lex/lexer/lexertl/lexer.hpp   (contents, props changed)
   trunk/boost/spirit/home/lex/lexer/lexertl/static_functor.hpp   (contents, props changed)
   trunk/boost/spirit/home/lex/lexer/lexertl/static_lexer.hpp   (contents, props changed)
   trunk/boost/spirit/home/lex/lexer/lexertl/token.hpp   (contents, props changed)
   trunk/boost/spirit/home/lex/lexer/terminals.hpp   (contents, props changed)
   trunk/boost/spirit/home/lex/lexer_type.hpp   (contents, props changed)
   trunk/boost/spirit/home/lex/meta_compiler.hpp   (contents, props changed)
   trunk/boost/spirit/home/lex/qi.hpp   (contents, props changed)
   trunk/boost/spirit/home/lex/qi/in_state.hpp   (contents, props changed)
   trunk/boost/spirit/home/lex/qi/plain_token.hpp   (contents, props changed)
   trunk/boost/spirit/home/lex/qi/state_switcher.hpp   (contents, props changed)
   trunk/boost/spirit/home/lex/reference.hpp   (contents, props changed)
   trunk/boost/spirit/home/qi/auxiliary/eoi.hpp   (contents, props changed)
   trunk/boost/spirit/home/qi/auxiliary/eol.hpp   (contents, props changed)
   trunk/boost/spirit/home/qi/detail/pass_container.hpp   (contents, props changed)
   trunk/boost/spirit/home/qi/directive/no_case.hpp   (contents, props changed)
   trunk/boost/spirit/home/qi/directive/repeat.hpp   (contents, props changed)
   trunk/boost/spirit/home/qi/directive/skip.hpp   (contents, props changed)
   trunk/boost/spirit/home/qi/meta_compiler.hpp   (contents, props changed)
   trunk/boost/spirit/home/qi/nonterminal/debug_handler.hpp   (contents, props changed)
   trunk/boost/spirit/home/qi/nonterminal/detail/fcall.hpp   (contents, props changed)
   trunk/boost/spirit/home/qi/nonterminal/detail/parser_binder.hpp   (contents, props changed)
   trunk/boost/spirit/home/qi/nonterminal/error_handler.hpp   (contents, props changed)
   trunk/boost/spirit/home/qi/nonterminal/simple_trace.hpp   (contents, props changed)
   trunk/boost/spirit/home/qi/parse_attr.hpp   (contents, props changed)
   trunk/boost/spirit/home/qi/parser.hpp   (contents, props changed)
   trunk/boost/spirit/home/qi/reference.hpp   (contents, props changed)
   trunk/boost/spirit/home/qi/skip_over.hpp   (contents, props changed)
   trunk/boost/spirit/home/qi/stream/detail/iterator_source.hpp   (contents, props changed)
   trunk/boost/spirit/home/qi/stream/match_manip_attr.hpp   (contents, props changed)
   trunk/boost/spirit/home/support/action_dispatch.hpp   (contents, props changed)
   trunk/boost/spirit/home/support/attributes.hpp   (contents, props changed)
   trunk/boost/spirit/home/support/char_encoding/
   trunk/boost/spirit/home/support/common_terminals.hpp   (contents, props changed)
   trunk/boost/spirit/home/support/container.hpp   (contents, props changed)
   trunk/boost/spirit/home/support/context.hpp   (contents, props changed)
   trunk/boost/spirit/home/support/detail/as_variant.hpp   (contents, props changed)
   trunk/boost/spirit/home/support/detail/endian.hpp   (contents, props changed)
   trunk/boost/spirit/home/support/detail/get_encoding.hpp   (contents, props changed)
   trunk/boost/spirit/home/support/detail/make_cons.hpp   (contents, props changed)
   trunk/boost/spirit/home/support/detail/make_vector.hpp   (contents, props changed)
   trunk/boost/spirit/home/support/detail/pow10.hpp   (contents, props changed)
   trunk/boost/spirit/home/support/detail/scoped_enum_emulation.hpp   (contents, props changed)
   trunk/boost/spirit/home/support/detail/sign.hpp   (contents, props changed)
   trunk/boost/spirit/home/support/info.hpp   (contents, props changed)
   trunk/boost/spirit/home/support/lazy.hpp   (contents, props changed)
   trunk/boost/spirit/home/support/make_component.hpp   (contents, props changed)
   trunk/boost/spirit/home/support/meta_compiler.hpp   (contents, props changed)
   trunk/boost/spirit/home/support/modify.hpp   (contents, props changed)
   trunk/boost/spirit/home/support/nonterminal/expand_arg.hpp   (contents, props changed)
   trunk/boost/spirit/home/support/sequence_base_id.hpp   (contents, props changed)
   trunk/boost/spirit/home/support/string_traits.hpp   (contents, props changed)
   trunk/boost/spirit/home/support/terminal.hpp   (contents, props changed)
   trunk/boost/spirit/home/support/utf8.hpp   (contents, props changed)
Removed:
   trunk/boost/spirit/home/karma/action/meta_grammar.hpp
   trunk/boost/spirit/home/karma/auxiliary/confix.hpp
   trunk/boost/spirit/home/karma/auxiliary/functor.hpp
   trunk/boost/spirit/home/karma/auxiliary/functor_director.hpp
   trunk/boost/spirit/home/karma/auxiliary/meta_grammar.hpp
   trunk/boost/spirit/home/karma/auxiliary/none.hpp
   trunk/boost/spirit/home/karma/binary/meta_grammar.hpp
   trunk/boost/spirit/home/karma/char/meta_grammar.hpp
   trunk/boost/spirit/home/karma/delimit.hpp
   trunk/boost/spirit/home/karma/directive/alignment_meta_grammar.hpp
   trunk/boost/spirit/home/karma/directive/case_meta_grammar.hpp
   trunk/boost/spirit/home/karma/directive/delimiter_meta_grammar.hpp
   trunk/boost/spirit/home/karma/meta_grammar.hpp
   trunk/boost/spirit/home/karma/nonterminal/detail/rule.hpp
   trunk/boost/spirit/home/karma/nonterminal/grammar_fwd.hpp
   trunk/boost/spirit/home/karma/nonterminal/meta_grammar.hpp
   trunk/boost/spirit/home/karma/nonterminal/nonterminal.hpp
   trunk/boost/spirit/home/karma/nonterminal/nonterminal_director.hpp
   trunk/boost/spirit/home/karma/numeric/meta_grammar.hpp
   trunk/boost/spirit/home/karma/numeric/numeric_fwd.hpp
   trunk/boost/spirit/home/karma/operator/karma-alt.zip
   trunk/boost/spirit/home/karma/operator/meta_grammar.hpp
   trunk/boost/spirit/home/karma/stream/detail/iterator_ostream.hpp
   trunk/boost/spirit/home/karma/stream/meta_grammar.hpp
   trunk/boost/spirit/home/karma/string/meta_grammar.hpp
   trunk/boost/spirit/home/lex/lexer/detail/
   trunk/boost/spirit/home/lex/lexer/lexer_actions.hpp
   trunk/boost/spirit/home/lex/lexer/lexer_fwd.hpp
   trunk/boost/spirit/home/lex/lexer/lexertl/lexertl_functor.hpp
   trunk/boost/spirit/home/lex/lexer/lexertl/lexertl_generate_static.hpp
   trunk/boost/spirit/home/lex/lexer/lexertl/lexertl_iterator.hpp
   trunk/boost/spirit/home/lex/lexer/lexertl/lexertl_lexer.hpp
   trunk/boost/spirit/home/lex/lexer/lexertl/lexertl_static_functor.hpp
   trunk/boost/spirit/home/lex/lexer/lexertl/lexertl_static_lexer.hpp
   trunk/boost/spirit/home/lex/lexer/lexertl/lexertl_token.hpp
   trunk/boost/spirit/home/lex/lexer/meta_grammar.hpp
   trunk/boost/spirit/home/lex/lexer/terminal_director.hpp
   trunk/boost/spirit/home/lex/lexer/terminal_holder.hpp
   trunk/boost/spirit/home/lex/meta_grammar.hpp
   trunk/boost/spirit/home/lex/qi/meta_grammar.hpp
   trunk/boost/spirit/home/lex/qi/state/
   trunk/boost/spirit/home/lex/qi/utility/
   trunk/boost/spirit/home/lex/set_state.hpp
   trunk/boost/spirit/home/qi/action/meta_grammar.hpp
   trunk/boost/spirit/home/qi/auxiliary/confix.hpp
   trunk/boost/spirit/home/qi/auxiliary/functor.hpp
   trunk/boost/spirit/home/qi/auxiliary/functor_director.hpp
   trunk/boost/spirit/home/qi/auxiliary/meta_grammar.hpp
   trunk/boost/spirit/home/qi/auxiliary/none.hpp
   trunk/boost/spirit/home/qi/auxiliary/primitives.hpp
   trunk/boost/spirit/home/qi/binary/meta_grammar.hpp
   trunk/boost/spirit/home/qi/char/detail/get_char.hpp
   trunk/boost/spirit/home/qi/char/meta_grammar.hpp
   trunk/boost/spirit/home/qi/debug/
   trunk/boost/spirit/home/qi/debug.hpp
   trunk/boost/spirit/home/qi/detail/construct_fwd.hpp
   trunk/boost/spirit/home/qi/directive/meta_grammar.hpp
   trunk/boost/spirit/home/qi/meta_grammar.hpp
   trunk/boost/spirit/home/qi/nonterminal/detail/error_handler.hpp
   trunk/boost/spirit/home/qi/nonterminal/detail/rule.hpp
   trunk/boost/spirit/home/qi/nonterminal/error_handler_result.hpp
   trunk/boost/spirit/home/qi/nonterminal/grammar_fwd.hpp
   trunk/boost/spirit/home/qi/nonterminal/meta_grammar.hpp
   trunk/boost/spirit/home/qi/nonterminal/nonterminal.hpp
   trunk/boost/spirit/home/qi/nonterminal/nonterminal_director.hpp
   trunk/boost/spirit/home/qi/nonterminal/virtual_component_base.hpp
   trunk/boost/spirit/home/qi/numeric/meta_grammar.hpp
   trunk/boost/spirit/home/qi/operator/meta_grammar.hpp
   trunk/boost/spirit/home/qi/skip.hpp
   trunk/boost/spirit/home/qi/stream/detail/iterator_istream.hpp
   trunk/boost/spirit/home/qi/stream/meta_grammar.hpp
   trunk/boost/spirit/home/qi/string/lit.hpp
   trunk/boost/spirit/home/qi/string/meta_grammar.hpp
   trunk/boost/spirit/home/qi/string/symbols.hpp
   trunk/boost/spirit/home/qi/string/tst.hpp
   trunk/boost/spirit/home/qi/string/tst_map.hpp
   trunk/boost/spirit/home/support/as_variant.hpp
   trunk/boost/spirit/home/support/ascii.hpp
   trunk/boost/spirit/home/support/attribute_of.hpp
   trunk/boost/spirit/home/support/attribute_transform.hpp
   trunk/boost/spirit/home/support/auxiliary/
   trunk/boost/spirit/home/support/char_class/
   trunk/boost/spirit/home/support/component.hpp
   trunk/boost/spirit/home/support/detail/action_dispatch.hpp
   trunk/boost/spirit/home/support/detail/container.hpp
   trunk/boost/spirit/home/support/detail/math/nonfinite_num_facets.hpp
   trunk/boost/spirit/home/support/detail/to_narrow.hpp
   trunk/boost/spirit/home/support/detail/values.hpp
   trunk/boost/spirit/home/support/iso8859_1.hpp
   trunk/boost/spirit/home/support/meta_grammar/
   trunk/boost/spirit/home/support/meta_grammar.hpp
   trunk/boost/spirit/home/support/modifier.hpp
   trunk/boost/spirit/home/support/multi_pass.hpp
   trunk/boost/spirit/home/support/nonterminal/detail/
   trunk/boost/spirit/home/support/nonterminal/nonterminal.hpp
   trunk/boost/spirit/home/support/placeholders.hpp
   trunk/boost/spirit/home/support/standard.hpp
   trunk/boost/spirit/home/support/standard_wide.hpp
   trunk/boost/spirit/include/karma_meta_grammar.hpp
   trunk/boost/spirit/include/lex_lexer_lexertl.hpp
   trunk/boost/spirit/include/lex_lexer_static_lexertl.hpp
   trunk/boost/spirit/include/lex_meta_grammar.hpp
   trunk/boost/spirit/include/lex_set_state.hpp
   trunk/boost/spirit/include/qi_meta_grammar.hpp
   trunk/boost/spirit/include/support_as_variant.hpp
   trunk/boost/spirit/include/support_attribute_of.hpp
   trunk/boost/spirit/include/support_attribute_transform.hpp
   trunk/boost/spirit/include/support_basic_rules.hpp
   trunk/boost/spirit/include/support_basic_transforms.hpp
   trunk/boost/spirit/include/support_component.hpp
   trunk/boost/spirit/include/support_functor_holder.hpp
   trunk/boost/spirit/include/support_grammar.hpp
   trunk/boost/spirit/include/support_meta_function_holder.hpp
   trunk/boost/spirit/include/support_meta_grammar.hpp
   trunk/boost/spirit/include/support_modifier.hpp
   trunk/boost/spirit/include/support_nonterminal.hpp
   trunk/boost/spirit/include/support_placeholders.hpp
Text files modified: 
   trunk/boost/spirit/home/karma.hpp                                               |     5                                         
   trunk/boost/spirit/home/karma/action.hpp                                        |     1                                         
   trunk/boost/spirit/home/karma/action/action.hpp                                 |   127 ++++---                                 
   trunk/boost/spirit/home/karma/auxiliary.hpp                                     |     7                                         
   trunk/boost/spirit/home/karma/auxiliary/eol.hpp                                 |    56 ++                                      
   trunk/boost/spirit/home/karma/auxiliary/eps.hpp                                 |   109 +++++-                                  
   trunk/boost/spirit/home/karma/auxiliary/lazy.hpp                                |   207 +++++++++--                             
   trunk/boost/spirit/home/karma/binary.hpp                                        |     1                                         
   trunk/boost/spirit/home/karma/binary/binary.hpp                                 |   257 +++++++++++---                          
   trunk/boost/spirit/home/karma/binary/padding.hpp                                |    91 ++++-                                   
   trunk/boost/spirit/home/karma/char.hpp                                          |     1                                         
   trunk/boost/spirit/home/karma/char/char.hpp                                     |   456 +++++++++++++-------------              
   trunk/boost/spirit/home/karma/char/space.hpp                                    |   131 +++----                                 
   trunk/boost/spirit/home/karma/detail/generate_to.hpp                            |    44 +-                                      
   trunk/boost/spirit/home/karma/detail/ostream_iterator.hpp                       |    14                                         
   trunk/boost/spirit/home/karma/detail/output_iterator.hpp                        |   330 +++++++++++-------                      
   trunk/boost/spirit/home/karma/detail/string_generate.hpp                        |    65 ++-                                     
   trunk/boost/spirit/home/karma/directive.hpp                                     |    10                                         
   trunk/boost/spirit/home/karma/directive/center_alignment.hpp                    |   372 ++++++++++++---------                   
   trunk/boost/spirit/home/karma/directive/delimit.hpp                             |   191 +++++++----                             
   trunk/boost/spirit/home/karma/directive/left_alignment.hpp                      |   352 +++++++++++---------                    
   trunk/boost/spirit/home/karma/directive/right_alignment.hpp                     |   365 ++++++++++++---------                   
   trunk/boost/spirit/home/karma/directive/verbatim.hpp                            |    96 +++--                                   
   trunk/boost/spirit/home/karma/domain.hpp                                        |    46 ++                                      
   trunk/boost/spirit/home/karma/generate.hpp                                      |   327 +++++++-----------                      
   trunk/boost/spirit/home/karma/nonterminal.hpp                                   |     1                                         
   trunk/boost/spirit/home/karma/nonterminal/grammar.hpp                           |    90 +++--                                   
   trunk/boost/spirit/home/karma/nonterminal/rule.hpp                              |   397 +++++++++++++++--------                 
   trunk/boost/spirit/home/karma/numeric.hpp                                       |     2                                         
   trunk/boost/spirit/home/karma/numeric/detail/numeric_utils.hpp                  |   318 +++++++++++-------                      
   trunk/boost/spirit/home/karma/numeric/int.hpp                                   |   420 ++++++++++++++++--------                
   trunk/boost/spirit/home/karma/numeric/real.hpp                                  |   432 +++++++++++++++----------               
   trunk/boost/spirit/home/karma/numeric/real_policies.hpp                         |   128 +++---                                  
   trunk/boost/spirit/home/karma/numeric/uint.hpp                                  |   481 ++++++++++++++++++++--------            
   trunk/boost/spirit/home/karma/operator.hpp                                      |     3                                         
   trunk/boost/spirit/home/karma/operator/alternative.hpp                          |   110 +++--                                   
   trunk/boost/spirit/home/karma/operator/kleene.hpp                               |   111 +++---                                  
   trunk/boost/spirit/home/karma/operator/list.hpp                                 |   122 +++---                                  
   trunk/boost/spirit/home/karma/operator/optional.hpp                             |   109 +++--                                   
   trunk/boost/spirit/home/karma/operator/plus.hpp                                 |   116 +++---                                  
   trunk/boost/spirit/home/karma/operator/sequence.hpp                             |   151 ++++++--                                
   trunk/boost/spirit/home/karma/stream.hpp                                        |     2                                         
   trunk/boost/spirit/home/karma/stream/detail/format_manip.hpp                    |    82 ++-                                     
   trunk/boost/spirit/home/karma/stream/format_manip.hpp                           |   130 +++----                                 
   trunk/boost/spirit/home/karma/stream/stream.hpp                                 |   306 ++++++++++++-----                       
   trunk/boost/spirit/home/karma/string.hpp                                        |     1                                         
   trunk/boost/spirit/home/karma/string/lit.hpp                                    |   414 +++++++++++------------                 
   trunk/boost/spirit/home/karma/what.hpp                                          |    27 -                                       
   trunk/boost/spirit/home/lex.hpp                                                 |     3                                         
   trunk/boost/spirit/home/lex/domain.hpp                                          |    16                                         
   trunk/boost/spirit/home/lex/lexer.hpp                                           |    10                                         
   trunk/boost/spirit/home/lex/lexer/action.hpp                                    |   116 +++---                                  
   trunk/boost/spirit/home/lex/lexer/char_token_def.hpp                            |   138 +++++++                                 
   trunk/boost/spirit/home/lex/lexer/lexer.hpp                                     |   306 +++++++----------                       
   trunk/boost/spirit/home/lex/lexer/lexertl/iterator_tokenizer.hpp                |    29                                         
   trunk/boost/spirit/home/lex/lexer/lexertl/wrap_action.hpp                       |   233 +++++++------                           
   trunk/boost/spirit/home/lex/lexer/sequence.hpp                                  |    48 ++                                      
   trunk/boost/spirit/home/lex/lexer/string_token_def.hpp                          |    87 ++++                                    
   trunk/boost/spirit/home/lex/lexer/token_def.hpp                                 |   159 +++++----                               
   trunk/boost/spirit/home/lex/lexer/token_set.hpp                                 |   168 ++++-----                               
   trunk/boost/spirit/home/lex/lexer_lexertl.hpp                                   |     2                                         
   trunk/boost/spirit/home/lex/lexer_static_lexertl.hpp                            |     6                                         
   trunk/boost/spirit/home/lex/tokenize_and_parse.hpp                              |   194 ++++-------                             
   trunk/boost/spirit/home/qi.hpp                                                  |    22                                         
   trunk/boost/spirit/home/qi/action.hpp                                           |    11                                         
   trunk/boost/spirit/home/qi/action/action.hpp                                    |   136 ++++---                                 
   trunk/boost/spirit/home/qi/auxiliary.hpp                                        |    18                                         
   trunk/boost/spirit/home/qi/auxiliary/eps.hpp                                    |   110 ++++-                                   
   trunk/boost/spirit/home/qi/auxiliary/lazy.hpp                                   |   218 +++++++++---                            
   trunk/boost/spirit/home/qi/binary.hpp                                           |    14                                         
   trunk/boost/spirit/home/qi/binary/binary.hpp                                    |   220 +++++++++---                            
   trunk/boost/spirit/home/qi/char.hpp                                             |    11                                         
   trunk/boost/spirit/home/qi/char/char.hpp                                        |   673 ++++++++++++++++++++++++--------------- 
   trunk/boost/spirit/home/qi/char/char_class.hpp                                  |   112 +++---                                  
   trunk/boost/spirit/home/qi/char/char_parser.hpp                                 |   149 ++++++--                                
   trunk/boost/spirit/home/qi/char/detail/basic_chset.hpp                          |     8                                         
   trunk/boost/spirit/home/qi/char/detail/range.hpp                                |    17                                         
   trunk/boost/spirit/home/qi/char/detail/range_functions.hpp                      |     6                                         
   trunk/boost/spirit/home/qi/char/detail/range_run.hpp                            |     6                                         
   trunk/boost/spirit/home/qi/char/detail/range_run_impl.hpp                       |     6                                         
   trunk/boost/spirit/home/qi/detail/alternative_function.hpp                      |    48 ++                                      
   trunk/boost/spirit/home/qi/detail/assign_to.hpp                                 |    30 +                                       
   trunk/boost/spirit/home/qi/detail/construct.hpp                                 |    30 +                                       
   trunk/boost/spirit/home/qi/detail/expect_function.hpp                           |    21                                         
   trunk/boost/spirit/home/qi/detail/fail_function.hpp                             |    23                                         
   trunk/boost/spirit/home/qi/detail/pass_function.hpp                             |    19                                         
   trunk/boost/spirit/home/qi/detail/permute_function.hpp                          |    18                                         
   trunk/boost/spirit/home/qi/detail/string_parse.hpp                              |     6                                         
   trunk/boost/spirit/home/qi/directive.hpp                                        |    14                                         
   trunk/boost/spirit/home/qi/directive/lexeme.hpp                                 |    99 +++--                                   
   trunk/boost/spirit/home/qi/directive/omit.hpp                                   |    86 +++-                                    
   trunk/boost/spirit/home/qi/directive/raw.hpp                                    |    86 +++-                                    
   trunk/boost/spirit/home/qi/domain.hpp                                           |    47 ++                                      
   trunk/boost/spirit/home/qi/nonterminal.hpp                                      |    16                                         
   trunk/boost/spirit/home/qi/nonterminal/grammar.hpp                              |    95 +++--                                   
   trunk/boost/spirit/home/qi/nonterminal/rule.hpp                                 |   534 +++++++++++++-----------------          
   trunk/boost/spirit/home/qi/numeric.hpp                                          |    11                                         
   trunk/boost/spirit/home/qi/numeric/detail/numeric_utils.hpp                     |    38 +-                                      
   trunk/boost/spirit/home/qi/numeric/detail/real_impl.hpp                         |   105 ++++-                                   
   trunk/boost/spirit/home/qi/numeric/int.hpp                                      |   120 ++++++                                  
   trunk/boost/spirit/home/qi/numeric/numeric_utils.hpp                            |    22                                         
   trunk/boost/spirit/home/qi/numeric/real.hpp                                     |   110 ++++-                                   
   trunk/boost/spirit/home/qi/numeric/real_policies.hpp                            |    54 +-                                      
   trunk/boost/spirit/home/qi/numeric/uint.hpp                                     |   157 ++++++++                                
   trunk/boost/spirit/home/qi/operator.hpp                                         |    11                                         
   trunk/boost/spirit/home/qi/operator/alternative.hpp                             |   119 +++---                                  
   trunk/boost/spirit/home/qi/operator/and_predicate.hpp                           |    75 ++-                                     
   trunk/boost/spirit/home/qi/operator/difference.hpp                              |   102 +++--                                   
   trunk/boost/spirit/home/qi/operator/expect.hpp                                  |    45 ++                                      
   trunk/boost/spirit/home/qi/operator/kleene.hpp                                  |   119 +++---                                  
   trunk/boost/spirit/home/qi/operator/list.hpp                                    |   123 +++---                                  
   trunk/boost/spirit/home/qi/operator/not_predicate.hpp                           |    74 ++-                                     
   trunk/boost/spirit/home/qi/operator/optional.hpp                                |   106 +++--                                   
   trunk/boost/spirit/home/qi/operator/permutation.hpp                             |   123 ++++--                                  
   trunk/boost/spirit/home/qi/operator/plus.hpp                                    |   119 +++---                                  
   trunk/boost/spirit/home/qi/operator/sequence.hpp                                |    42 ++                                      
   trunk/boost/spirit/home/qi/operator/sequence_base.hpp                           |   131 ++++--                                  
   trunk/boost/spirit/home/qi/operator/sequential_or.hpp                           |   112 ++++--                                  
   trunk/boost/spirit/home/qi/parse.hpp                                            |   162 ++++----                                
   trunk/boost/spirit/home/qi/stream.hpp                                           |    16                                         
   trunk/boost/spirit/home/qi/stream/detail/match_manip.hpp                        |   111 ++++--                                  
   trunk/boost/spirit/home/qi/stream/match_manip.hpp                               |   154 +++++----                               
   trunk/boost/spirit/home/qi/stream/stream.hpp                                    |    84 +++-                                    
   trunk/boost/spirit/home/qi/string.hpp                                           |    11                                         
   trunk/boost/spirit/home/qi/string/detail/tst.hpp                                |   198 -----------                             
   trunk/boost/spirit/home/qi/what.hpp                                             |    25                                         
   trunk/boost/spirit/home/support.hpp                                             |    34 +                                       
   trunk/boost/spirit/home/support/algorithm/any.hpp                               |    10                                         
   trunk/boost/spirit/home/support/algorithm/any_if.hpp                            |    50 +-                                      
   trunk/boost/spirit/home/support/algorithm/any_ns.hpp                            |     8                                         
   trunk/boost/spirit/home/support/argument.hpp                                    |   142 +-------                                
   trunk/boost/spirit/home/support/char_class.hpp                                  |   170 +++++----                               
   trunk/boost/spirit/home/support/detail/hold_any.hpp                             |    43 +-                                      
   trunk/boost/spirit/home/support/detail/integer/cover_operators.hpp              |    44 ++                                      
   trunk/boost/spirit/home/support/detail/integer/endian.hpp                       |   326 ++++++++++++-------                     
   trunk/boost/spirit/home/support/detail/lexer/input.hpp                          |     2                                         
   trunk/boost/spirit/home/support/detail/math/fpclassify.hpp                      |     2                                         
   trunk/boost/spirit/home/support/detail/what_function.hpp                        |    28                                         
   trunk/boost/spirit/home/support/iterators/detail/buf_id_check_policy.hpp        |    16                                         
   trunk/boost/spirit/home/support/iterators/detail/combine_policies.hpp           |   169 ++++-----                               
   trunk/boost/spirit/home/support/iterators/detail/first_owner_policy.hpp         |    20                                         
   trunk/boost/spirit/home/support/iterators/detail/fixed_size_queue.hpp           |    14                                         
   trunk/boost/spirit/home/support/iterators/detail/fixed_size_queue_policy.hpp    |    10                                         
   trunk/boost/spirit/home/support/iterators/detail/functor_input_policy.hpp       |     4                                         
   trunk/boost/spirit/home/support/iterators/detail/input_iterator_policy.hpp      |     4                                         
   trunk/boost/spirit/home/support/iterators/detail/lex_input_policy.hpp           |     4                                         
   trunk/boost/spirit/home/support/iterators/detail/multi_pass.hpp                 |    39 +-                                      
   trunk/boost/spirit/home/support/iterators/detail/no_check_policy.hpp            |     7                                         
   trunk/boost/spirit/home/support/iterators/detail/ref_counted_policy.hpp         |     7                                         
   trunk/boost/spirit/home/support/iterators/detail/split_functor_input_policy.hpp |    32 -                                       
   trunk/boost/spirit/home/support/iterators/detail/split_std_deque_policy.hpp     |    28                                         
   trunk/boost/spirit/home/support/iterators/look_ahead.hpp                        |     2                                         
   trunk/boost/spirit/home/support/iterators/multi_pass.hpp                        |    27                                         
   trunk/boost/spirit/home/support/nonterminal/locals.hpp                          |    27                                         
   trunk/boost/spirit/home/support/safe_bool.hpp                                   |    45 --                                      
   trunk/boost/spirit/home/support/unused.hpp                                      |    41 -                                       
   trunk/boost/spirit/include/karma.hpp                                            |     4                                         
   trunk/boost/spirit/include/karma_action.hpp                                     |     4                                         
   trunk/boost/spirit/include/karma_auxiliary.hpp                                  |     4                                         
   trunk/boost/spirit/include/karma_binary.hpp                                     |     4                                         
   trunk/boost/spirit/include/karma_char.hpp                                       |     4                                         
   trunk/boost/spirit/include/karma_delimit.hpp                                    |     6                                         
   trunk/boost/spirit/include/karma_directive.hpp                                  |     4                                         
   trunk/boost/spirit/include/karma_domain.hpp                                     |     4                                         
   trunk/boost/spirit/include/karma_generate.hpp                                   |     4                                         
   trunk/boost/spirit/include/karma_nonterminal.hpp                                |     4                                         
   trunk/boost/spirit/include/karma_numeric.hpp                                    |     4                                         
   trunk/boost/spirit/include/karma_operator.hpp                                   |     4                                         
   trunk/boost/spirit/include/karma_stream.hpp                                     |     4                                         
   trunk/boost/spirit/include/karma_string.hpp                                     |     4                                         
   trunk/boost/spirit/include/karma_what.hpp                                       |     4                                         
   trunk/boost/spirit/include/lex.hpp                                              |     4                                         
   trunk/boost/spirit/include/lex_domain.hpp                                       |     4                                         
   trunk/boost/spirit/include/lex_lexer.hpp                                        |     4                                         
   trunk/boost/spirit/include/lex_tokenize_and_parse.hpp                           |     4                                         
   trunk/boost/spirit/include/phoenix.hpp                                          |     4                                         
   trunk/boost/spirit/include/phoenix_algorithm.hpp                                |     4                                         
   trunk/boost/spirit/include/phoenix_bind.hpp                                     |     4                                         
   trunk/boost/spirit/include/phoenix_container.hpp                                |     4                                         
   trunk/boost/spirit/include/phoenix_core.hpp                                     |     4                                         
   trunk/boost/spirit/include/phoenix_function.hpp                                 |     4                                         
   trunk/boost/spirit/include/phoenix_fusion.hpp                                   |     4                                         
   trunk/boost/spirit/include/phoenix_object.hpp                                   |     4                                         
   trunk/boost/spirit/include/phoenix_operator.hpp                                 |     4                                         
   trunk/boost/spirit/include/phoenix_scope.hpp                                    |     4                                         
   trunk/boost/spirit/include/phoenix_statement.hpp                                |     4                                         
   trunk/boost/spirit/include/phoenix_stl.hpp                                      |     4                                         
   trunk/boost/spirit/include/phoenix_version.hpp                                  |     4                                         
   trunk/boost/spirit/include/qi.hpp                                               |     4                                         
   trunk/boost/spirit/include/qi_action.hpp                                        |     4                                         
   trunk/boost/spirit/include/qi_auxiliary.hpp                                     |     4                                         
   trunk/boost/spirit/include/qi_binary.hpp                                        |     4                                         
   trunk/boost/spirit/include/qi_char.hpp                                          |     4                                         
   trunk/boost/spirit/include/qi_debug.hpp                                         |     4                                         
   trunk/boost/spirit/include/qi_directive.hpp                                     |     4                                         
   trunk/boost/spirit/include/qi_domain.hpp                                        |     4                                         
   trunk/boost/spirit/include/qi_nonterminal.hpp                                   |     4                                         
   trunk/boost/spirit/include/qi_numeric.hpp                                       |     4                                         
   trunk/boost/spirit/include/qi_operator.hpp                                      |     4                                         
   trunk/boost/spirit/include/qi_parse.hpp                                         |     4                                         
   trunk/boost/spirit/include/qi_skip.hpp                                          |     6                                         
   trunk/boost/spirit/include/qi_stream.hpp                                        |     4                                         
   trunk/boost/spirit/include/qi_string.hpp                                        |     4                                         
   trunk/boost/spirit/include/qi_what.hpp                                          |     4                                         
   trunk/boost/spirit/include/support.hpp                                          |     4                                         
   trunk/boost/spirit/include/support_any.hpp                                      |     4                                         
   trunk/boost/spirit/include/support_any_if.hpp                                   |     4                                         
   trunk/boost/spirit/include/support_any_ns.hpp                                   |     4                                         
   trunk/boost/spirit/include/support_argument.hpp                                 |     4                                         
   trunk/boost/spirit/include/support_ascii.hpp                                    |     6                                         
   trunk/boost/spirit/include/support_char_class.hpp                               |     4                                         
   trunk/boost/spirit/include/support_iso8859_1.hpp                                |     6                                         
   trunk/boost/spirit/include/support_locals.hpp                                   |     4                                         
   trunk/boost/spirit/include/support_look_ahead.hpp                               |     4                                         
   trunk/boost/spirit/include/support_multi_pass.hpp                               |     4                                         
   trunk/boost/spirit/include/support_multi_pass_fwd.hpp                           |     4                                         
   trunk/boost/spirit/include/support_safe_bool.hpp                                |     4                                         
   trunk/boost/spirit/include/support_standard.hpp                                 |     6                                         
   trunk/boost/spirit/include/support_standard_wide.hpp                            |     6                                         
   trunk/boost/spirit/include/support_unused.hpp                                   |     4                                         
   trunk/boost/spirit/version.hpp                                                  |     8                                         
   221 files changed, 9525 insertions(+), 6823 deletions(-)
Modified: trunk/boost/spirit/home/karma.hpp
==============================================================================
--- trunk/boost/spirit/home/karma.hpp	(original)
+++ trunk/boost/spirit/home/karma.hpp	2009-04-26 10:42:24 EDT (Sun, 26 Apr 2009)
@@ -18,7 +18,12 @@
 #include <boost/spirit/home/karma/action.hpp>
 #include <boost/spirit/home/karma/directive.hpp>
 #include <boost/spirit/home/karma/auxiliary.hpp>
+#include <boost/spirit/home/karma/binary.hpp>
 #include <boost/spirit/home/karma/generate.hpp>
+#include <boost/spirit/home/karma/generate_attr.hpp>
+#include <boost/spirit/home/karma/generator.hpp>
+#include <boost/spirit/home/karma/delimit_out.hpp>
 #include <boost/spirit/home/karma/what.hpp>
+#include <boost/spirit/home/karma/stream.hpp>
 
 #endif
Modified: trunk/boost/spirit/home/karma/action.hpp
==============================================================================
--- trunk/boost/spirit/home/karma/action.hpp	(original)
+++ trunk/boost/spirit/home/karma/action.hpp	2009-04-26 10:42:24 EDT (Sun, 26 Apr 2009)
@@ -11,6 +11,5 @@
 #endif
 
 #include <boost/spirit/home/karma/action/action.hpp>
-#include <boost/spirit/home/karma/action/meta_grammar.hpp>
 
 #endif
Modified: trunk/boost/spirit/home/karma/action/action.hpp
==============================================================================
--- trunk/boost/spirit/home/karma/action/action.hpp	(original)
+++ trunk/boost/spirit/home/karma/action/action.hpp	2009-04-26 10:42:24 EDT (Sun, 26 Apr 2009)
@@ -10,80 +10,105 @@
 #pragma once      // MS compatible compilers support #pragma once
 #endif
 
-#include <boost/spirit/home/support/component.hpp>
-#include <boost/spirit/home/support/detail/values.hpp>
-#include <boost/spirit/home/support/attribute_of.hpp>
-#include <boost/spirit/home/support/detail/action_dispatch.hpp>
+#include <boost/spirit/home/support/attributes.hpp>
+#include <boost/spirit/home/support/argument.hpp>
+#include <boost/spirit/home/support/context.hpp>
+#include <boost/spirit/home/support/unused.hpp>
+#include <boost/spirit/home/support/info.hpp>
+#include <boost/spirit/home/support/action_dispatch.hpp>
 #include <boost/spirit/home/karma/domain.hpp>
+#include <boost/spirit/home/karma/meta_compiler.hpp>
+#include <boost/spirit/home/karma/generator.hpp>
+
 #include <boost/mpl/if.hpp>
 #include <boost/mpl/identity.hpp>
 #include <boost/type_traits/remove_const.hpp>
 #include <boost/type_traits/is_same.hpp>
-#include <vector>
 
 namespace boost { namespace spirit { namespace karma
 {
     ///////////////////////////////////////////////////////////////////////////
-    struct sequence;    // forward declaration only
-    
-    ///////////////////////////////////////////////////////////////////////////
-    struct action
+    BOOST_PP_REPEAT(SPIRIT_ARGUMENTS_LIMIT, SPIRIT_USING_ARGUMENT, _)
+
+    template <typename Subject, typename Action>
+    struct action : unary_generator<action<Subject, Action> >
     {
-        template <typename Component, typename Context, typename Unused>
+        template <typename Context, typename Unused>
         struct attribute
-          : traits::attribute_of<
-                karma::domain,
-                typename result_of::left<Component>::type,
-                Context
-            >
-        {
-        };
+          : traits::attribute_of<Subject, Context, Unused>
+        {};
 
-        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)
-        {
-            typedef typename
-                result_of::left<Component>::type::director
-            director;
-            typedef typename is_same<director, sequence>::type is_sequence;
+        action(Subject const& subject, Action f)
+          : subject(subject), f(f) {}
 
-            typedef typename
-                attribute<Component, Context, unused_type>::type
-            param_type;
+        template <
+            typename OutputIterator, typename Context, typename Delimiter
+          , typename Attribute>
+        bool generate(OutputIterator& sink, Context& ctx, Delimiter const& d
+          , Attribute const& attr_) const
+        {
+            typedef typename attribute<Context, unused_type>::type attr_type;
+            typedef traits::make_attribute<attr_type, Attribute> make_attribute;
 
-            // create a parameter if one is not supplied
+            // create a attribute if none is supplied
             // this creates a _copy_ of the parameter because the semantic
             // action likely will change parts of this
-            typename mpl::if_<
-                is_same<typename remove_const<Parameter>::type, unused_type>,
-                param_type,
-                Parameter
-            >::type p = spirit::detail::make_value<param_type>::call(param);
-
-            // call the function, passing the parameter, the context
-            // and a bool flag that the client can set to false to
-            // fail generating.
-            // The client can return false to fail parsing.
-            bool pass = spirit::detail::action_dispatch(
-                spirit::right(component), p, ctx, is_sequence());
+            typename make_attribute::value_type attr = make_attribute::call(attr_);
 
-            return pass &&
-                director::generate(spirit::left(component), sink, ctx, d, p);
+            // call the function, passing the attribute, the context and a bool 
+            // flag that the client can set to false to fail generating.
+            // The client can return false to fail parsing.
+            return traits::action_dispatch<Subject>()(f, attr, ctx) && 
+                   subject.generate(sink, ctx, d, attr);
         }
 
-        template <typename Component, typename Context>
-        static std::string what(Component const& component, Context const& ctx)
+        template <typename Context>
+        info what(Context& context) const
         {
-            typedef typename
-                spirit::result_of::left<Component>::type::director
-            director;
-            return director::what(spirit::left(component), ctx);
+            // the action is transparent (does not add any info)
+            return subject.what(context);
         }
+
+        Subject subject;
+        Action f;
     };
 
 }}}
 
+///////////////////////////////////////////////////////////////////////////////
+namespace boost { namespace spirit
+{
+    ///////////////////////////////////////////////////////////////////////////
+    // Karma action meta-compiler
+    template <>
+    struct make_component<karma::domain, tag::action>
+    {
+        template <typename Sig>
+        struct result;
+
+        template <typename This, typename Elements, typename Modifiers>
+        struct result<This(Elements, Modifiers)>
+        {
+            typedef typename
+                remove_const<typename Elements::car_type>::type
+            subject_type;
+
+            typedef typename
+                remove_const<typename Elements::cdr_type::car_type>::type
+            action_type;
+
+            typedef karma::action<subject_type, action_type> type;
+        };
+
+        template <typename Elements>
+        typename result<make_component(Elements, unused_type)>::type
+        operator()(Elements const& elements, unused_type) const
+        {
+            typename result<make_component(Elements, unused_type)>::type
+                result(elements.car, elements.cdr.car);
+            return result;
+        }
+    };
+}}
+
 #endif
Deleted: trunk/boost/spirit/home/karma/action/meta_grammar.hpp
==============================================================================
--- trunk/boost/spirit/home/karma/action/meta_grammar.hpp	2009-04-26 10:42:24 EDT (Sun, 26 Apr 2009)
+++ (empty file)
@@ -1,70 +0,0 @@
-//  Copyright (c) 2001-2009 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_META_GRAMMAR_MAR_04_2007_0907AM)
-#define BOOST_SPIRIT_KARMA_META_GRAMMAR_MAR_04_2007_0907AM
-
-#if defined(_MSC_VER) && (_MSC_VER >= 1020)
-#pragma once      // MS compatible compilers support #pragma once
-#endif
-
-#include <boost/spirit/home/karma/domain.hpp>
-#include <boost/spirit/home/support/meta_grammar.hpp>
-#include <boost/utility/enable_if.hpp>
-
-namespace boost { namespace spirit { namespace karma
-{
-    ///////////////////////////////////////////////////////////////////////////
-    // forwards
-    /////////////////////////////////////////////////////////////////////////// 
-    struct action;
-
-    struct main_meta_grammar;
-
-    template <typename Expr, typename Enable>
-    struct is_valid_expr;
-
-    template <typename Expr, typename Enable>
-    struct expr_transform;
-
-    ///////////////////////////////////////////////////////////////////////////
-    // action meta-grammar
-    ///////////////////////////////////////////////////////////////////////////
-    struct action_meta_grammar : 
-        meta_grammar::binary_rule<
-            karma::domain, proto::tag::subscript, action,
-            main_meta_grammar, proto::when<proto::_, proto::_child>
-        >
-    {
-    };
-
-    ///////////////////////////////////////////////////////////////////////////
-    //  These specializations non-intrusively hooks into the Karma meta-grammar.
-    //  (see karma/meta_grammar.hpp)
-    ///////////////////////////////////////////////////////////////////////////
-    template <typename Expr>
-    struct is_valid_expr<
-            Expr,
-            typename enable_if<
-                proto::matches<Expr, action_meta_grammar> 
-            >::type
-        >
-      : mpl::true_
-    {
-    };
-
-    template <typename Expr>
-    struct expr_transform<
-            Expr,
-            typename enable_if<
-                proto::matches<Expr, action_meta_grammar> 
-            >::type
-        >
-      : mpl::identity<action_meta_grammar>
-    {
-    };
-}}}
-
-#endif
Modified: trunk/boost/spirit/home/karma/auxiliary.hpp
==============================================================================
--- trunk/boost/spirit/home/karma/auxiliary.hpp	(original)
+++ trunk/boost/spirit/home/karma/auxiliary.hpp	2009-04-26 10:42:24 EDT (Sun, 26 Apr 2009)
@@ -6,13 +6,10 @@
 #if !defined(BOOST_SPIRIT_KARMA_AUXILIARY_MAR_26_2007_1225PM)
 #define BOOST_SPIRIT_KARMA_AUXILIARY_MAR_26_2007_1225PM
 
-#include <boost/spirit/home/karma/auxiliary/none.hpp>
-#include <boost/spirit/home/karma/auxiliary/confix.hpp>
+// #include <boost/spirit/home/karma/auxiliary/confix.hpp>
 #include <boost/spirit/home/karma/auxiliary/eps.hpp>
 #include <boost/spirit/home/karma/auxiliary/eol.hpp>
 #include <boost/spirit/home/karma/auxiliary/lazy.hpp>
-#include <boost/spirit/home/karma/auxiliary/functor.hpp>
-#include <boost/spirit/home/karma/auxiliary/functor_director.hpp>
-#include <boost/spirit/home/karma/auxiliary/meta_grammar.hpp>
+// #include <boost/spirit/home/karma/auxiliary/functor.hpp>
 
 #endif
Deleted: trunk/boost/spirit/home/karma/auxiliary/confix.hpp
==============================================================================
--- trunk/boost/spirit/home/karma/auxiliary/confix.hpp	2009-04-26 10:42:24 EDT (Sun, 26 Apr 2009)
+++ (empty file)
@@ -1,121 +0,0 @@
-//  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_CONFIX_AUG_19_2008_1041AM)
-#define BOOST_SPIRIT_KARMA_CONFIX_AUG_19_2008_1041AM
-
-#include <boost/spirit/home/karma/domain.hpp>
-#include <boost/spirit/home/karma/delimit.hpp>
-#include <boost/spirit/home/support/component.hpp>
-#include <boost/spirit/home/support/attribute_of.hpp>
-#include <boost/spirit/home/support/unused.hpp>
-#include <boost/spirit/home/support/auxiliary/confix.hpp>
-
-///////////////////////////////////////////////////////////////////////////////
-namespace boost { namespace spirit { namespace karma
-{
-    ///////////////////////////////////////////////////////////////////////////
-    // the director for a confix() generated generator
-    struct confix_director
-    {
-        template <typename Component, typename Context, typename Unused>
-        struct attribute
-        {
-            typedef typename
-                result_of::subject<Component>::type
-            subject_type;
-
-            typedef typename
-                traits::attribute_of<karma::domain, subject_type, Context>::type
-            type;
-        };
-
-    private:
-        ///////////////////////////////////////////////////////////////////////
-        template <typename OutputIterator, typename Context, 
-            typename Delimiter, typename Expr>
-        static void
-        generate_helper(OutputIterator& sink, Context& ctx, Delimiter const& d,
-            Expr const& e)
-        {
-            BOOST_MPL_ASSERT_MSG(
-                (spirit::traits::is_component<karma::domain, Expr>::value), 
-                expression_is_not_convertible_to_a_generator, (Context, Expr));
-
-            typedef 
-                typename result_of::as_component<karma::domain, Expr>::type 
-            expr;
-
-            expr eg = spirit::as_component(karma::domain(), e);
-            typedef typename expr::director director;
-            director::generate(eg, sink, ctx, d, unused);
-        }
-
-        template <typename Context, typename Expr>
-        static std::string what_helper(Expr const& e, Context& ctx)
-        {
-            typedef 
-                typename result_of::as_component<karma::domain, Expr>::type 
-            expr;
-
-            expr eg = spirit::as_component(karma::domain(), e);
-            typedef typename expr::director director;
-            return director::what(eg, ctx);
-        }
-
-    public:
-        ///////////////////////////////////////////////////////////////////////
-        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) 
-        {
-            // generate the prefix
-            generate_helper(sink, ctx, d, 
-                spirit::detail::confix_extractor::prefix(
-                    proto::child_c<0>(spirit::argument1(component))));
-
-            // generate the embedded items
-            typedef typename
-                spirit::result_of::subject<Component>::type::director
-            director;
-            bool result = director::generate(spirit::subject(component), sink, 
-                ctx, d, param);
-
-            // append the suffix 
-            generate_helper(sink, ctx, d, 
-                spirit::detail::confix_extractor::suffix(
-                    proto::child_c<0>(spirit::argument1(component))));
-
-            return result;
-        }
-
-        template <typename Component, typename Context>
-        static std::string what(Component const& component, Context const& ctx)
-        {
-            std::string result = "confix(";
-
-            result += what_helper(spirit::detail::confix_extractor::prefix(
-                    proto::child_c<0>(spirit::argument1(component))), ctx);
-            result += ", ";
-
-            result += what_helper(spirit::detail::confix_extractor::suffix(
-                    proto::child_c<0>(spirit::argument1(component))), ctx);
-            result += ")[";
-
-            typedef typename
-                spirit::result_of::subject<Component>::type::director
-            director;
-            result += director::what(spirit::subject(component), ctx);
-            result += "]";
-
-            return result;
-        }
-    };
-
-}}}
-
-#endif
Modified: trunk/boost/spirit/home/karma/auxiliary/eol.hpp
==============================================================================
--- trunk/boost/spirit/home/karma/auxiliary/eol.hpp	(original)
+++ trunk/boost/spirit/home/karma/auxiliary/eol.hpp	2009-04-26 10:42:24 EDT (Sun, 26 Apr 2009)
@@ -6,36 +6,66 @@
 #if !defined(BOOST_SPIRIT_KARMA_EOL_JUL_08_2008_1014AM)
 #define BOOST_SPIRIT_KARMA_EOL_JUL_08_2008_1014AM
 
+#include <boost/spirit/home/support/common_terminals.hpp>
+#include <boost/spirit/home/support/info.hpp>
 #include <boost/spirit/home/karma/domain.hpp>
-#include <boost/spirit/home/karma/delimit.hpp>
+#include <boost/spirit/home/karma/meta_compiler.hpp>
+#include <boost/spirit/home/karma/delimit_out.hpp>
 #include <boost/spirit/home/support/unused.hpp>
 #include <boost/spirit/home/karma/detail/generate_to.hpp>
 
+namespace boost { namespace spirit 
+{
+    ///////////////////////////////////////////////////////////////////////////
+    // Enablers
+    ///////////////////////////////////////////////////////////////////////////
+    template <>
+    struct use_terminal<karma::domain, tag::eol>       // enables eol
+      : mpl::true_ {};
+
+}}
+
+///////////////////////////////////////////////////////////////////////////////
 namespace boost { namespace spirit { namespace karma
 {
+    using boost::spirit::eol;
+    using boost::spirit::eoi_type;
+
     struct eol_generator
     {
-        template <typename Component, typename Context, typename Unused>
+        template <typename Context, typename Unused>
         struct attribute
         {
             typedef unused_type type;
         };
 
-        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*/) 
+        template <
+            typename OutputIterator, typename Context, typename Delimiter
+          , typename Attribute>
+        static bool generate(OutputIterator& sink, Context&, Delimiter const& d
+          , Attribute const& attr)
         {
-            detail::generate_to(sink, '\n');
-            karma::delimit(sink, d);          // always do post-delimiting
-            return true;
+            return detail::generate_to(sink, '\n') &&
+                   karma::delimit_out(sink, d);   // always do post-delimiting
         }
 
-        template <typename Component, typename Context>
-        static std::string what(Component const& component, Context const& ctx)
+        template <typename Context>
+        info what(Context const& ctx) const
+        {
+            return info("eol");
+        }
+    };
+
+    ///////////////////////////////////////////////////////////////////////////
+    // Generator generators: make_xxx function (objects)
+    ///////////////////////////////////////////////////////////////////////////
+    template <typename Modifiers>
+    struct make_primitive<tag::eol, Modifiers>
+    {
+        typedef eol_generator result_type;
+        result_type operator()(unused_type, unused_type) const
         {
-            return "eol";
+            return result_type();
         }
     };
 
Modified: trunk/boost/spirit/home/karma/auxiliary/eps.hpp
==============================================================================
--- trunk/boost/spirit/home/karma/auxiliary/eps.hpp	(original)
+++ trunk/boost/spirit/home/karma/auxiliary/eps.hpp	2009-04-26 10:42:24 EDT (Sun, 26 Apr 2009)
@@ -6,60 +6,123 @@
 #if !defined(BOOST_SPIRIT_KARMA_EPS_APRIL_21_2007_0246PM)
 #define BOOST_SPIRIT_KARMA_EPS_APRIL_21_2007_0246PM
 
+#include <boost/spirit/home/support/common_terminals.hpp>
+#include <boost/spirit/home/support/info.hpp>
 #include <boost/spirit/home/karma/domain.hpp>
-#include <boost/spirit/home/karma/delimit.hpp>
+#include <boost/spirit/home/karma/meta_compiler.hpp>
+#include <boost/spirit/home/karma/delimit_out.hpp>
 #include <boost/spirit/home/support/unused.hpp>
 #include <boost/fusion/include/at.hpp>
 
+namespace boost { namespace spirit 
+{
+    ///////////////////////////////////////////////////////////////////////////
+    // Enablers
+    ///////////////////////////////////////////////////////////////////////////
+
+    // enables eps
+    template <>
+    struct use_terminal<karma::domain, tag::eps>
+      : mpl::true_ {};
+
+    // enables eps(bool-condition)
+    template <typename A0>
+    struct use_terminal<karma::domain
+        , terminal_ex<tag::eps, fusion::vector1<A0> > > 
+      : is_convertible<A0, bool> {};
+
+    // enables lazy eps(f)
+    template <>
+    struct use_lazy_terminal<karma::domain, tag::eps, 1>
+      : mpl::true_ {};
+
+}}
+
+///////////////////////////////////////////////////////////////////////////////
 namespace boost { namespace spirit { namespace karma
 {
+    using boost::spirit::eps;
+    using boost::spirit::eps_type;
+
     struct eps_generator
     {
-        template <typename Component, typename Context, typename Unused>
+        template <typename Context, typename Unused>
         struct attribute
         {
             typedef unused_type type;
         };
 
-        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*/)
+        template <
+            typename OutputIterator, typename Context, typename Delimiter
+          , typename Attribute>
+        static bool generate(OutputIterator& sink, Context&, Delimiter const& d
+          , Attribute const& attr)
         {
-            karma::delimit(sink, d);
-            return true;
+            return karma::delimit_out(sink, d); // always do post-delimiting
         }
 
-        template <typename Component, typename Context>
-        static std::string what(Component const& component, Context const& ctx)
+        template <typename Context>
+        info what(Context const& ctx) const
         {
-            return "eps";
+            return info("eps");
         }
     };
 
     struct semantic_predicate
     {
-        template <typename Component, typename Context, typename Unused>
+        template <typename Context, typename Unused>
         struct attribute
         {
             typedef unused_type type;
         };
 
-        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*/)
+        semantic_predicate(bool predicate)
+          : predicate_(predicate) 
+        {}
+
+        template <
+            typename OutputIterator, typename Context, typename Delimiter
+          , typename Attribute>
+        bool generate(OutputIterator& sink, Context&, Delimiter const& d
+          , Attribute const& attr)
+        {
+            // only do post-delimiting when predicate is true
+            return predicate_ && karma::delimit_out(sink, d);
+        }
+
+        template <typename Context>
+        info what(Context const& ctx) const
+        {
+            return info("semantic-predicate");
+        }
+
+        bool predicate_;
+    };
+
+    ///////////////////////////////////////////////////////////////////////////
+    // Generator generators: make_xxx function (objects)
+    ///////////////////////////////////////////////////////////////////////////
+    template <typename Modifiers>
+    struct make_primitive<tag::eps, Modifiers>
+    {
+        typedef eps_generator result_type;
+        result_type operator()(unused_type, unused_type) const
         {
-            karma::delimit(sink, d);
-            return fusion::at_c<0>(component.elements)(unused, ctx);
+            return result_type();
         }
+    };
+
+    template <typename Modifiers, typename A0>
+    struct make_primitive<
+        terminal_ex<tag::eps, fusion::vector1<A0> >
+      , Modifiers>
+    {
+        typedef semantic_predicate result_type;
 
-        template <typename Component, typename Context>
-        static std::string what(Component const& component, Context const& ctx)
+        template <typename Terminal>
+        result_type operator()(Terminal const& term, unused_type) const
         {
-            return "semantic-predicate";
+            return result_type(fusion::at_c<0>(term.args));
         }
     };
 
Deleted: trunk/boost/spirit/home/karma/auxiliary/functor.hpp
==============================================================================
--- trunk/boost/spirit/home/karma/auxiliary/functor.hpp	2009-04-26 10:42:24 EDT (Sun, 26 Apr 2009)
+++ (empty file)
@@ -1,213 +0,0 @@
-//  Copyright (c) 2001-2009 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_FUNCTOR_APR_01_2007_1038AM)
-#define BOOST_SPIRIT_KARMA_FUNCTOR_APR_01_2007_1038AM
-
-#if defined(_MSC_VER) && (_MSC_VER >= 1020)
-#pragma once      // MS compatible compilers support #pragma once
-#endif
-
-#include <boost/spirit/home/support/component.hpp>
-#include <boost/spirit/home/support/unused.hpp>
-#include <boost/spirit/home/support/auxiliary/functor_holder.hpp>
-#include <boost/spirit/home/support/auxiliary/meta_function_holder.hpp>
-#include <boost/spirit/home/support/detail/values.hpp>
-#include <boost/spirit/home/karma/delimit.hpp>
-#include <boost/mpl/if.hpp>
-#include <boost/mpl/lambda.hpp>
-#include <boost/type_traits/is_same.hpp>
-#include <boost/type_traits/remove_const.hpp>
-
-///////////////////////////////////////////////////////////////////////////////
-namespace boost { namespace spirit 
-{ 
-    namespace karma
-    {
-        template <typename Functor, typename ParameterMF = Functor>
-        class functor_generator;
-    }
-    
-    namespace result_of
-    {
-        template <typename Functor>
-        struct as_generator
-        {
-            typedef karma::functor_generator<Functor> type;
-        };
-
-        template <typename Functor, typename ParameterMF>
-        struct as_generator_mf
-        {
-            typedef karma::functor_generator<Functor, ParameterMF> type;
-        };
-    }
-
-}}  // boost::spirit
-
-///////////////////////////////////////////////////////////////////////////////
-namespace boost { namespace spirit { namespace karma
-{
-    ///////////////////////////////////////////////////////////////////////////
-    //  This struct may be used as a base class for a user defined functor
-    ///////////////////////////////////////////////////////////////////////////
-    struct functor_base
-    {
-        ///////////////////////////////////////////////////////////////////////
-        //  The return value of a karma functor is always bool
-        ///////////////////////////////////////////////////////////////////////
-        template <typename Parameter, typename OutputIterator>
-        struct result
-        {
-            typedef bool type;
-        };
-
-// FIXME: It will be possible to specify the return value as a typedef, but for 
-//        that Phoenix will have to be fixed.
-//         typedef bool result_type;
-        
-        ///////////////////////////////////////////////////////////////////////
-        //  The expected parameter type of a functor has to be defined using a
-        //  embedded apply metafunction. Normally this will be overloaded by 
-        //  the derived class, but the default is unused type.
-        ///////////////////////////////////////////////////////////////////////
-        template <typename Context>
-        struct apply
-        {
-            typedef spirit::unused_type type;
-        };
-    };
-    
-    ///////////////////////////////////////////////////////////////////////////
-    //  The functor generator template may be used to create new generators
-    //  without having to dig into the implementation details of Karma
-    ///////////////////////////////////////////////////////////////////////////
-    template <typename Functor, typename ParameterMF>
-    class functor_generator
-      : public proto::extends<
-            typename make_functor_holder<
-                functor_generator<Functor, ParameterMF> const*, 
-                functor_generator<Functor, ParameterMF>
-            >::type,
-            functor_generator<Functor, ParameterMF>
-        > 
-    {
-    private:
-        typedef functor_generator<Functor, ParameterMF> self_type;
-        typedef typename 
-            make_functor_holder<self_type const*, self_type>::type 
-        functor_tag;
-        typedef proto::extends<functor_tag, self_type> base_type;
-
-    public:
-        template <typename Context>
-        struct result 
-          : mpl::apply<ParameterMF, Context>
-        {};
-
-    private:
-        // generate function just delegates to the functor supplied function
-        template <typename OutputIterator, typename Context, typename Parameter>
-        bool 
-        generate (OutputIterator& sink, Context& ctx, Parameter const& p) const
-        {
-            // create an attribute if none is supplied
-            typedef typename result<Context>::type parameter_type;
-            typename mpl::if_<
-                is_same<typename remove_const<Parameter>::type, unused_type>,
-                parameter_type,
-                Parameter const&
-            >::type
-            param = spirit::detail::make_value<parameter_type>::call(p);
-
-            return functor(param, ctx, sink);
-        }
-
-        friend struct functor_director;
-        
-    public:
-        explicit functor_generator()
-          : base_type(make_tag())
-        {
-        }
-
-        functor_generator(Functor const& functor_)
-          : base_type(make_tag()), functor(functor_)
-        {
-        }
-
-        functor_generator(Functor const& functor_, ParameterMF const& mf)
-          : base_type(make_tag()), functor(functor_), mf_(mf)
-        {
-        }
-
-    private:
-        functor_tag make_tag() const
-        {
-            functor_tag xpr = {{ this }};
-            return xpr;
-        }
-        
-        Functor functor;
-        meta_function_holder<Functor, ParameterMF> mf_;
-    };
-
-    ///////////////////////////////////////////////////////////////////////////
-    //  The as_generator generator function may be used to create a functor 
-    //  generator from a function object (some callable item).
-    //  The supplied functor needs to expose
-    // 
-    //    - an embedded result meta function: 
-    //
-    //          template <typename Parameter, typename OutputIterator>
-    //          struct result
-    //          {
-    //              typedef bool type;
-    //          };
-    //
-    //      which declares 'bool' as the result type of the defined function
-    //      operator and
-    //
-    //    - an embedded apply meta function:
-    //
-    //          template <typename Context>
-    //          struct apply
-    //          {
-    //              typedef unspecified type;
-    //          };
-    //
-    //      which declares the given type as the expected attribute type for 
-    //      the generator to create.
-    ///////////////////////////////////////////////////////////////////////////
-    template <typename Functor>
-    inline typename result_of::as_generator<Functor>::type
-    as_generator(Functor const& func)
-    {
-        return functor_generator<Functor>(func);
-    }
-
-    ///////////////////////////////////////////////////////////////////////////
-    //  The as_generator_mf generator function is equivalent to the function
-    //  as_generator above except that the user has to explicitly specify a
-    //  type exposing an embedded apply meta function declaring the expected
-    //  parameter type for the generator to create.
-    ///////////////////////////////////////////////////////////////////////////
-    template <typename ParameterMF, typename Functor>
-    inline typename result_of::as_generator_mf<Functor, ParameterMF>::type
-    as_generator_mf(Functor const& func, ParameterMF const& mf)
-    {
-        return functor_generator<Functor, ParameterMF>(func, mf);
-    }
-
-    template <typename ParameterMF, typename Functor>
-    inline typename result_of::as_generator_mf<Functor, ParameterMF>::type
-    as_generator_mf(Functor const& func)
-    {
-        return functor_generator<Functor, ParameterMF>(func, ParameterMF());
-    }
-
-}}}
-
-#endif
Deleted: trunk/boost/spirit/home/karma/auxiliary/functor_director.hpp
==============================================================================
--- trunk/boost/spirit/home/karma/auxiliary/functor_director.hpp	2009-04-26 10:42:24 EDT (Sun, 26 Apr 2009)
+++ (empty file)
@@ -1,53 +0,0 @@
-//  Copyright (c) 2001-2009 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_FUNCTOR_DIRECTOR_APR_01_2007_1041AM)
-#define BOOST_SPIRIT_KARMA_FUNCTOR_DIRECTOR_APR_01_2007_1041AM
-
-#include <boost/spirit/home/support/auxiliary/functor_holder.hpp>
-#include <boost/spirit/home/support/component.hpp>
-#include <boost/spirit/home/karma/domain.hpp>
-
-namespace boost { namespace spirit { namespace karma
-{
-    // this is the director for all functor generators 
-    struct functor_director
-    {
-        // expected value type of the generator
-        template <typename Component, typename Context, typename Unused>
-        struct attribute
-        {
-            typedef typename 
-                result_of::subject<Component>::type::functor_holder
-            functor_holder;
-            typedef typename functor_holder::functor_type functor_type;
-            
-            typedef typename
-                functor_type::template result<Context>::type 
-            type;
-        };
-
-        // generate functionality, delegates back to the corresponding functor
-        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) 
-        {
-            bool result = subject(component).held->generate(sink, ctx, param);
-            karma::delimit(sink, d);           // always do post-delimiting 
-            return result;
-        }
-
-        template <typename Component, typename Context>
-        static std::string what(Component const& component, Context const& ctx)
-        {
-            return "functor";
-        }
-    };
-    
-}}}
-
-#endif
Modified: trunk/boost/spirit/home/karma/auxiliary/lazy.hpp
==============================================================================
--- trunk/boost/spirit/home/karma/auxiliary/lazy.hpp	(original)
+++ trunk/boost/spirit/home/karma/auxiliary/lazy.hpp	2009-04-26 10:42:24 EDT (Sun, 26 Apr 2009)
@@ -1,4 +1,5 @@
 //  Copyright (c) 2001-2009 Hartmut Kaiser
+//  Copyright (c) 2001-2009 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)
@@ -6,84 +7,200 @@
 #if !defined(BOOST_SPIRIT_KARMA_LAZY_MARCH_27_2007_1231PM)
 #define BOOST_SPIRIT_KARMA_LAZY_MARCH_27_2007_1231PM
 
+#if defined(_MSC_VER)
+#pragma once
+#endif
+
 #include <boost/spirit/home/karma/domain.hpp>
-#include <boost/spirit/home/karma/delimit.hpp>
-#include <boost/spirit/home/support/attribute_of.hpp>
+#include <boost/spirit/home/karma/delimit_out.hpp>
+#include <boost/spirit/home/karma/meta_compiler.hpp>
+#include <boost/spirit/home/support/attributes.hpp>
 #include <boost/spirit/home/support/unused.hpp>
+#include <boost/spirit/home/support/info.hpp>
+#include <boost/spirit/home/support/lazy.hpp>
+#include <boost/spirit/home/phoenix/core/actor.hpp>
 #include <boost/fusion/include/at.hpp>
 #include <boost/utility/result_of.hpp>
 #include <boost/type_traits/remove_reference.hpp>
+#include <boost/mpl/not.hpp>
+
+namespace boost { namespace spirit
+{
+    ///////////////////////////////////////////////////////////////////////////
+    // Enablers
+    ///////////////////////////////////////////////////////////////////////////
+    template <typename Eval>
+    struct use_terminal<karma::domain, phoenix::actor<Eval> >  // enables phoenix actors
+        : mpl::true_ {};
+
+    // forward declaration
+    template <typename Terminal, typename Actor, int Arity>
+    struct lazy_terminal;
+
+}}
 
 namespace boost { namespace spirit { namespace karma
 {
-    struct lazy_generator
+    using spirit::lazy;
+
+    template <typename Function>
+    struct lazy_generator : generator<lazy_generator<Function> >
     {
-        template <typename Component, typename Context, typename Unused>
+        template <typename Context, typename Unused>
         struct attribute
         {
             typedef typename
-                result_of::subject<Component>::type
-            subject_type;
-
-            typedef typename
                 remove_reference<
-                    typename boost::result_of<
-                        subject_type(unused_type, Context)
-                    >::type
+                    typename boost::result_of<Function(unused_type, Context)>::type
                 >::type
             expr_type;
 
+            // If you got an error_invalid_expression error message here,
+            // then the expression (expr_type) is not a valid spirit karma
+            // expression.
+            BOOST_SPIRIT_ASSERT_MATCH(karma::domain, expr_type)
+
             typedef typename
-                result_of::as_component<karma::domain, expr_type>::type
-            component_type;
+                result_of::compile<karma::domain, expr_type, tag::lazy_eval>::type
+            generator_type;
 
             typedef typename
-                traits::attribute_of<
-                    karma::domain, component_type, Context>::type
+                traits::attribute_of<generator_type, Context, Unused>::type
             type;
         };
 
-        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) 
+        lazy_generator(Function const& func)
+          : func(func) 
+        {}
+
+        template <
+            typename OutputIterator, typename Context, 
+            typename Delimiter, typename Attribute
+        >
+        bool generate(OutputIterator& sink, Context& context, 
+            Delimiter const& d, Attribute const& attr) const
         {
-            typedef typename
-                result_of::subject<Component>::type
-            subject_type;
+            return compile<karma::domain>(func(unused, context), tag::lazy_eval())
+                .generate(sink, context, d, attr);
+        }
 
+        template <typename Context>
+        info what(Context& context) const
+        {
+            return info("lazy"
+              , compile<karma::domain>(func(unused, context), tag::lazy_eval())
+                    .what(context)
+            );
+        }
+
+        Function func;
+    };
+
+    ///////////////////////////////////////////////////////////////////////////
+    template <typename Function, typename Subject>
+    struct lazy_directive : unary_generator<lazy_directive<Function, Subject> >
+    {
+        typedef Subject subject_type;
+
+        template <typename Context, typename Unused>
+        struct attribute
+        {
             typedef typename
                 remove_reference<
-                    typename boost::result_of<
-                        subject_type(unused_type, Context)
-                    >::type
+                    typename boost::result_of<Function(unused_type, Context)>::type
+                >::type
+            directive_expr_type;
+
+            typedef typename
+                proto::result_of::make_expr<
+                    proto::tag::subscript
+                  , directive_expr_type
+                  , Subject
                 >::type
             expr_type;
 
+            // If you got an error_invalid_expression error message here,
+            // then the expression (expr_type) is not a valid spirit karma
+            // expression.
+            BOOST_SPIRIT_ASSERT_MATCH(karma::domain, expr_type)
+
+            typedef typename
+                result_of::compile<karma::domain, expr_type, tag::lazy_eval>::type
+            generator_type;
+
             typedef typename
-                result_of::as_component<karma::domain, expr_type>::type
-            component_type;
+                traits::attribute_of<generator_type, Context>::type
+            type;
+        };
+
+        lazy_directive(Function const& function, Subject const& subject)
+          : function(function), subject(subject) {}
 
-            component_type subject
-                = spirit::as_component(
-                    karma::domain(), 
-                    fusion::at_c<0>(component.elements)(unused, ctx));
-
-            return component_type::director::
-                generate(subject, sink, ctx, d, param);
-        }
-
-        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
-            result += "...";
-            result += "]";
-            return result;
+        template <typename OutputIterator, typename Context, typename Delimiter
+          , typename Attribute>
+        bool generate(OutputIterator& sink, Context& ctx, Delimiter const& d
+          , Attribute const& attr) const
+        {
+            return compile<karma::domain>(
+                proto::make_expr<proto::tag::subscript>(
+                    function(unused, ctx), subject), tag::lazy_eval())
+                .generate(sink, ctx, d, attr);
         }
+
+        template <typename Context>
+        info what(Context& ctx) const
+        {
+            return info("lazy-directive"
+              , compile<karma::domain>(
+                    proto::make_expr<proto::tag::subscript>(
+                        function(unused, ctx), subject), tag::lazy_eval())
+                    .what(ctx)
+            );
+        }
+
+        Function function;
+        Subject subject;
     };
+
+    ///////////////////////////////////////////////////////////////////////////
+    // Generator generators: make_xxx function (objects)
+    ///////////////////////////////////////////////////////////////////////////
+    template <typename Eval, typename Modifiers>
+    struct make_primitive<phoenix::actor<Eval>, Modifiers>
+    {
+        typedef lazy_generator<phoenix::actor<Eval> > result_type;
+        result_type operator()(phoenix::actor<Eval> const& f, unused_type) const
+        {
+            return result_type(f);
+        }
+    };
+
+    template <typename Terminal, typename Actor, int Arity, typename Modifiers>
+    struct make_primitive<lazy_terminal<Terminal, Actor, Arity>, Modifiers>
+    {
+        typedef lazy_generator<Actor> result_type;
+        result_type operator()(
+            lazy_terminal<Terminal, Actor, Arity> const& lt, unused_type) const
+        {
+            return result_type(lt.actor);
+        }
+    };
+
+    template <
+        typename Terminal, typename Actor, int Arity, typename Subject
+      , typename Modifiers>
+    struct make_directive<lazy_terminal<Terminal, Actor, Arity>
+      , Subject, Modifiers>
+    {
+        typedef lazy_directive<Actor, Subject> result_type;
+        result_type operator()(
+            lazy_terminal<Terminal, Actor, Arity> const& lt
+          , Subject const& subject, unused_type) const
+        {
+            return result_type(lt.actor, subject);
+        }
+    };
+
 }}}
 
 #endif
Deleted: trunk/boost/spirit/home/karma/auxiliary/meta_grammar.hpp
==============================================================================
--- trunk/boost/spirit/home/karma/auxiliary/meta_grammar.hpp	2009-04-26 10:42:24 EDT (Sun, 26 Apr 2009)
+++ (empty file)
@@ -1,106 +0,0 @@
-//  Copyright (c) 2001-2009 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_META_GRAMMAR_MARCH_26_2007_1230PM)
-#define BOOST_SPIRIT_KARMA_META_GRAMMAR_MARCH_26_2007_1230PM
-
-#include <boost/spirit/home/karma/domain.hpp>
-#include <boost/spirit/home/support/placeholders.hpp>
-#include <boost/spirit/home/support/meta_grammar.hpp>
-#include <boost/utility/enable_if.hpp>
-
-namespace boost { namespace spirit
-{
-    template <typename T, typename Functor>
-    struct functor_holder;
-}}
-
-namespace boost { namespace spirit { namespace karma
-{
-    ///////////////////////////////////////////////////////////////////////////
-    // forwards
-    ///////////////////////////////////////////////////////////////////////////
-    struct main_meta_grammar;
-
-    struct none;
-    struct eps_generator;
-    struct eol_generator;
-    struct semantic_predicate;
-    struct lazy_generator;
-    struct functor_director;
-    struct confix_director;
-
-    template <typename Expr, typename Enable>
-    struct is_valid_expr;
-
-    template <typename Expr, typename Enable>
-    struct expr_transform;
-
-    ///////////////////////////////////////////////////////////////////////////
-    // auxiliary generators meta-grammar
-    ///////////////////////////////////////////////////////////////////////////
-
-    // none, and lazy
-    struct auxiliary_meta_grammar
-      : proto::or_<
-            // none
-            meta_grammar::empty_terminal_rule<
-                karma::domain, tag::none, none>,
-            // eps
-            meta_grammar::empty_terminal_rule<
-                karma::domain, tag::eps, eps_generator>,
-            // eol
-            meta_grammar::empty_terminal_rule<
-                karma::domain, tag::eol, eol_generator>,
-            // eps(...)
-            meta_grammar::function1_rule<
-                karma::domain, tag::eps, semantic_predicate>,
-            // lazy(...)
-            meta_grammar::function1_rule<
-                karma::domain, tag::lazy, lazy_generator>,
-            // functor generators
-            meta_grammar::terminal_rule<
-                karma::domain, 
-                functor_holder<proto::_, proto::_>,
-                functor_director
-            >,
-            // confix("...", "...")[...]
-            meta_grammar::subscript_rule<
-                karma::domain, tag::confix_tag<proto::_, proto::_>, 
-                confix_director, main_meta_grammar
-            >
-        >
-    {
-    };
-
-    ///////////////////////////////////////////////////////////////////////////
-    //  These specializations non-intrusively hooks into the Karma meta-grammar.
-    //  (see karma/meta_grammar.hpp)
-    ///////////////////////////////////////////////////////////////////////////
-    template <typename Expr>
-    struct is_valid_expr<
-            Expr,
-            typename enable_if<
-                proto::matches<Expr, auxiliary_meta_grammar> 
-            >::type
-        >
-      : mpl::true_
-    {
-    };
-
-    template <typename Expr>
-    struct expr_transform<
-            Expr,
-            typename enable_if<
-                proto::matches<Expr, auxiliary_meta_grammar> 
-            >::type
-        >
-      : mpl::identity<auxiliary_meta_grammar>
-    {
-    };
-    
-}}}
-
-#endif
Deleted: trunk/boost/spirit/home/karma/auxiliary/none.hpp
==============================================================================
--- trunk/boost/spirit/home/karma/auxiliary/none.hpp	2009-04-26 10:42:24 EDT (Sun, 26 Apr 2009)
+++ (empty file)
@@ -1,42 +0,0 @@
-//  Copyright (c) 2001-2009 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_NONE_MARCH_26_2007_1227PM)
-#define BOOST_SPIRIT_KARMA_NONE_MARCH_26_2007_1227PM
-
-#include <boost/spirit/home/karma/domain.hpp>
-#include <boost/spirit/home/karma/delimit.hpp>
-#include <boost/spirit/home/support/unused.hpp>
-
-namespace boost { namespace spirit { namespace karma
-{
-    struct none
-    {
-        template <typename Component, typename Context, typename Unused>
-        struct attribute
-        {
-            typedef unused_type type;
-        };
-
-        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*/) 
-        {
-            karma::delimit(sink, d);           // always do post-delimiting 
-            return false;
-        }
-
-        template <typename Component, typename Context>
-        static std::string what(Component const& component, Context const& ctx)
-        {
-            return "none";
-        }
-    };
-
-}}}
-
-#endif
Modified: trunk/boost/spirit/home/karma/binary.hpp
==============================================================================
--- trunk/boost/spirit/home/karma/binary.hpp	(original)
+++ trunk/boost/spirit/home/karma/binary.hpp	2009-04-26 10:42:24 EDT (Sun, 26 Apr 2009)
@@ -12,6 +12,5 @@
 
 #include <boost/spirit/home/karma/binary/binary.hpp>
 #include <boost/spirit/home/karma/binary/padding.hpp>
-#include <boost/spirit/home/karma/binary/meta_grammar.hpp>
 
 #endif
Modified: trunk/boost/spirit/home/karma/binary/binary.hpp
==============================================================================
--- trunk/boost/spirit/home/karma/binary/binary.hpp	(original)
+++ trunk/boost/spirit/home/karma/binary/binary.hpp	2009-04-26 10:42:24 EDT (Sun, 26 Apr 2009)
@@ -10,15 +10,77 @@
 #pragma once      // MS compatible compilers support #pragma once
 #endif
 
-#include <boost/spirit/home/support/component.hpp>
-#include <boost/spirit/home/support/detail/integer/endian.hpp>
-#include <boost/spirit/home/support/attribute_of.hpp>
+#include <boost/spirit/home/support/common_terminals.hpp>
+#include <boost/spirit/home/support/info.hpp>
+#include <boost/spirit/home/support/detail/endian.hpp>
+
 #include <boost/spirit/home/karma/domain.hpp>
+#include <boost/spirit/home/karma/meta_compiler.hpp>
+#include <boost/spirit/home/karma/delimit_out.hpp>
+#include <boost/spirit/home/karma/auxiliary/lazy.hpp>
 #include <boost/spirit/home/karma/detail/generate_to.hpp>
-#include <boost/spirit/home/karma/delimit.hpp>
+#include <boost/spirit/home/support/unused.hpp>
+#include <boost/fusion/include/vector.hpp>
+#include <boost/fusion/include/at.hpp>
+#include <boost/mpl/or.hpp>
+#include <boost/type_traits/is_integral.hpp>
+#include <boost/type_traits/is_enum.hpp>
+
+///////////////////////////////////////////////////////////////////////////////
+#define BOOST_SPIRIT_ENABLE_BINARY(name)                                      \
+    template <>                                                               \
+    struct use_terminal<karma::domain, tag::name>                             \
+      : mpl::true_ {};                                                        \
+                                                                              \
+    template <typename A0>                                                    \
+    struct use_terminal<karma::domain                                         \
+        , terminal_ex<tag::name, fusion::vector1<A0> > >                      \
+      : mpl::or_<is_integral<A0>, is_enum<A0> > {};                           \
+                                                                              \
+    template <>                                                               \
+    struct use_lazy_terminal<karma::domain, tag::name, 1> : mpl::true_ {};    \
+                                                                              \
+/***/
+
+namespace boost { namespace spirit
+{
+    ///////////////////////////////////////////////////////////////////////////
+    // Enablers
+    ///////////////////////////////////////////////////////////////////////////
+
+    BOOST_SPIRIT_ENABLE_BINARY(byte_)                   // enables byte_
+    BOOST_SPIRIT_ENABLE_BINARY(word)                    // enables word
+    BOOST_SPIRIT_ENABLE_BINARY(big_word)                // enables big_word
+    BOOST_SPIRIT_ENABLE_BINARY(dword)                   // enables dword
+    BOOST_SPIRIT_ENABLE_BINARY(little_word)             // enables little_word
+    BOOST_SPIRIT_ENABLE_BINARY(big_dword)               // enables big_dword
+    BOOST_SPIRIT_ENABLE_BINARY(little_dword)            // enables little_dword
+#ifdef BOOST_HAS_LONG_LONG
+    BOOST_SPIRIT_ENABLE_BINARY(qword)                   // enables qword
+    BOOST_SPIRIT_ENABLE_BINARY(big_qword)               // enables big_qword
+    BOOST_SPIRIT_ENABLE_BINARY(little_qword)            // enables little_qword
+#endif
+
+}}
 
+#undef BOOST_SPIRIT_ENABLE_BINARY
+
+///////////////////////////////////////////////////////////////////////////////
 namespace boost { namespace spirit { namespace karma
 {
+    using boost::spirit::byte_;
+    using boost::spirit::word;
+    using boost::spirit::dword;
+    using boost::spirit::big_word;
+    using boost::spirit::big_dword;
+    using boost::spirit::little_word;
+    using boost::spirit::little_dword;
+#ifdef BOOST_HAS_LONG_LONG
+    using boost::spirit::qword;
+    using boost::spirit::big_qword;
+    using boost::spirit::little_qword;
+#endif
+
     namespace detail
     {
         template <int bits>
@@ -62,42 +124,42 @@
 #endif
 
         ///////////////////////////////////////////////////////////////////////
-        template <boost::integer::endianness bits>
+        template <BOOST_SCOPED_ENUM(boost::integer::endianness) bits>
         struct what;
 
         template <>
-        struct what<boost::integer::native>
+        struct what<boost::integer::endianness::native>
         {
-            static std::string is()
+            static info is()
             {
-                return "native-endian binary";
+                return info("native-endian binary");
             }
         };
 
         template <>
-        struct what<boost::integer::little>
+        struct what<boost::integer::endianness::little>
         {
-            static char const* is()
+            static info is()
             {
-                return "little-endian binary";
+                return info("little-endian binary");
             }
         };
 
         template <>
-        struct what<boost::integer::big>
+        struct what<boost::integer::endianness::big>
         {
-            static char const* is()
+            static info is()
             {
-                return "big-endian binary";
+                return info("big-endian binary");
             }
         };
     }
 
     ///////////////////////////////////////////////////////////////////////////
-    template <integer::endianness endian, int bits>
-    struct any_binary_director
+    template <BOOST_SCOPED_ENUM(boost::integer::endianness) endian, int bits>
+    struct any_binary_generator
     {
-        template <typename Component, typename Context, typename Unused>
+        template <typename Context, typename Unused>
         struct attribute
         {
             typedef boost::integer::endian<
@@ -105,81 +167,162 @@
             > type;
         };
 
-        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)
-        {
-            typename traits::attribute_of<
-                karma::domain, Component, Context>::type p (param);
+        template <
+            typename OutputIterator, typename Context, typename Delimiter
+          , typename Attribute>
+        static bool generate(OutputIterator& sink, Context&, Delimiter const& d
+          , Attribute const& attr)
+        {
+            // Even if the endian types are not pod's (at least not in the
+            // definition of C++03) it seems to be safe to assume they are.
+            // This allows us to treat them as a sequence of consecutive bytes.
+            typename attribute<Context, unused_type>::type p; 
+            p = attr;
             unsigned char const* bytes =
                 reinterpret_cast<unsigned char const*>(&p);
 
-            for (unsigned int i = 0; i < sizeof(p); ++i)
-                detail::generate_to(sink, *bytes++);
-
-            karma::delimit(sink, d);           // always do post-delimiting
-            return true;
+            for (unsigned int i = 0; i < sizeof(p); ++i) 
+            {
+                if (!detail::generate_to(sink, *bytes++))
+                    return false;
+            }
+            return karma::delimit_out(sink, d);     // always do post-delimiting
         }
 
         // this any_byte_director has no parameter attached, it needs to have
         // been initialized from a direct literal
-        template <typename Component, typename OutputIterator,
-            typename Context, typename Delimiter>
-        static bool
-        generate(Component const&, OutputIterator&, Context&, Delimiter const&,
-            unused_type)
+        template <
+            typename OutputIterator, typename Context, typename Delimiter>
+        static bool generate(OutputIterator& sink, Context&, Delimiter const& d
+          , unused_type)
         {
             BOOST_MPL_ASSERT_MSG(false,
                 binary_generator_not_usable_without_attribute, ());
             return false;
         }
 
-        template <typename Component, typename Context>
-        static std::string what(Component const& component, Context const& ctx)
+        template <typename Context>
+        static info what(Context const& ctx)
         {
             return karma::detail::what<endian>::is();
         }
     };
 
     ///////////////////////////////////////////////////////////////////////////
-    template <integer::endianness endian, int bits>
-    struct binary_lit_director
+    template <BOOST_SCOPED_ENUM(boost::integer::endianness) endian, int bits
+      , bool no_attribute>
+    struct literal_binary_generator
     {
-        template <typename Component, typename Context, typename Unused>
+        typedef boost::integer::endian<
+            endian, typename karma::detail::integer<bits>::type, bits
+        > data_type;
+
+        template <typename Context, typename Unused>
         struct attribute
         {
-            typedef unused_type type;
+            typedef typename mpl::if_c<
+                no_attribute, unused_type, data_type>::type
+            type;
         };
 
-        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*/)
+        template <typename T>
+        literal_binary_generator(T const& t)
         {
-            boost::integer::endian<
-                endian, typename karma::detail::integer<bits>::type, bits
-            > p (fusion::at_c<0>(component.elements));
+            data_ = t;
+        }
 
+        template <
+            typename OutputIterator, typename Context, typename Delimiter
+          , typename Attribute>
+        bool generate(OutputIterator& sink, Context&, Delimiter const& d
+          , Attribute const& attr) const
+        {
+            // Even if the endian types are not pod's (at least not in the
+            // definition of C++03) it seems to be safe to assume they are
+            // (but in C++0x the endian types _are_ PODs).
+            // This allows us to treat them as a sequence of consecutive bytes.
             unsigned char const* bytes =
-                reinterpret_cast<unsigned char const*>(&p);
+                reinterpret_cast<unsigned char const*>(&data_);
 
-            for (unsigned int i = 0; i < sizeof(p); ++i)
-                detail::generate_to(sink, *bytes++);
-
-            karma::delimit(sink, d);           // always do post-delimiting
-            return true;
+            for (unsigned int i = 0; i < sizeof(data_type); ++i)
+            {
+                if (!detail::generate_to(sink, *bytes++))
+                    return false;
+            }
+            return karma::delimit_out(sink, d);  // always do post-delimiting
         }
 
-        template <typename Component, typename Context>
-        static std::string what(Component const& component, Context const& ctx)
+        template <typename Context>
+        static info what(Context const& ctx)
         {
             return karma::detail::what<endian>::is();
         }
+
+        data_type data_;
     };
 
+    ///////////////////////////////////////////////////////////////////////////
+    // Generator generators: make_xxx function (objects)
+    ///////////////////////////////////////////////////////////////////////////
+    namespace detail
+    {
+        template <BOOST_SCOPED_ENUM(boost::integer::endianness) endian
+          , int bits>
+        struct basic_binary
+        {
+            typedef any_binary_generator<endian, bits> result_type;
+
+            result_type operator()(unused_type, unused_type) const
+            {
+                return result_type();
+            }
+        };
+
+        template <typename Modifiers
+          , BOOST_SCOPED_ENUM(boost::integer::endianness) endian, int bits>
+        struct basic_binary_literal
+        {
+            static bool const no_attr =
+                !has_modifier<Modifiers, tag::lazy_eval>::value;
+
+            typedef literal_binary_generator<endian, bits, no_attr> result_type;
+
+            template <typename Terminal>
+            result_type operator()(Terminal const& term, unused_type) const
+            {
+                return result_type(fusion::at_c<0>(term.args));
+            }
+        };
+    }
+
+#define BOOST_SPIRIT_MAKE_BINARY_PRIMITIVE(name, endian, bits)                \
+    template <typename Modifiers>                                             \
+    struct make_primitive<tag::name, Modifiers>                               \
+      : detail::basic_binary<boost::integer::endianness::endian, bits> {};    \
+                                                                              \
+    template <typename Modifiers, typename A0>                                \
+    struct make_primitive<terminal_ex<tag::name, fusion::vector1<A0> >        \
+          , Modifiers>                                                        \
+      : detail::basic_binary_literal<Modifiers                                \
+        , boost::integer::endianness::endian, bits> {};                       \
+                                                                              \
+    /***/
+
+    BOOST_SPIRIT_MAKE_BINARY_PRIMITIVE(byte_, native, 8)
+    BOOST_SPIRIT_MAKE_BINARY_PRIMITIVE(word, native, 16)
+    BOOST_SPIRIT_MAKE_BINARY_PRIMITIVE(dword, native, 32)
+    BOOST_SPIRIT_MAKE_BINARY_PRIMITIVE(big_word, big, 16)
+    BOOST_SPIRIT_MAKE_BINARY_PRIMITIVE(big_dword, big, 32)
+    BOOST_SPIRIT_MAKE_BINARY_PRIMITIVE(little_word, little, 16)
+    BOOST_SPIRIT_MAKE_BINARY_PRIMITIVE(little_dword, little, 32)
+#ifdef BOOST_HAS_LONG_LONG
+    BOOST_SPIRIT_MAKE_BINARY_PRIMITIVE(qword, native, 64)
+    BOOST_SPIRIT_MAKE_BINARY_PRIMITIVE(big_qword, big, 64)
+    BOOST_SPIRIT_MAKE_BINARY_PRIMITIVE(little_qword, little, 64)
+#endif
+
+#undef BOOST_SPIRIT_MAKE_BINARY_PRIMITIVE
+
 }}}
 
 #endif
Deleted: trunk/boost/spirit/home/karma/binary/meta_grammar.hpp
==============================================================================
--- trunk/boost/spirit/home/karma/binary/meta_grammar.hpp	2009-04-26 10:42:24 EDT (Sun, 26 Apr 2009)
+++ (empty file)
@@ -1,264 +0,0 @@
-//  Copyright (c) 2001-2009 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_META_GRAMMAR_MAY_04_2007_0853AM)
-#define BOOST_SPIRIT_KARMA_META_GRAMMAR_MAY_04_2007_0853AM
-
-#if defined(_MSC_VER) && (_MSC_VER >= 1020)
-#pragma once      // MS compatible compilers support #pragma once
-#endif
-
-#include <boost/spirit/home/karma/domain.hpp>
-#include <boost/spirit/home/support/placeholders.hpp>
-#include <boost/spirit/home/support/meta_grammar.hpp>
-#include <boost/spirit/home/support/detail/integer/endian.hpp>
-#include <boost/mpl/identity.hpp>
-#include <boost/mpl/bool.hpp>
-#include <boost/utility/enable_if.hpp>
-
-namespace boost { namespace spirit { namespace karma
-{
-    ///////////////////////////////////////////////////////////////////////////
-    // forwards
-    /////////////////////////////////////////////////////////////////////////// 
-    template <integer::endianness endian, int bits>
-    struct any_binary_director;
-    
-    template <integer::endianness endian, int bits>
-    struct binary_lit_director;
-
-    struct binary_padding_director;
-    
-    struct main_meta_grammar;
-
-    template <typename Expr, typename Enable>
-    struct is_valid_expr;
-
-    template <typename Expr, typename Enable>
-    struct expr_transform;
-
-    ///////////////////////////////////////////////////////////////////////////
-    // get the director of an integer based binary literal type
-    ///////////////////////////////////////////////////////////////////////////
-    template <typename T>
-    struct extract_literal_bin_director
-    {
-        typedef binary_lit_director<
-            boost::integer::native, sizeof(T)*CHAR_BIT
-        > type;
-    };
-
-    ///////////////////////////////////////////////////////////////////////////
-    // get the director of a binary tag
-    ///////////////////////////////////////////////////////////////////////////
-    template <typename Tag>
-    struct extract_binary_director;
-
-    // native endian binaries
-    template <>
-    struct extract_binary_director<tag::byte>    
-    {
-        typedef any_binary_director<boost::integer::native, 8> type;
-    };
-
-    template <>
-    struct extract_binary_director<tag::word>    
-    {
-        typedef any_binary_director<boost::integer::native, 16> type;
-    };
-
-    template <>
-    struct extract_binary_director<tag::dword>    
-    {
-        typedef any_binary_director<boost::integer::native, 32> type;
-    };
-
-    // big endian binaries
-    template <>
-    struct extract_binary_director<tag::big_word>    
-    {
-        typedef any_binary_director<boost::integer::big, 16> type;
-    };
-
-    template <>
-    struct extract_binary_director<tag::big_dword>    
-    {
-        typedef any_binary_director<boost::integer::big, 32> type;
-    };
-
-    // little endian binaries
-    template <>
-    struct extract_binary_director<tag::little_word>    
-    {
-        typedef any_binary_director<boost::integer::little, 16> type;
-    };
-
-    template <>
-    struct extract_binary_director<tag::little_dword>    
-    {
-        typedef any_binary_director<boost::integer::little, 32> type;
-    };
-
-#ifdef BOOST_HAS_LONG_LONG
-    template <>
-    struct extract_binary_director<tag::qword>    
-    {
-        typedef any_binary_director<boost::integer::native, 64> type;
-    };
-
-    template <>
-    struct extract_binary_director<tag::big_qword>    
-    {
-        typedef any_binary_director<boost::integer::big, 64> type;
-    };
-
-    template <>
-    struct extract_binary_director<tag::little_qword>    
-    {
-        typedef any_binary_director<boost::integer::little, 64> type;
-    };
-#endif
-
-    ///////////////////////////////////////////////////////////////////////////
-    // get the director of a binary literal tag
-    ///////////////////////////////////////////////////////////////////////////
-    template <typename Tag, typename T>
-    struct extract_binary_lit_director;
-
-    // native endian binaries
-    template <typename T>
-    struct extract_binary_lit_director<tag::byte, T>    
-    {
-        typedef binary_lit_director<boost::integer::native, 8> type;
-    };
-
-    template <typename T>
-    struct extract_binary_lit_director<tag::word, T>    
-    {
-        typedef binary_lit_director<boost::integer::native, 16> type;
-    };
-
-    template <typename T>
-    struct extract_binary_lit_director<tag::dword, T>    
-    {
-        typedef binary_lit_director<boost::integer::native, 32> type;
-    };
-
-    // big endian binaries
-    template <typename T>
-    struct extract_binary_lit_director<tag::big_word, T>    
-    {
-        typedef binary_lit_director<boost::integer::big, 16> type;
-    };
-
-    template <typename T>
-    struct extract_binary_lit_director<tag::big_dword, T>    
-    {
-        typedef binary_lit_director<boost::integer::big, 32> type;
-    };
-
-    // little endian binaries
-    template <typename T>
-    struct extract_binary_lit_director<tag::little_word, T>    
-    {
-        typedef binary_lit_director<boost::integer::little, 16> type;
-    };
-
-    template <typename T>
-    struct extract_binary_lit_director<tag::little_dword, T>    
-    {
-        typedef binary_lit_director<boost::integer::little, 32> type;
-    };
-
-#ifdef BOOST_HAS_LONG_LONG
-    template <typename T>
-    struct extract_binary_lit_director<tag::qword, T>    
-    {
-        typedef binary_lit_director<boost::integer::native, 64> type;
-    };
-
-    template <typename T>
-    struct extract_binary_lit_director<tag::big_qword, T>    
-    {
-        typedef binary_lit_director<boost::integer::big, 64> type;
-    };
-
-    template <typename T>
-    struct extract_binary_lit_director<tag::little_qword, T>    
-    {
-        typedef binary_lit_director<boost::integer::little, 64> type;
-    };
-#endif
-
-    ///////////////////////////////////////////////////////////////////////////
-    // binary meta-grammar
-    ///////////////////////////////////////////////////////////////////////////
-    // literals: 10, 10L, 10LL
-    struct int_binary_meta_grammar
-      : meta_grammar::compose_empty<
-            proto::if_<
-                is_int_lit_tag<proto::_child, karma::domain>()
-            >,
-            karma::domain,
-            mpl::identity<extract_literal_bin_director<mpl::_> >
-        >
-    {
-    };
-
-    struct binary_meta_grammar  
-      : proto::or_<
-            meta_grammar::compose_empty<
-                proto::if_<
-                    is_binary_tag<proto::_child, karma::domain>()
-                >,
-                karma::domain, 
-                mpl::identity<extract_binary_director<mpl::_> > 
-            >,
-            meta_grammar::compose_function1_eval<
-                proto::function<
-                    proto::if_<
-                        is_binary_tag<proto::_child, karma::domain>()
-                    >,
-                    int_binary_meta_grammar
-                >,
-                karma::domain,
-                mpl::identity<extract_binary_lit_director<mpl::_, mpl::_> >
-            >,
-            meta_grammar::function1_rule<
-                karma::domain, tag::pad, binary_padding_director
-            >
-        >
-    {
-    };
-
-    ///////////////////////////////////////////////////////////////////////////
-    //  These specializations non-intrusively hooks into the Karma meta-grammar.
-    //  (see karma/meta_grammar.hpp)
-    ///////////////////////////////////////////////////////////////////////////
-    template <typename Expr>
-    struct is_valid_expr<
-            Expr,
-            typename enable_if<
-                proto::matches<Expr, binary_meta_grammar> 
-            >::type
-        >
-      : mpl::true_
-    {
-    };
-
-    template <typename Expr>
-    struct expr_transform<
-            Expr,
-            typename enable_if<
-                proto::matches<Expr, binary_meta_grammar> 
-            >::type
-        >
-      : mpl::identity<binary_meta_grammar>
-    {
-    };
-    
-}}}
-
-#endif
Modified: trunk/boost/spirit/home/karma/binary/padding.hpp
==============================================================================
--- trunk/boost/spirit/home/karma/binary/padding.hpp	(original)
+++ trunk/boost/spirit/home/karma/binary/padding.hpp	2009-04-26 10:42:24 EDT (Sun, 26 Apr 2009)
@@ -6,51 +6,98 @@
 #if !defined(BOOST_SPIRIT_KARMA_PADDING_MAY_06_2008_0436PM)
 #define BOOST_SPIRIT_KARMA_PADDING_MAY_06_2008_0436PM
 
-#include <boost/lexical_cast.hpp>
+#include <boost/spirit/home/support/common_terminals.hpp>
+#include <boost/spirit/home/support/info.hpp>
 
 #include <boost/spirit/home/karma/domain.hpp>
-#include <boost/spirit/home/karma/delimit.hpp>
+#include <boost/spirit/home/karma/meta_compiler.hpp>
+#include <boost/spirit/home/karma/delimit_out.hpp>
+#include <boost/spirit/home/karma/auxiliary/lazy.hpp>
+#include <boost/spirit/home/karma/detail/generate_to.hpp>
 #include <boost/spirit/home/support/unused.hpp>
 #include <boost/fusion/include/at.hpp>
-#include <boost/spirit/home/karma/detail/generate_to.hpp>
+#include <boost/fusion/include/vector.hpp>
+
+///////////////////////////////////////////////////////////////////////////////
+namespace boost { namespace spirit
+{
+    ///////////////////////////////////////////////////////////////////////////
+    // Enablers
+    ///////////////////////////////////////////////////////////////////////////
+
+    // enables pad(...)
+    template <typename A0>
+    struct use_terminal<karma::domain
+        , terminal_ex<tag::pad, fusion::vector1<A0> > > 
+      : mpl::true_ {};
+
+    // enables lazy pad(...)
+    template <>
+    struct use_lazy_terminal<karma::domain, tag::pad, 1>
+      : mpl::true_ {};
 
+}}
+
+///////////////////////////////////////////////////////////////////////////////
 namespace boost { namespace spirit { namespace karma
 {
-    struct binary_padding_director
+    using boost::spirit::pad;
+    using boost::spirit::pad_type;
+
+    struct binary_padding_generator
     {
-        template <typename Component, typename Context, typename Unused>
+        template <typename Context, typename Unused>
         struct attribute
         {
             typedef unused_type type;
         };
 
-        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&) 
+        binary_padding_generator(int numpadbytes)
+          : numpadbytes_(numpadbytes)
+        {}
+
+        template <
+            typename OutputIterator, typename Context, typename Delimiter
+          , typename Attribute>
+        bool generate(OutputIterator& sink, Context&, Delimiter const& d
+          , Attribute const& attr) const
         {
-            std::size_t padbytes = fusion::at_c<0>(component.elements);
-            std::size_t count = sink.get_out_count() % padbytes;
-            
+            std::size_t count = sink.get_out_count() % numpadbytes_;
             if (count)
-                count = padbytes - count;
-                
+                count = numpadbytes_ - count;
+
             bool result = true;
             while (result && count-- != 0)
                 result = detail::generate_to(sink, 0);
 
-            karma::delimit(sink, d);      // always do post-delimiting
+            if (result)
+                result = karma::delimit_out(sink, d);  // always do post-delimiting
             return result;
         }
 
-        template <typename Component, typename Context>
-        static std::string what(Component const& component, Context const& ctx)
+        template <typename Context>
+        static info what(Context const& ctx)
+        {
+            return info("pad");
+        }
+
+        int numpadbytes_;
+    };
+
+    ///////////////////////////////////////////////////////////////////////////
+    // Generator generators: make_xxx function (objects)
+    ///////////////////////////////////////////////////////////////////////////
+    template <typename Modifiers, typename A0>
+    struct make_primitive<
+        terminal_ex<tag::pad, fusion::vector1<A0> >
+      , Modifiers>
+    {
+        typedef binary_padding_generator result_type;
+
+        template <typename Terminal>
+        result_type operator()(Terminal const& term, unused_type) const
         {
-            return std::string("pad(") +
-                boost::lexical_cast<std::string>(
-                    fusion::at_c<0>(component.elements)) +
-                ")";
+            return result_type(fusion::at_c<0>(term.args));
         }
     };
 
Modified: trunk/boost/spirit/home/karma/char.hpp
==============================================================================
--- trunk/boost/spirit/home/karma/char.hpp	(original)
+++ trunk/boost/spirit/home/karma/char.hpp	2009-04-26 10:42:24 EDT (Sun, 26 Apr 2009)
@@ -12,6 +12,5 @@
 
 #include <boost/spirit/home/karma/char/char.hpp>
 #include <boost/spirit/home/karma/char/space.hpp>
-#include <boost/spirit/home/karma/char/meta_grammar.hpp>
 
 #endif
Modified: trunk/boost/spirit/home/karma/char/char.hpp
==============================================================================
--- trunk/boost/spirit/home/karma/char/char.hpp	(original)
+++ trunk/boost/spirit/home/karma/char/char.hpp	2009-04-26 10:42:24 EDT (Sun, 26 Apr 2009)
@@ -10,22 +10,74 @@
 #pragma once      // MS compatible compilers support #pragma once
 #endif
 
+#include <boost/spirit/home/support/common_terminals.hpp>
+#include <boost/spirit/home/support/string_traits.hpp>
+#include <boost/spirit/home/support/info.hpp>
+#include <boost/spirit/home/support/char_class.hpp>
+#include <boost/spirit/home/support/detail/get_encoding.hpp>
 #include <boost/spirit/home/karma/domain.hpp>
-#include <boost/spirit/home/karma/delimit.hpp>
+#include <boost/spirit/home/karma/meta_compiler.hpp>
+#include <boost/spirit/home/karma/delimit_out.hpp>
+#include <boost/spirit/home/karma/auxiliary/lazy.hpp>
+#include <boost/spirit/home/karma/detail/get_casetag.hpp>
 #include <boost/spirit/home/karma/detail/generate_to.hpp>
-#include <boost/spirit/home/support/modifier.hpp>
-#include <boost/spirit/home/support/char_class.hpp>
-#include <boost/spirit/home/support/detail/to_narrow.hpp>
-#include <boost/spirit/home/support/iso8859_1.hpp>
-#include <boost/spirit/home/support/ascii.hpp>
 #include <boost/fusion/include/at.hpp>
-#include <boost/fusion/include/value_at.hpp>
 #include <boost/fusion/include/vector.hpp>
 #include <boost/fusion/include/cons.hpp>
-#include <boost/utility/enable_if.hpp>
+#include <boost/mpl/if.hpp>
+#include <boost/mpl/assert.hpp>
+#include <boost/mpl/bool.hpp>
+#include <string>
+
+///////////////////////////////////////////////////////////////////////////////
+namespace boost { namespace spirit
+{
+    ///////////////////////////////////////////////////////////////////////////
+    // Enablers
+    ///////////////////////////////////////////////////////////////////////////
+    template <typename CharEncoding>
+    struct use_terminal<karma::domain
+      , tag::char_code<tag::char_, CharEncoding>        // enables char_
+    > : mpl::true_ {};
+
+    template <typename CharEncoding, typename A0>
+    struct use_terminal<karma::domain
+      , terminal_ex<
+            tag::char_code<tag::char_, CharEncoding>    // enables char_('x'), char_("x")
+          , fusion::vector1<A0>
+        >
+    > : mpl::true_ {};
+
+    template <typename CharEncoding>                    // enables *lazy* char_('x'), char_("x")
+    struct use_lazy_terminal<
+        karma::domain
+      , tag::char_code<tag::char_, CharEncoding>
+      , 1 // arity
+    > : mpl::true_ {};
+
+    template <>
+    struct use_terminal<karma::domain, char>            // enables 'x'
+      : mpl::true_ {};
+
+    template <>
+    struct use_terminal<karma::domain, char[2]>         // enables "x"
+      : mpl::true_ {};
+
+    template <>
+    struct use_terminal<karma::domain, wchar_t>         // enables L'x'
+      : mpl::true_ {};
+
+    template <>
+    struct use_terminal<karma::domain, wchar_t[2]>      // enables L"x"
+      : mpl::true_ {};
+
+}}
 
+///////////////////////////////////////////////////////////////////////////////
 namespace boost { namespace spirit { namespace karma
 {
+    using spirit::lit;    // lit('x') is equivalent to 'x'
+
     ///////////////////////////////////////////////////////////////////////////
     //
     //  any_char
@@ -34,43 +86,49 @@
     //      Note: this generator has to have an associated parameter
     //
     ///////////////////////////////////////////////////////////////////////////
-    template <typename Char>
+    template <typename CharEncoding, typename Tag>
     struct any_char
+      : primitive_generator<any_char<CharEncoding, Tag> >
     {
-        template <typename Component, typename Context, typename Unused>
+        typedef typename CharEncoding::char_type char_type;
+        typedef CharEncoding char_encoding;
+
+        template <typename Context, typename Unused>
         struct attribute
         {
-            typedef Char type;
+            typedef char_type type;
         };
 
-        // any_char has a parameter attached
-        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)
-        {
-            detail::generate_to(sink, param);
-            karma::delimit(sink, d);           // always do post-delimiting
-            return true;
+        // any_char has an attached parameter
+        template <
+            typename OutputIterator, typename Context, typename Delimiter
+          , typename Attribute>
+        static bool generate(OutputIterator& sink, Context&, Delimiter const& d
+          , Attribute const& attr)
+        {
+            return 
+                karma::detail::generate_to(sink, attr, char_encoding(), Tag()) &&
+                karma::delimit_out(sink, d);       // always do post-delimiting
         }
 
-        // this any_char has no parameter attached, it needs to have been
+        // any_char has no attribute attached, it needs to have been
         // initialized from a direct literal
-        template <typename Component, typename OutputIterator,
-            typename Context, typename Delimiter>
-        static bool
-        generate(Component const&, OutputIterator&, Context&, Delimiter const&,
-            unused_type)
-        {
+        template <typename OutputIterator, typename Context, typename Delimiter>
+        static bool generate(OutputIterator&, Context&, Delimiter const&, 
+            unused_type const&)
+        {
+            // It is not possible (doesn't make sense) to use char_ without
+            // providing any attribute, as the generator doesn't 'know' what
+            // character to output. The following assertion fires if this
+            // situation is detected in your code.
             BOOST_MPL_ASSERT_MSG(false, char__not_usable_without_attribute, ());
             return false;
         }
 
-        template <typename Component, typename Context>
-        static std::string what(Component const& component, Context const& ctx)
+        template <typename Context>
+        static info what(Context const& ctx)
         {
-            return "any-char";
+            return info("any-char");
         }
     };
 
@@ -81,243 +139,183 @@
     //      from
     //
     ///////////////////////////////////////////////////////////////////////////
-    template <typename Char>
+    template <typename CharEncoding, typename Tag, bool no_attribute>
     struct literal_char
+      : primitive_generator<literal_char<CharEncoding, Tag, no_attribute> >
     {
-        template <typename Component, typename Context, typename Unused>
-        struct attribute
-        {
-            typedef unused_type type;
-        };
+        typedef typename CharEncoding::char_type char_type;
+        typedef CharEncoding char_encoding;
 
-        // any_char has a parameter attached
-        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*/)
-        {
-            detail::generate_to(sink, fusion::at_c<0>(component.elements));
-            karma::delimit(sink, d);             // always do post-delimiting
-            return true;
-        }
+        literal_char(char_type ch)
+          : ch (spirit::char_class::convert<char_encoding>::to(Tag(), ch)) 
+        {}
 
-        template <typename Component, typename Context>
-        static std::string what(Component const& component, Context const& ctx)
-        {
-            return std::string("'")
-                + spirit::detail::to_narrow_char(
-                    fusion::at_c<0>(component.elements))
-                + '\'';
-        }
-    };
-
-    ///////////////////////////////////////////////////////////////////////////
-    //
-    //  lazy_char
-    //      generates a single character given by a functor it was initialized
-    //      from
-    //
-    ///////////////////////////////////////////////////////////////////////////
-    struct lazy_char
-    {
-        template <typename Component, typename Context, typename Unused>
+        template <typename Context, typename Unused>
         struct attribute
         {
-            typedef unused_type type;
+            typedef typename mpl::if_c<
+                no_attribute, unused_type, char_type>::type
+            type;
         };
 
-        // any_char has a parameter attached
-        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*/)
-        {
-            detail::generate_to(sink,
-                fusion::at_c<0>(component.elements)(unused, ctx));
-            karma::delimit(sink, d);             // always do post-delimiting
-            return true;
+        template <
+            typename OutputIterator, typename Context, typename Delimiter
+          , typename Attribute>
+        bool generate(OutputIterator& sink, Context&, Delimiter const& d
+          , Attribute const&) const
+        {
+            return karma::detail::generate_to(sink, ch) &&
+                   karma::delimit_out(sink, d);    // always do post-delimiting
         }
 
-        template <typename Component, typename Context>
-        static std::string what(Component const& component, Context const& ctx)
+        template <typename Context>
+        info what(Context const& ctx) const
         {
-            return "char";
+            return info("literal-char", char_encoding::toucs4(ch));
         }
+
+        char_type ch;
     };
 
     ///////////////////////////////////////////////////////////////////////////
-    //
-    //  lower and upper case variants of any_char with an associated parameter
-    //      note: this generator has to have a parameter associated
-    //
+    // Generator generators: make_xxx function (objects)
     ///////////////////////////////////////////////////////////////////////////
-    template <typename Char, typename Tag>
-    struct case_any_char
+    namespace detail
     {
-        template <typename Component, typename Context, typename Unused>
-        struct attribute
+        template <typename Modifiers, typename Encoding>
+        struct basic_literal
         {
-            typedef Char type;
+            static bool const lower =
+                has_modifier<Modifiers, tag::char_code_base<tag::lower> >::value;
+
+            static bool const upper =
+                has_modifier<Modifiers, tag::char_code_base<tag::upper> >::value;
+
+            static bool const no_attr =
+                !has_modifier<Modifiers, tag::lazy_eval>::value;
+
+            typedef literal_char<
+                typename spirit::detail::get_encoding<
+                    Modifiers, Encoding, lower || upper>::type
+              , typename get_casetag<Modifiers, lower || upper>::type
+              , no_attr>
+            result_type;
+
+            template <typename Char>
+            result_type operator()(Char ch, unused_type) const
+            {
+                return result_type(ch);
+            }
+
+            template <typename Char>
+            result_type operator()(Char const* str, unused_type) const
+            {
+                return result_type(str[0]);
+            }
         };
+    }
 
-        typedef typename Tag::char_set char_set;
-        typedef typename Tag::char_class char_class_;
+    // literals: 'x', "x"
+    template <typename Modifiers>
+    struct make_primitive<char, Modifiers>
+      : detail::basic_literal<Modifiers, char_encoding::standard> {};
+
+    template <typename Modifiers>
+    struct make_primitive<char const(&)[2], Modifiers>
+      : detail::basic_literal<Modifiers, char_encoding::standard> {};
+
+    // literals: L'x', L"x"
+    template <typename Modifiers>
+    struct make_primitive<wchar_t, Modifiers>
+      : detail::basic_literal<Modifiers, char_encoding::standard_wide> {};
+
+    template <typename Modifiers>
+    struct make_primitive<wchar_t const(&)[2], Modifiers>
+      : detail::basic_literal<Modifiers, char_encoding::standard_wide> {};
+
+    // char_
+    template <typename CharEncoding, typename Modifiers>
+    struct make_primitive<tag::char_code<tag::char_, CharEncoding>, Modifiers>
+    {
+        static bool const lower =
+            has_modifier<Modifiers, tag::char_code<tag::lower, CharEncoding> >::value;
 
-        // case_any_char has a parameter attached
-        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)
-        {
-            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
-            return true;
-        }
+        static bool const upper =
+            has_modifier<Modifiers, tag::char_code<tag::upper, CharEncoding> >::value;
 
-        // this case_any_char has no parameter attached, it needs to have been
-        // initialized from a direct literal
-        template <typename Component, typename OutputIterator,
-            typename Context, typename Delimiter>
-        static bool
-        generate(Component const&, OutputIterator&, Context&, Delimiter const&,
-            unused_type)
-        {
-            BOOST_MPL_ASSERT_MSG(false, char__not_usable_without_attribute, ());
-            return false;
-        }
+        typedef any_char<
+            typename spirit::detail::get_encoding<
+                Modifiers, CharEncoding, lower || upper>::type
+          , typename detail::get_casetag<Modifiers, lower || upper>::type
+        > result_type;
 
-        template <typename Component, typename Context>
-        static std::string what(Component const& component, Context const& ctx)
+        result_type operator()(unused_type, unused_type) const
         {
-            std::string result;
-            result = std::string("any-") +
-                spirit::char_class::what<char_set>::is(char_class_()) +
-                "case-char";
-            return result;
+            return result_type();
         }
     };
 
-}}}  // namespace boost::spirit::karma
-
-namespace boost { namespace spirit { namespace traits
-{
-    ///////////////////////////////////////////////////////////////////////////
-    // lower_case and upper_case any_char and literal_char generators
-    ///////////////////////////////////////////////////////////////////////////
-    template <typename Domain, typename Elements, typename Modifier,
-        typename Char>
-    struct make_modified_component<
-        Domain, karma::literal_char<Char>, Elements, Modifier,
-        typename enable_if<
-            is_member_of_modifier<Modifier, spirit::char_class::lower_case_base_tag>
-        >::type
-    >
+    // char_(...)
+    template <typename CharEncoding, typename Modifiers, typename A0>
+    struct make_primitive<
+        terminal_ex<
+            tag::char_code<tag::char_, CharEncoding>
+          , fusion::vector1<A0>
+        >
+      , Modifiers>
     {
-        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>
-        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);
-        }
-    };
+        static bool const lower =
+            has_modifier<Modifiers, tag::char_code<tag::lower, CharEncoding> >::value;
 
-    template <typename Domain, typename Elements, typename Modifier,
-        typename Char>
-    struct make_modified_component<
-        Domain, karma::literal_char<Char>, Elements, Modifier,
-        typename enable_if<
-            is_member_of_modifier<Modifier, spirit::char_class::upper_case_base_tag>
-        >::type
-    >
-    {
-        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>
-        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);
-        }
-    };
+        static bool const upper =
+            has_modifier<Modifiers, tag::char_code<tag::upper, CharEncoding> >::value;
 
-    ///////////////////////////////////////////////////////////////////////////
-    // lower_case and upper case_any_char conversions
-    ///////////////////////////////////////////////////////////////////////////
-    template <typename Domain, typename Elements, typename Modifier,
-        typename Char>
-    struct make_modified_component<
-        Domain, karma::any_char<Char>, Elements, Modifier,
-        typename enable_if<
-            is_member_of_modifier<Modifier, spirit::char_class::lower_case_base_tag>
-        >::type
-    >
-    {
-        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>
-        type;
+        static bool const no_attr =
+            !has_modifier<Modifiers, tag::lazy_eval>::value;
+
+        typedef literal_char<
+            typename spirit::detail::get_encoding<
+                Modifiers, CharEncoding, lower || upper>::type
+          , typename detail::get_casetag<Modifiers, lower || upper>::type
+          , no_attr
+        > result_type;
 
-        static type
-        call(Elements const&)
+        template <typename Terminal>
+        result_type operator()(Terminal const& term, unused_type) const
         {
-            return type(fusion::nil());
+            return result_type(fusion::at_c<0>(term.args));
         }
     };
 
-    template <typename Domain, typename Elements, typename Modifier,
-        typename Char>
-    struct make_modified_component<
-        Domain, karma::any_char<Char>, Elements, Modifier,
-        typename enable_if<
-            is_member_of_modifier<Modifier, spirit::char_class::upper_case_base_tag>
-        >::type
-    >
+    // char_("x")
+    template <typename CharEncoding, typename Modifiers, typename Char>
+    struct make_primitive<
+        terminal_ex<
+            tag::char_code<tag::char_, CharEncoding>
+          , fusion::vector1<Char(&)[2]> // For single char strings
+        >
+      , Modifiers>
     {
-        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>
-        type;
+        static bool const lower =
+            has_modifier<Modifiers, tag::char_code<tag::lower, CharEncoding> >::value;
 
-        static type
-        call(Elements const&)
+        static bool const upper =
+            has_modifier<Modifiers, tag::char_code<tag::upper, CharEncoding> >::value;
+
+        typedef literal_char<
+            typename spirit::detail::get_encoding<
+                Modifiers, CharEncoding, lower || upper>::type
+          , typename detail::get_casetag<Modifiers, lower || upper>::type
+          , false
+        > result_type;
+
+        template <typename Terminal>
+        result_type operator()(Terminal const& term, unused_type) const
         {
-            return type(fusion::nil());
+            return result_type(fusion::at_c<0>(term.args)[0]);
         }
     };
 
-}}}   // namespace boost::spirit::traits
+}}}   // namespace boost::spirit::karma
 
-#endif // !defined(BOOST_SPIRIT_KARMA_CHAR_FEB_21_2007_0543PM)
+#endif
Deleted: trunk/boost/spirit/home/karma/char/meta_grammar.hpp
==============================================================================
--- trunk/boost/spirit/home/karma/char/meta_grammar.hpp	2009-04-26 10:42:24 EDT (Sun, 26 Apr 2009)
+++ (empty file)
@@ -1,230 +0,0 @@
-//  Copyright (c) 2001-2007 Joel de Guzman
-//  Copyright (c) 2001-2009 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_META_GRAMMAR_FEB_21_2007_0742AM)
-#define BOOST_SPIRIT_KARMA_META_GRAMMAR_FEB_21_2007_0742AM
-
-#if defined(_MSC_VER) && (_MSC_VER >= 1020)
-#pragma once      // MS compatible compilers support #pragma once
-#endif
-
-#include <boost/spirit/home/karma/domain.hpp>
-#include <boost/spirit/home/support/placeholders.hpp>
-#include <boost/spirit/home/support/meta_grammar.hpp>
-#include <boost/spirit/home/support/char_class.hpp>
-#include <boost/utility/enable_if.hpp>
-#include <boost/mpl/bool.hpp>
-
-namespace boost { namespace spirit
-{
-    ///////////////////////////////////////////////////////////////////////////
-    // test if a tag is a character literal type
-    ///////////////////////////////////////////////////////////////////////////
-    template <typename CharSet>
-    struct is_char_tag<
-            spirit::char_class::key<CharSet, char_class::tag::space>,
-            karma::domain
-        >
-      : mpl::true_
-    {};
-}}
-
-namespace boost { namespace spirit { namespace karma
-{
-    ///////////////////////////////////////////////////////////////////////////
-    // forward declarations
-    ///////////////////////////////////////////////////////////////////////////
-    template <typename Char>
-    struct any_char;
-
-    template <typename Char>
-    struct literal_char;
-
-    struct lazy_char;
-
-    template <typename Tag, typename Char>
-    struct any_space_char;
-
-    template <typename Tag, typename Char>
-    struct literal_space_char;
-
-    struct char_meta_grammar;
-
-    template <typename Expr, typename Enable>
-    struct is_valid_expr;
-
-    template <typename Expr, typename Enable>
-    struct expr_transform;
-
-    ///////////////////////////////////////////////////////////////////////////
-    // get the director of a character literal type
-    ///////////////////////////////////////////////////////////////////////////
-    template <typename Tag, typename T>
-    struct extract_literal_char_director;
-
-    template <typename T>
-    struct extract_literal_char_director<tag::char_, T>
-    {
-        typedef literal_char<T> type;
-    };
-
-    template <typename T>
-    struct extract_literal_char_director<tag::wchar, T>
-    {
-        typedef literal_char<wchar_t> type;
-    };
-
-    template <typename T>
-    struct extract_literal_char_director<tag::lit, T>
-    {
-        typedef literal_char<T> type;
-    };
-
-    template <typename T>
-    struct extract_literal_char_director<tag::wlit, T>
-    {
-        typedef literal_char<wchar_t> type;
-    };
-
-    template <typename CharSet, typename T>
-    struct extract_literal_char_director<
-        spirit::char_class::key<CharSet, char_class::tag::space>, T
-    >
-    {
-        typedef
-            spirit::char_class::key<CharSet, char_class::tag::space>
-        key_type;
-        typedef literal_space_char<key_type, T> type;
-    };
-
-    ///////////////////////////////////////////////////////////////////////////
-    // get the director of a plain character type
-    ///////////////////////////////////////////////////////////////////////////
-    template <typename Tag>
-    struct extract_any_char_director;
-
-    template <>
-    struct extract_any_char_director<tag::char_>
-    {
-        typedef any_char<char> type;
-    };
-
-    template <>
-    struct extract_any_char_director<tag::wchar>
-    {
-        typedef any_char<wchar_t> type;
-    };
-
-    template <typename CharSet>
-    struct extract_any_char_director<
-        spirit::char_class::key<CharSet, char_class::tag::space>
-    >
-    {
-        typedef typename CharSet::char_type char_type;
-        typedef
-            spirit::char_class::key<CharSet, char_class::tag::space>
-        key_type;
-        typedef any_space_char<key_type, char_type> type;
-    };
-
-    ///////////////////////////////////////////////////////////////////////////
-    // char generator meta-grammars
-    ///////////////////////////////////////////////////////////////////////////
-
-    // literals: 'x', L'x'
-    struct char_literal_meta_grammar
-      : proto::or_<
-            meta_grammar::terminal_rule<
-                karma::domain, char, literal_char<char> 
-            >,
-            meta_grammar::terminal_rule<
-                karma::domain, wchar_t, literal_char<wchar_t> 
-            >
-        >
-    {
-    };
-
-    // literals: 'x', L'x'
-    struct basic_char_literal_meta_grammar
-      : proto::or_<
-            proto::terminal<char>,
-            proto::terminal<wchar_t>
-        >
-    {
-    };
-
-    // char_, wchar, space
-    // char_('x'), char_(L'x'), wchar('x'), wchar(L'x'), space(' ')
-    struct char_meta_grammar1
-      : proto::or_<
-            // char_, wchar, space
-            meta_grammar::compose_empty<
-                proto::if_<
-                    is_char_tag<proto::_child, karma::domain>()
-                >,
-                karma::domain,
-                mpl::identity<extract_any_char_director<mpl::_> >
-            >,
-            // char_('x'), wchar(L'x'), space(' ')
-            meta_grammar::compose_function1_eval<
-                proto::function<
-                    proto::if_<
-                        is_char_tag<proto::_child, karma::domain>()
-                    >,
-                    basic_char_literal_meta_grammar
-                >,
-                karma::domain,
-                mpl::identity<extract_literal_char_director<mpl::_, mpl::_> >
-            >,
-            // lit('x'), wlit('x')
-            meta_grammar::compose_function1_eval<
-                proto::function<
-                    proto::if_<
-                        is_lit_tag<proto::_child, karma::domain>()
-                    >,
-                    basic_char_literal_meta_grammar
-                >,
-                karma::domain,
-                mpl::identity<extract_literal_char_director<mpl::_, mpl::_> >
-            >,
-            // char_(val('y'))
-            meta_grammar::function1_rule<
-                karma::domain, tag::char_, lazy_char
-            >
-        >
-    {
-    };
-
-    // main char_meta_grammar
-    struct char_meta_grammar
-      : proto::or_<
-            char_literal_meta_grammar,
-            char_meta_grammar1
-        >
-    {
-    };
-
-    ///////////////////////////////////////////////////////////////////////////
-    //  These specializations non-intrusively hook into the Karma meta-grammar.
-    //  (see karma/meta_grammar.hpp)
-    ///////////////////////////////////////////////////////////////////////////
-    template <typename Expr>
-    struct is_valid_expr<Expr,
-        typename enable_if<proto::matches<Expr, char_meta_grammar> >::type>
-      : mpl::true_
-    {
-    };
-
-    template <typename Expr>
-    struct expr_transform<Expr,
-        typename enable_if<proto::matches<Expr, char_meta_grammar> >::type>
-      : mpl::identity<char_meta_grammar>
-    {
-    };
-
-}}}
-
-#endif
Modified: trunk/boost/spirit/home/karma/char/space.hpp
==============================================================================
--- trunk/boost/spirit/home/karma/char/space.hpp	(original)
+++ trunk/boost/spirit/home/karma/char/space.hpp	2009-04-26 10:42:24 EDT (Sun, 26 Apr 2009)
@@ -10,16 +10,32 @@
 #pragma once      // MS compatible compilers support #pragma once
 #endif
 
+#include <boost/spirit/home/support/common_terminals.hpp>
+#include <boost/spirit/home/support/string_traits.hpp>
+#include <boost/spirit/home/support/info.hpp>
+#include <boost/spirit/home/support/char_class.hpp>
+#include <boost/spirit/home/support/detail/get_encoding.hpp>
 #include <boost/spirit/home/karma/domain.hpp>
-#include <boost/spirit/home/karma/delimit.hpp>
+#include <boost/spirit/home/karma/meta_compiler.hpp>
+#include <boost/spirit/home/karma/delimit_out.hpp>
+#include <boost/spirit/home/karma/auxiliary/lazy.hpp>
+#include <boost/spirit/home/karma/detail/get_casetag.hpp>
 #include <boost/spirit/home/karma/detail/generate_to.hpp>
-#include <boost/spirit/home/support/char_class.hpp>
-#include <boost/spirit/home/support/detail/to_narrow.hpp>
-#include <boost/spirit/home/support/iso8859_1.hpp>
-#include <boost/spirit/home/support/ascii.hpp>
-#include <boost/spirit/home/support/standard.hpp>
-#include <boost/spirit/home/support/standard_wide.hpp>
 
+///////////////////////////////////////////////////////////////////////////////
+namespace boost { namespace spirit 
+{ 
+    ///////////////////////////////////////////////////////////////////////////
+    // Enablers
+    ///////////////////////////////////////////////////////////////////////////
+    template <typename CharEncoding>
+    struct use_terminal<karma::domain
+      , tag::char_code<tag::space, CharEncoding>        // enables space
+    > : mpl::true_ {};
+
+}}
+
+///////////////////////////////////////////////////////////////////////////////
 namespace boost { namespace spirit { namespace karma
 {
     ///////////////////////////////////////////////////////////////////////////
@@ -28,86 +44,63 @@
     //      generates a single character from the associated parameter
     //
     ///////////////////////////////////////////////////////////////////////////
-    template <typename Tag, typename Char>
-    struct any_space_char
+    template <typename CharEncoding>
+    struct any_space
+      : primitive_generator<any_space<CharEncoding> >
     {
-        template <typename Component, typename Context, typename Unused>
+        typedef typename CharEncoding::char_type char_type;
+        typedef CharEncoding char_encoding;
+
+        template <typename Context, typename Unused>
         struct attribute
         {
-            typedef Char type;
+            typedef char_type type;
         };
 
-        typedef typename Tag::char_set char_set;
-        typedef typename Tag::char_class char_class_;
-
-        // space has a parameter attached
-        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)
-        {
-            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
-            return true;
+        // any_space has an attached parameter
+        template <
+            typename OutputIterator, typename Context, typename Delimiter
+          , typename Attribute>
+        static bool generate(OutputIterator& sink, Context&, Delimiter const& d
+          , Attribute const& attr)
+        {
+            if (!spirit::char_class::classify<char_encoding>::is(tag::space(), attr))
+                return false;     // allow whitespace only
+
+            return 
+                karma::detail::generate_to(sink, attr) &&
+                karma::delimit_out(sink, d);      // always do post-delimiting
         }
 
-        // this space has no parameter attached, just generate a single ' '
-        template <typename Component, typename OutputIterator,
-            typename Context, typename Delimiter>
-        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
-            return true;
+        // any_space has no attribute attached, use single space character
+        template <typename OutputIterator, typename Context, typename Delimiter>
+        static bool generate(OutputIterator& sink, Context&, Delimiter const& d, 
+            unused_type const&)
+        {
+            return 
+                karma::detail::generate_to(sink, ' ') &&
+                karma::delimit_out(sink, d);      // always do post-delimiting
         }
 
-        template <typename Component, typename Context>
-        static std::string what(Component const& component, Context const& ctx)
+        template <typename Context>
+        static info what(Context const& ctx)
         {
-            return "any-space";
+            return info("space");
         }
     };
 
     ///////////////////////////////////////////////////////////////////////////
-    //
-    //  space(...)
-    //      generates a single space character given by a literal it was
-    //      initialized from
-    //
+    // Generator generators: make_xxx function (objects)
     ///////////////////////////////////////////////////////////////////////////
-    template <typename Tag, typename Char>
-    struct literal_space_char
+    // space
+    template <typename CharEncoding, typename Modifiers>
+    struct make_primitive<tag::char_code<tag::space, CharEncoding>, Modifiers>
     {
-        template <typename Component, typename Context, typename Unused>
-        struct attribute
-        {
-            typedef unused_type type;
-        };
-
-        // any_char has a parameter attached
-        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*/)
-        {
-            detail::generate_to(sink, fusion::at_c<0>(component.elements));
-            karma::delimit(sink, d);             // always do post-delimiting
-            return true;
-        }
+        typedef any_space<CharEncoding> result_type;
 
-        template <typename Component, typename Context>
-        static std::string what(Component const& component, Context const& ctx)
+        result_type operator()(unused_type, unused_type) const
         {
-            return std::string("space('")
-                + spirit::detail::to_narrow_char(
-                    fusion::at_c<0>(component.elements))
-                + "')";
+            return result_type();
         }
     };
 
Deleted: trunk/boost/spirit/home/karma/delimit.hpp
==============================================================================
--- trunk/boost/spirit/home/karma/delimit.hpp	2009-04-26 10:42:24 EDT (Sun, 26 Apr 2009)
+++ (empty file)
@@ -1,35 +0,0 @@
-//  Copyright (c) 2001-2009 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_DELIMIT_FEB_20_2007_1208PM)
-#define BOOST_SPIRIT_KARMA_DELIMIT_FEB_20_2007_1208PM
-
-#if defined(_MSC_VER) && (_MSC_VER >= 1020)
-#pragma once      // MS compatible compilers support #pragma once
-#endif
-
-#include <boost/spirit/home/support/unused.hpp>
-
-namespace boost { namespace spirit { namespace karma
-{
-    ///////////////////////////////////////////////////////////////////////////
-    //  Do delimiting. This is equivalent to p << d. The function is a
-    //  no-op if spirit::unused is passed as the delimiter-generator.
-    ///////////////////////////////////////////////////////////////////////////
-    template <typename OutputIterator, typename Delimiter>
-    inline void delimit(OutputIterator& sink, Delimiter const& d)
-    {
-        Delimiter::director::generate(d, sink, unused, unused, unused);
-    }
-
-    template <typename OutputIterator>
-    inline void delimit(OutputIterator&, unused_type)
-    {
-    }
-
-}}}
-
-#endif
-
Added: trunk/boost/spirit/home/karma/delimit_out.hpp
==============================================================================
--- (empty file)
+++ trunk/boost/spirit/home/karma/delimit_out.hpp	2009-04-26 10:42:24 EDT (Sun, 26 Apr 2009)
@@ -0,0 +1,45 @@
+//  Copyright (c) 2001-2009 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_DELIMIT_FEB_20_2007_1208PM)
+#define BOOST_SPIRIT_KARMA_DELIMIT_FEB_20_2007_1208PM
+
+#if defined(_MSC_VER) && (_MSC_VER >= 1020)
+#pragma once      // MS compatible compilers support #pragma once
+#endif
+
+#include <boost/spirit/home/support/unused.hpp>
+#include <boost/spirit/home/karma/detail/unused_delimiter.hpp>
+
+namespace boost { namespace spirit { namespace karma
+{
+    ///////////////////////////////////////////////////////////////////////////
+    //  Do delimiting. This is equivalent to p << d. The function is a
+    //  no-op if spirit::unused is passed as the delimiter-generator.
+    ///////////////////////////////////////////////////////////////////////////
+    template <typename OutputIterator, typename Delimiter>
+    inline bool delimit_out(OutputIterator& sink, Delimiter const& d)
+    {
+        return d.generate(sink, unused, unused, unused);
+    }
+
+    template <typename OutputIterator>
+    inline bool delimit_out(OutputIterator&, unused_type)
+    {
+        return true;
+    }
+
+    ///////////////////////////////////////////////////////////////////////////
+    template <typename OutputIterator, typename Delimiter>
+    inline bool delimit_out(OutputIterator&
+      , detail::unused_delimiter<Delimiter> const&)
+    {
+        return true;
+    }
+
+}}}
+
+#endif
+
Added: trunk/boost/spirit/home/karma/detail/alternative_function.hpp
==============================================================================
--- (empty file)
+++ trunk/boost/spirit/home/karma/detail/alternative_function.hpp	2009-04-26 10:42:24 EDT (Sun, 26 Apr 2009)
@@ -0,0 +1,170 @@
+//  Copyright (c) 2001-2009 Hartmut Kaiser
+//  Copyright (c) 2001-2009 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(SPIRIT_KARMA_ALTERNATIVE_MAR_01_2007_1124AM)
+#define SPIRIT_KARMA_ALTERNATIVE_MAR_01_2007_1124AM
+
+#if defined(_MSC_VER) && (_MSC_VER >= 1020)
+#pragma once      // MS compatible compilers support #pragma once
+#endif
+
+#include <boost/spirit/home/karma/domain.hpp>
+#include <boost/spirit/home/support/unused.hpp>
+#include <boost/spirit/home/support/attributes.hpp>
+#include <boost/utility/enable_if.hpp>
+#include <boost/mpl/find_if.hpp>
+#include <boost/mpl/deref.hpp>
+#include <boost/mpl/distance.hpp>
+#include <boost/type_traits/is_same.hpp>
+#include <boost/variant.hpp>
+
+///////////////////////////////////////////////////////////////////////////////
+namespace boost { namespace spirit { namespace karma { namespace detail
+{
+    ///////////////////////////////////////////////////////////////////////////
+    //  A component is compatible to a given Attribute type if the Attribute
+    //  is the same as the expected type of the component
+    ///////////////////////////////////////////////////////////////////////////
+    template <typename Expected, typename Attribute>
+    struct compute_compatible_component
+    {
+        typedef typename Attribute::types types;
+        typedef typename mpl::end<types>::type end;
+        typedef typename mpl::begin<types>::type begin;
+
+        typedef typename 
+            mpl::find_if<types, is_same<Expected, mpl::_1> >::type 
+        iter;
+
+        typedef typename mpl::not_<is_same<iter, end> >::type type;
+        enum { value = type::value };
+    };
+
+    template <typename Expected>
+    struct compute_compatible_component<Expected, unused_type>
+      : mpl::false_ {};
+
+    template <typename Attribute>
+    struct compute_compatible_component<unused_type, Attribute>
+      : mpl::false_ {};
+
+    template <>
+    struct compute_compatible_component<unused_type, unused_type>
+      : mpl::false_ {};
+
+    ///////////////////////////////////////////////////////////////////////////
+    //  execute a generator if the given Attribute type is compatible
+    ///////////////////////////////////////////////////////////////////////////
+
+    //  this gets instantiated if the Attribute type is _not_ compatible with
+    //  the generator
+    template <typename Component, typename Attribute, typename Expected,
+        typename Enable = void>
+    struct alternative_generate
+    {
+        template <typename OutputIterator, typename Context, typename Delimiter>
+        static bool
+        call(Component const&, OutputIterator&, Context&, Delimiter const&, 
+            Attribute const&)
+        {
+            return false;
+        }
+    };
+
+    template <typename Component>
+    struct alternative_generate<Component, unused_type, unused_type>
+    {
+        template <typename OutputIterator, typename Context, typename Delimiter>
+        static bool
+        call(Component const& component, OutputIterator& sink,
+            Context& ctx, Delimiter const& d, unused_type)
+        {
+            // return true if any of the generators succeed
+            return component.generate(sink, ctx, d, unused);
+        }
+    };
+
+    //  this gets instantiated if there is no Attribute given for the
+    //  alternative generator
+    template <typename Component, typename Expected>
+    struct alternative_generate<Component, unused_type, Expected>
+      : alternative_generate<Component, unused_type, unused_type> {};
+
+    //  this gets instantiated if the generator does not expect to receive an
+    //  Attribute (the generator is self contained).
+    template <typename Component, typename Attribute>
+    struct alternative_generate<Component, Attribute, unused_type>
+      : alternative_generate<Component, unused_type, unused_type> {};
+
+    //  this gets instantiated if the Attribute type is compatible to the
+    //  generator
+    template <typename Component, typename Attribute, typename Expected>
+    struct alternative_generate<Component, Attribute, Expected
+      , typename enable_if<
+            compute_compatible_component<Expected, Attribute> >::type>
+    {
+        template <typename OutputIterator, typename Context, typename Delimiter>
+        static bool
+        call(Component const& component, OutputIterator& sink,
+            Context& ctx, Delimiter const& d, Attribute const& attr)
+        {
+            typedef
+                compute_compatible_component<Expected, Attribute>
+            component_type;
+
+            typedef typename mpl::distance<
+                typename component_type::begin, typename component_type::iter
+            >::type distance_type;
+
+            // make sure, the content of the passed variant matches our
+            // expectations
+            if (attr.which() != distance_type::value)
+                return false;
+
+            // returns true if any of the generators succeed
+            typedef
+                typename mpl::deref<typename component_type::iter>::type
+            compatible_type;
+
+            return component.generate(sink, ctx, d, get<compatible_type>(attr));
+        }
+    };
+
+    ///////////////////////////////////////////////////////////////////////////
+    //  alternative_generate_functor: a functor supplied to fusion::any which
+    //  will be executed for every generator in a given alternative generator
+    //  expression
+    ///////////////////////////////////////////////////////////////////////////
+    template <typename OutputIterator, typename Context, typename Delimiter,
+        typename Attribute>
+    struct alternative_generate_functor
+    {
+        alternative_generate_functor(OutputIterator& sink_, Context& ctx_,
+              Delimiter const& d, Attribute const& attr_)
+          : sink(sink_), ctx(ctx_), delim(d), attr(attr_) {}
+
+        template <typename Component>
+        bool operator()(Component const& component)
+        {
+            typedef
+                typename traits::attribute_of<Component, Context>::type
+            expected_type;
+            typedef
+                alternative_generate<Component, Attribute, expected_type>
+            generate;
+
+            return generate::call(component, sink, ctx, delim, attr);
+        }
+
+        OutputIterator& sink;
+        Context& ctx;
+        Delimiter const& delim;
+        Attribute const& attr;
+    };
+
+}}}}
+
+#endif
Added: trunk/boost/spirit/home/karma/detail/default_width.hpp
==============================================================================
--- (empty file)
+++ trunk/boost/spirit/home/karma/detail/default_width.hpp	2009-04-26 10:42:24 EDT (Sun, 26 Apr 2009)
@@ -0,0 +1,56 @@
+//  Copyright (c) 2001-2009 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_DEFAULT_WIDTH_APR_07_2009_0912PM)
+#define BOOST_SPIRIT_KARMA_DEFAULT_WIDTH_APR_07_2009_0912PM
+
+#if defined(_MSC_VER) && (_MSC_VER >= 1020)
+#pragma once      // MS compatible compilers support #pragma once
+#endif
+
+///////////////////////////////////////////////////////////////////////////////
+//
+//  The BOOST_KARMA_DEFAULT_FIELD_LENGTH specifies the default field length
+//  to be used for padding.
+//
+///////////////////////////////////////////////////////////////////////////////
+#if !defined(BOOST_KARMA_DEFAULT_FIELD_LENGTH)
+#define BOOST_KARMA_DEFAULT_FIELD_LENGTH 10
+#endif
+
+///////////////////////////////////////////////////////////////////////////////
+//
+//  The BOOST_KARMA_DEFAULT_FIELD_MAXWIDTH specifies the default maximal field 
+//  length to be used for the maxwidth directive.
+//
+///////////////////////////////////////////////////////////////////////////////
+#if !defined(BOOST_KARMA_DEFAULT_FIELD_MAXWIDTH)
+#define BOOST_KARMA_DEFAULT_FIELD_MAXWIDTH 10
+#endif
+
+///////////////////////////////////////////////////////////////////////////////
+namespace boost { namespace spirit { namespace karma { namespace detail
+{
+    ///////////////////////////////////////////////////////////////////////////
+    struct default_width
+    {
+        operator int() const
+        {
+            return BOOST_KARMA_DEFAULT_FIELD_LENGTH;
+        }
+    };
+
+    ///////////////////////////////////////////////////////////////////////////
+    struct default_max_width
+    {
+        operator int() const
+        {
+            return BOOST_KARMA_DEFAULT_FIELD_MAXWIDTH;
+        }
+    };
+
+}}}}
+
+#endif
Added: trunk/boost/spirit/home/karma/detail/fail_function.hpp
==============================================================================
--- (empty file)
+++ trunk/boost/spirit/home/karma/detail/fail_function.hpp	2009-04-26 10:42:24 EDT (Sun, 26 Apr 2009)
@@ -0,0 +1,49 @@
+//  Copyright (c) 2001-2009 Hartmut Kaiser
+//  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(SPIRIT_KARMA_SEQUENCE_FEB_28_2007_0249PM)
+#define SPIRIT_KARMA_SEQUENCE_FEB_28_2007_0249PM
+
+#if defined(_MSC_VER) && (_MSC_VER >= 1020)
+#pragma once      // MS compatible compilers support #pragma once
+#endif
+
+#include <boost/spirit/home/support/unused.hpp>
+
+namespace boost { namespace spirit { namespace karma { namespace detail
+{
+    template <typename OutputIterator, typename Context, typename Delimiter>
+    struct fail_function
+    {
+        typedef Context context_type;
+
+        fail_function(OutputIterator& sink_, Context& context_
+            , Delimiter const& delim_)
+          : sink(sink_), ctx(context_), delim(delim_) 
+        {}
+
+        template <typename Component, typename Attribute>
+        bool operator()(Component const& component, Attribute const& attr) const
+        {
+            // return true if any of the generators fail
+            return !component.generate(sink, ctx, delim, attr);
+        }
+
+        template <typename Component>
+        bool operator()(Component const& component) const
+        {
+            // return true if any of the generators fail
+            return !component.generate(sink, ctx, delim, unused);
+        }
+
+        OutputIterator& sink;
+        Context& ctx;
+        Delimiter const& delim;
+    };
+
+}}}}
+
+#endif
Modified: trunk/boost/spirit/home/karma/detail/generate_to.hpp
==============================================================================
--- trunk/boost/spirit/home/karma/detail/generate_to.hpp	(original)
+++ trunk/boost/spirit/home/karma/detail/generate_to.hpp	2009-04-26 10:42:24 EDT (Sun, 26 Apr 2009)
@@ -3,8 +3,8 @@
 //  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_DETAIL_EXTRACT_FROM_FEB_20_2007_0417PM)
-#define BOOST_SPIRIT_KARMA_DETAIL_EXTRACT_FROM_FEB_20_2007_0417PM
+#if !defined(BOOST_SPIRIT_KARMA_DETAIL_GENERATE_TO_FEB_20_2007_0417PM)
+#define BOOST_SPIRIT_KARMA_DETAIL_GENERATE_TO_FEB_20_2007_0417PM
 
 #if defined(_MSC_VER) && (_MSC_VER >= 1020)
 #pragma once      // MS compatible compilers support #pragma once
@@ -18,41 +18,49 @@
     ///////////////////////////////////////////////////////////////////////////
     //  These utility functions insert the given parameter into the supplied 
     //  output iterator.
-    //  If the parameter is spirit's unused_type, this is a no_op.
+    //  If the attribute is spirit's unused_type, this is a no_op.
     ///////////////////////////////////////////////////////////////////////////
-    template <typename OutputIterator, typename Parameter, typename Tag>
+    template <
+        typename OutputIterator, typename Attribute, typename CharEncoding
+      , typename Tag>
     inline bool 
-    generate_to(OutputIterator& sink, Parameter const& p, Tag)
+    generate_to(OutputIterator& sink, Attribute const& p, CharEncoding, Tag)
     {
-        typedef typename Tag::char_set char_set;
-        typedef typename Tag::char_class char_class;
-        
-        *sink = spirit::char_class::convert<char_set>::to(char_class(), p);
+        *sink = spirit::char_class::convert<CharEncoding>::to(Tag(), p);
         ++sink;
-        return true;
+        return sink.good();
     }
 
-    template <typename OutputIterator, typename Parameter>
+    template <typename OutputIterator, typename Attribute>
     inline bool 
-    generate_to(OutputIterator& sink, Parameter const& p, unused_type = unused)
+    generate_to(OutputIterator& sink, Attribute const& p, unused_type, unused_type)
     {
         *sink = p;
         ++sink;
-        return true;
+        return sink.good();
     }
 
-    template <typename OutputIterator, typename Tag>
-    inline bool generate_to(OutputIterator& sink, unused_type, Tag)
+    template <typename OutputIterator, typename CharEncoding, typename Tag>
+    inline bool generate_to(OutputIterator&, unused_type, CharEncoding, Tag)
     {
         return true;
     }
-    
+
+    template <typename OutputIterator, typename Attribute>
+    inline bool 
+    generate_to(OutputIterator& sink, Attribute const& p)
+    {
+        *sink = p;
+        ++sink;
+        return sink.good();
+    }
+
     template <typename OutputIterator>
-    inline bool generate_to(OutputIterator& sink, unused_type)
+    inline bool generate_to(OutputIterator&, unused_type)
     {
         return true;
     }
-    
+
 }}}}   // namespace boost::spirit::karma::detail
 
 #endif  // KARMA_CORE_DETAIL_INSERT_TO_HPP
Added: trunk/boost/spirit/home/karma/detail/get_casetag.hpp
==============================================================================
--- (empty file)
+++ trunk/boost/spirit/home/karma/detail/get_casetag.hpp	2009-04-26 10:42:24 EDT (Sun, 26 Apr 2009)
@@ -0,0 +1,30 @@
+//  Copyright (c) 2001-2009 Hartmut Kaiser
+//  Copyright (c) 2001-2009 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_KARMA_GET_CASETAG_JANUARY_19_2009_1107AM)
+#define BOOST_SPIRIT_KARMA_GET_CASETAG_JANUARY_19_2009_1107AM
+
+#if defined(_MSC_VER)
+#pragma once
+#endif
+
+#include <boost/mpl/identity.hpp>
+
+namespace boost { namespace spirit { namespace karma { namespace detail
+{
+    template <typename Modifiers, bool case_modifier = false>
+    struct get_casetag : mpl::identity<unused_type> {};
+
+    template <typename Modifiers>
+    struct get_casetag<Modifiers, true>
+      : mpl::if_<has_modifier<Modifiers, tag::char_code_base<tag::lower> >
+          , tag::lower
+          , tag::upper
+        > {};
+
+}}}}
+
+#endif
Modified: trunk/boost/spirit/home/karma/detail/ostream_iterator.hpp
==============================================================================
--- trunk/boost/spirit/home/karma/detail/ostream_iterator.hpp	(original)
+++ trunk/boost/spirit/home/karma/detail/ostream_iterator.hpp	2009-04-26 10:42:24 EDT (Sun, 26 Apr 2009)
@@ -18,9 +18,8 @@
     //  ostream to retain possibly registered facets.
     ///////////////////////////////////////////////////////////////////////////
     template <
-        typename T, typename Elem = char, 
-        typename Traits = std::char_traits<Elem> 
-    >
+        typename T, typename Elem = char
+      , typename Traits = std::char_traits<Elem> >
     class ostream_iterator 
       : public std::iterator<std::output_iterator_tag, void, void, void, void>
     {
@@ -29,7 +28,7 @@
         typedef Traits traits_type;
         typedef std::basic_ostream<Elem, Traits> ostream_type;
         typedef ostream_iterator<T, Elem, Traits> self_type;
-        
+
         ostream_iterator(ostream_type& os_, Elem const* delim_ = 0)
           : os(&os_), delim(delim_) {}
 
@@ -45,8 +44,13 @@
         self_type& operator++() { return *this; }
         self_type operator++(int) { return *this; }
 
+        // expose underlying stream
         ostream_type& get_ostream() { return *os; }
-        
+        ostream_type const& get_ostream() const { return *os; }
+
+        // expose good bit of underlying stream object
+        bool good() const { return get_ostream().good(); }
+
     protected:
         ostream_type *os;
         Elem const* delim;
Modified: trunk/boost/spirit/home/karma/detail/output_iterator.hpp
==============================================================================
--- trunk/boost/spirit/home/karma/detail/output_iterator.hpp	(original)
+++ trunk/boost/spirit/home/karma/detail/output_iterator.hpp	2009-04-26 10:42:24 EDT (Sun, 26 Apr 2009)
@@ -14,8 +14,12 @@
 #include <vector>
 #include <algorithm>
 
+#include <boost/config.hpp>
 #include <boost/noncopyable.hpp>
+#include <boost/mpl/if.hpp>
+
 #include <boost/spirit/home/karma/detail/ostream_iterator.hpp>
+#include <boost/spirit/home/support/unused.hpp>
 
 namespace boost { namespace spirit { namespace karma { namespace detail 
 {
@@ -25,9 +29,9 @@
     class position_sink 
     {
     public:
-        position_sink() : count(0), line(1), column(0) {}
-        void tidy() { count = 0; line = 1; column = 0; }
-        
+        position_sink() : count(0), line(1), column(1) {}
+        void tidy() { count = 0; line = 1; column = 1; }
+
         template <typename T>
         void output(T const& value) 
         {
@@ -51,22 +55,36 @@
     };
 
     ///////////////////////////////////////////////////////////////////////////
-    //  This class is used to count the umber of characters streamed into the 
+    //  This class is used to count the number of characters streamed into the 
     //  output.
     ///////////////////////////////////////////////////////////////////////////
-    class counting_sink 
+    template <typename OutputIterator>
+    class counting_sink : boost::noncopyable
     {
     public:
-        counting_sink() : count(0) {}
-        
-        void init(std::size_t count_) { count = count_; }
-        void tidy() { count = 0; }
-        
-        void output() { ++count; }
+        counting_sink(OutputIterator& sink_, std::size_t count_ = 0
+              , bool enabled = true) 
+          : sink(sink_), count(count_) 
+        {
+            prev_count = sink.chain_counting(enabled ? this : NULL);
+        }
+        ~counting_sink() 
+        {
+            sink.chain_counting(prev_count);
+        }
+
+        void output() 
+        { 
+            ++count; 
+            if (prev_count)           // propagate count 
+                prev_count->output();
+        }
         std::size_t get_count() const { return count; }
 
     private:
         std::size_t count;
+        counting_sink* prev_count;                // previous counter in chain
+        OutputIterator& sink;
     };
 
     ///////////////////////////////////////////////////////////////////////////
@@ -82,10 +100,10 @@
     {
         virtual ~abstract_container() {}
         virtual void output(void const *item) = 0;
-        virtual void copy(OutputIterator& sink) = 0;
-        virtual std::size_t buffer_size() = 0;
+        virtual bool copy(OutputIterator& sink, std::size_t maxwidth) const = 0;
+        virtual std::size_t buffer_size() const = 0;
     };
-    
+
     template <typename OutputIterator, typename T>
     class concrete_container : public abstract_container<OutputIterator>
     {
@@ -96,40 +114,69 @@
         }
         ~concrete_container() {}
 
+    private:
         void output(void const *item)
         {
             buffer.push_back(*static_cast<T const*>(item));
         }
-        void copy(OutputIterator& sink)
+        bool copy(OutputIterator& sink, std::size_t maxwidth) const
         {
-            std::copy(buffer.begin(), buffer.end(), sink);
+#if defined(BOOST_MSVC)
+#pragma warning(push)
+#pragma warning(disable: 4267)
+#endif
+            typename std::basic_string<T>::const_iterator end = 
+                buffer.begin() + (std::min)(buffer.size(), maxwidth);
+
+#if defined(BOOST_MSVC)
+#pragma warning(pop)
+#endif
+
+            std::copy(buffer.begin(), end, sink);
+            return true;
         }
-        std::size_t buffer_size()
+//         template <typename RestIterator>
+//         bool copy_rest(RestIterator& restsink, std::size_t start_at) const
+//         {
+//             typename std::basic_string<T>::const_iterator begin = 
+//                 buffer.begin() + (std::min)(buffer.size(), start_at);
+// 
+//             std::copy(begin, buffer.end(), restsink);
+//             return true;
+//         }
+        std::size_t buffer_size() const
         {
             return buffer.size();
         }
-    
+
     private:
-        std::vector<T> buffer;
+        std::basic_string<T> buffer;
     };
-    
+
     ///////////////////////////////////////////////////////////////////////////
     template <typename OutputIterator>
     class buffer_sink : boost::noncopyable
     {
     public:
         buffer_sink()
-          : width(0), buffer(0) 
-        {}
-        
+          : width(0), buffer(0) {}
+
         ~buffer_sink() 
         { 
-            delete buffer; 
+            tidy(); 
+        }
+
+        void enable(std::size_t width_) 
+        { 
+            tidy();             // release existing buffer
+            width = width_; 
         }
-        
-        void init(std::size_t width_) { width = width_; }
-        void tidy() { delete buffer; buffer = 0; width = 0; }
-        
+
+        void tidy() 
+        { 
+            delete buffer; buffer = 0; width = 0; 
+        }
+
         template <typename T>
         void output(T const& value)
         {
@@ -140,13 +187,17 @@
             }
             buffer->output(&value);
         }
-        
-        void copy(OutputIterator& sink) const 
+
+        bool copy(OutputIterator& sink, std::size_t maxwidth) const 
         { 
-            if (buffer) 
-                buffer->copy(sink); 
+            return buffer ? buffer->copy(sink, maxwidth) : false; 
         }
-        
+//         template <typename RestIterator>
+//         bool copy_rest(RestIterator& sink, std::size_t start_at) const 
+//         { 
+//             return buffer ? buffer->copy_rest(sink, start_at) : false; 
+//         }
+
         std::size_t buffer_size() const 
         { 
             return buffer ? buffer->buffer_size() : 0; 
@@ -160,11 +211,10 @@
     ///////////////////////////////////////////////////////////////////////////
     //  forward declaration only
     ///////////////////////////////////////////////////////////////////////////
-    template <typename OutputIterator> struct enable_counting;
     template <typename OutputIterator> struct enable_buffering;
 
     ///////////////////////////////////////////////////////////////////////////
-    //  Karma uses a output iterator wrapper for all output operations. This
+    //  Karma uses an output iterator wrapper for all output operations. This
     //  is necessary to avoid the dreaded 'scanner business' problem, i.e. the
     //  dependency of rules and grammars on the used output iterator. 
     //
@@ -175,23 +225,16 @@
     //  supplied iterator. But it is possible to enable additional functionality
     //  on demand, such as counting, buffering, and position tracking.
     ///////////////////////////////////////////////////////////////////////////
-    template <typename OutputIterator, typename Enable = void>
+    template <typename OutputIterator, typename Derived = unused_type>
     class output_iterator : boost::noncopyable
     {
     private:
-        enum output_mode 
-        {
-            output_characters = 0,    // just hand through character
-            count_characters = 1,     // additionally count characters
-            buffer_characters = 2     // buffer all characters, no output
-        };
-        
         struct output_proxy 
         {
             output_proxy(output_iterator& parent) 
               : parent(parent) 
             {}
-            
+
             template <typename T> 
             output_proxy& operator=(T const& value) 
             {
@@ -205,46 +248,37 @@
             // suppress warning about assignment operator not being generated
             output_proxy& operator=(output_proxy const&);
         };
-        
+
+        // get the most derived type of this class
+        typedef typename mpl::if_<
+            traits::is_not_unused<Derived>, Derived, output_iterator
+        >::type most_derived_type;
+
 #if !defined(BOOST_NO_MEMBER_TEMPLATE_FRIENDS)
-private:
-        friend struct enable_counting<output_iterator<OutputIterator> >;
-        friend struct enable_buffering<output_iterator<OutputIterator> >;
-        friend struct enable_counting<output_iterator<OutputIterator, int> >;
-        friend struct enable_buffering<output_iterator<OutputIterator, int> >;
+    private:
+        friend struct counting_sink<output_iterator<OutputIterator, Derived> >;
+        friend struct enable_buffering<output_iterator<OutputIterator, Derived> >;
 #else
-public:
+    public:
 #endif
         // functions related to counting
-        void enable_counting(std::size_t count = 0)
+        counting_sink<most_derived_type>* chain_counting(
+            counting_sink<most_derived_type>* count_data)
         {
-            count_data.init(count);
-            mode = output_mode(mode | count_characters);
+            counting_sink<most_derived_type>* prev_count = count;
+            count = count_data;
+            return prev_count;
         }
-        void disable_counting()
-        {
-            mode = output_mode(mode & ~count_characters);
-        }
-        void reset_counting()
-        {
-            count_data.tidy();
-        }
-        
+
         // functions related to buffering
-        void enable_buffering(std::size_t width = 0)
-        {
-            buffer_data.init(width);
-            mode = output_mode(mode | buffer_characters);
-        }
-        void disable_buffering()
-        {
-            mode = output_mode(mode & ~buffer_characters);
-        }
-        void reset_buffering()
+        buffer_sink<most_derived_type>* chain_buffering(
+            buffer_sink<most_derived_type>* buffer_data)
         {
-            buffer_data.tidy();
+            buffer_sink<most_derived_type>* prev_buffer = buffer;
+            buffer = buffer_data;
+            return prev_buffer;
         }
-        
+
     public:
         typedef std::output_iterator_tag iterator_category;
         typedef void value_type;
@@ -252,63 +286,58 @@
         typedef void pointer;
         typedef void reference;
 
-        output_iterator(OutputIterator& sink_)
-          : sink(sink_), mode(output_characters)
+        explicit output_iterator(OutputIterator& sink_)
+          : sink(sink_), count(NULL), buffer(NULL)
+        {}
+        output_iterator(output_iterator const& rhs)
+          : sink(rhs.sink), count(rhs.count), buffer(rhs.buffer)
+          , track_position_data(rhs.track_position_data)
         {}
 
         output_proxy operator*() { return output_proxy(*this); }
         output_iterator& operator++() { ++sink; return *this; } 
-        output_iterator& operator++(int) { sink++; return *this; }
+        output_iterator operator++(int) 
+        {
+            output_iterator t(*this);
+            ++sink; 
+            return t; 
+        }
 
         template <typename T> 
         void output(T const& value) 
         { 
-            if (mode & count_characters)    // count characters, if appropriate
-                count_data.output();
+            if (NULL != count)          // count characters, if appropriate
+                count->output();
 
             // always track position in the output (this is needed by different 
             // generators, such as indent, pad, etc.)
             track_position_data.output(value);
 
-            if (mode & buffer_characters)   // buffer output, if appropriate
-                buffer_data.output(value);
+            if (NULL != buffer)         // buffer output, if appropriate
+                buffer->output(value);
             else
                 *sink = value; 
         }
 
-        // functions related to counting
-        std::size_t count() const
-        {
-            return count_data.get_count();
-        }
-        
-        // functions related to buffering
-        std::size_t buffer_size() const
-        {
-            return buffer_data.buffer_size();
-        }
-        void buffer_copy()
-        {
-            buffer_data.copy(sink);
-        }
-        
         // return the current count in the output
         std::size_t get_out_count() const
         {
             return track_position_data.get_count();
         }
-        
+
+        // plain output iterators are considered to be good all the time
+        bool good() const { return true; }
+
     protected:
         // this is the wrapped user supplied output iterator
         OutputIterator& sink;
 
     private:
         // these are the hooks providing optional functionality
-        counting_sink count_data;                   // for counting
-        buffer_sink<OutputIterator> buffer_data;    // for buffering
-        position_sink track_position_data;          // for position tracking
-        int mode;
-        
+        counting_sink<most_derived_type>* count;      // for counting
+        buffer_sink<most_derived_type>* buffer;       // for buffering
+        position_sink track_position_data;            // for position tracking
+
         // suppress warning about assignment operator not being generated
         output_iterator& operator=(output_iterator const&);
     };
@@ -316,21 +345,25 @@
     ///////////////////////////////////////////////////////////////////////////
     template <typename T, typename Elem, typename Traits>
     class output_iterator<ostream_iterator<T, Elem, Traits> >
-      : public output_iterator<ostream_iterator<T, Elem, Traits>, int>
+      : public output_iterator<ostream_iterator<T, Elem, Traits>
+          , output_iterator<ostream_iterator<T, Elem, Traits> > >
     {
     private:
-        typedef 
-            output_iterator<ostream_iterator<T, Elem, Traits>, int> 
-        base_type;
+        typedef output_iterator<ostream_iterator<T, Elem, Traits>
+              , output_iterator<ostream_iterator<T, Elem, Traits> > 
+        > base_type;
         typedef ostream_iterator<T, Elem, Traits> base_iterator_type;
         typedef std::basic_ostream<Elem, Traits> ostream_type;
 
     public:
         output_iterator(base_iterator_type& sink)
-          : base_type(sink)
-        {}
+          : base_type(sink) {}
 
         ostream_type& get_ostream() { return this->sink.get_ostream(); }
+        ostream_type const& get_ostream() const { return this->sink.get_ostream(); }
+
+        // expose good bit of underlying stream object
+        bool good() const { return this->sink.get_ostream().good(); }
     };
 
     ///////////////////////////////////////////////////////////////////////////
@@ -341,24 +374,28 @@
     struct enable_counting
     {
         enable_counting(OutputIterator& sink_, std::size_t count = 0)
-          : sink(sink_)
-        {
-            sink.enable_counting(count);
-        }
-        ~enable_counting()
-        {
-            sink.disable_counting();
-            sink.reset_counting();
-        }
-        
-        void disable()
+          : count_data(sink_, count) {}
+
+        // get number of characters counted since last enable
+        std::size_t count() const
         {
-            sink.disable_counting();
+            return count_data.get_count();
         }
 
-        OutputIterator& sink;
+    private:
+        counting_sink<OutputIterator> count_data;              // for counting
     };
-    
+
+    template <typename OutputIterator>
+    struct disable_counting
+    {
+        disable_counting(OutputIterator& sink_)
+          : count_data(sink_, 0, false) {}
+
+    private:
+        counting_sink<OutputIterator> count_data;
+    };
+
     ///////////////////////////////////////////////////////////////////////////
     //  Helper class for exception safe enabling of character buffering in the
     //  output iterator
@@ -367,24 +404,53 @@
     struct enable_buffering
     {
         enable_buffering(OutputIterator& sink_, std::size_t width = 0)
-          : sink(sink_)
+          : sink(sink_), prev_buffer(NULL), enabled(false)
         {
-            sink.enable_buffering(width);
+            buffer_data.enable(width);
+            prev_buffer = sink.chain_buffering(&buffer_data);
+            enabled = true;
         }
         ~enable_buffering()
         {
-            sink.disable_buffering();
-            sink.reset_buffering();
+            disable();
         }
-        
+
+        // reset buffer chain to initial state
         void disable()
         {
-            sink.disable_buffering();
+            if (enabled) {
+                BOOST_VERIFY(&buffer_data == sink.chain_buffering(prev_buffer));
+                enabled = false;
+            }
         }
-        
+
+        // copy to the underlying sink whatever is in the local buffer
+        bool buffer_copy(std::size_t maxwidth = std::size_t(-1)
+          , bool disable_ = true)
+        {
+            if (disable_)
+                disable();
+            return buffer_data.copy(sink, maxwidth) && sink.good();
+        }
+
+        // return number of characters stored in the buffer
+        std::size_t buffer_size() const
+        {
+            return buffer_data.buffer_size();
+        }
+
+//         bool buffer_copy_rest(std::size_t start_at = 0)
+//         {
+//             return buffer_data.copy_rest(sink, start_at);
+//         }
+
+    private:
         OutputIterator& sink;
+        buffer_sink<OutputIterator> buffer_data;    // for buffering
+        buffer_sink<OutputIterator>* prev_buffer;   // previous buffer in chain
+        bool enabled;
     };
-    
+
 }}}}
 
 #endif 
Added: trunk/boost/spirit/home/karma/detail/pass_container.hpp
==============================================================================
--- (empty file)
+++ trunk/boost/spirit/home/karma/detail/pass_container.hpp	2009-04-26 10:42:24 EDT (Sun, 26 Apr 2009)
@@ -0,0 +1,181 @@
+/*=============================================================================
+    Copyright (c) 2001-2009 Hartmut Kaiser
+    Copyright (c) 2001-2009 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(SPIRIT_PASS_CONTAINER_MAR_15_2009_0114PM)
+#define SPIRIT_PASS_CONTAINER_MAR_15_2009_0114PM
+
+#if defined(_MSC_VER)
+#pragma once
+#endif
+
+#include <boost/spirit/home/support/attributes.hpp>
+#include <boost/spirit/home/support/container.hpp>
+#include <boost/spirit/home/support/detail/hold_any.hpp>
+#include <boost/type_traits/is_base_of.hpp>
+#include <boost/type_traits/is_convertible.hpp>
+#include <boost/mpl/bool.hpp>
+#include <boost/mpl/or.hpp>
+#include <boost/preprocessor/cat.hpp>
+#include <boost/preprocessor/repeat.hpp>
+
+namespace boost { namespace spirit { namespace karma { namespace detail
+{
+    // has_same_elements: utility to check if the RHS attribute
+    // is an STL container and that its value_type is convertible
+    // to the LHS.
+
+    template <typename RHS, typename LHSAttribute
+      , bool IsContainer = traits::is_container<LHSAttribute>::value>
+    struct has_same_elements : mpl::false_ {};
+
+    template <typename RHS, typename LHSAttribute>
+    struct has_same_elements<RHS, LHSAttribute, true>
+      : mpl::or_<
+            is_convertible<typename LHSAttribute::value_type, RHS>
+          , is_same<typename LHSAttribute::value_type, hold_any>
+        > {};
+
+#define BOOST_SPIRIT_IS_CONVERTIBLE(z, N, data)                               \
+        is_convertible<BOOST_PP_CAT(T, N), RHS>::value ||                     \
+        is_same<BOOST_PP_CAT(T, N), hold_any>::value ||                       \
+    /***/
+
+    // Note: variants are treated as containers if one of the held types is a
+    //       container (see support/container.hpp).
+    template <typename RHS, BOOST_VARIANT_ENUM_PARAMS(typename T)>
+    struct has_same_elements<
+            RHS, boost::variant<BOOST_VARIANT_ENUM_PARAMS(T)>, true>
+      : mpl::bool_<BOOST_PP_REPEAT(BOOST_VARIANT_LIMIT_TYPES
+          , BOOST_SPIRIT_IS_CONVERTIBLE, _) false> {};
+
+#undef BOOST_SPIRIT_IS_CONVERTIBLE
+
+    // This function handles the case where the attribute (Attr) given
+    // to the sequence is an STL container. This is a wrapper around F.
+    // The function F does the actual generating.
+    template <typename F, typename Attr>
+    struct pass_container
+    {
+        typedef typename F::context_type context_type;
+
+        pass_container(F const& f, Attr& attr)
+          : f(f), attr(attr), iter(traits::begin(attr)) {}
+
+        // this is for the case when the current element expects an attribute
+        // which is taken from the next entry in the container
+        template <typename Component>
+//        bool dispatch_attribute_element(Component const& component, mpl::false_) const
+        bool dispatch_attribute(Component const& component, mpl::true_) const
+        {
+            // get the next value to generate from container
+            if (!traits::compare(iter, traits::end(attr)) &&
+                !f(component, traits::deref(iter))) 
+            {
+                // needs to return false as long as everything is ok
+                traits::next(iter);
+                return false;
+            }
+            // either no elements available any more or generation failed
+            return true;
+        }
+
+//        // this is for the case when the current element expects an attribute
+//        // which is a container itself, this element will get the rest of the 
+//        // attribute container
+//        template <typename Component>
+//        bool dispatch_attribute_element(Component const& component, mpl::true_) const
+//        {
+//            typedef typename 
+//                traits::attribute_of<Component, context_type>::type
+//            attribute_type;
+//            typedef typename 
+//                traits::container_type<attribute_type>::type
+//            container_type;
+// 
+//            bool result = f(component, container_type(iter, traits::end(attr)));
+//            if (result)
+//                iter = traits::end(attr);     // adjust current iter to the end 
+//            return result;
+//        }
+// 
+//        // This handles the distinction between elements in a sequence expecting
+//        // containers themselves and elements expecting non-containers as their 
+//        // attribute. Note: is_container treats optional<T>, where T is a 
+//        // container as a container as well.
+//        template <typename Component>
+//        bool dispatch_attribute(Component const& component, mpl::true_) const
+//        {
+//            typedef traits::is_container<
+//                typename traits::attribute_of<Component, context_type>::type
+//            > predicate;
+// 
+//            return dispatch_attribute_element(component, predicate());
+//        }
+
+        // this is for the case when the current element doesn't expect an 
+        // attribute
+        template <typename Component>
+        bool dispatch_attribute(Component const& component, mpl::false_) const
+        {
+            return f(component, unused);
+        }
+
+        // This handles the case where the attribute of the component
+        // is not a STL container or which elements are not 
+        // convertible to the target attribute's (Attr) value_type.
+        template <typename Component>
+        bool dispatch_main(Component const& component, mpl::false_) const
+        {
+            // we need to dispatch again depending on the type of the attribute
+            // of the current element (component). If this is has no attribute
+            // we shouldn't use an element of the container but unused_type as
+            // well
+            typedef traits::is_not_unused<
+                typename traits::attribute_of<Component, context_type>::type
+            > predicate;
+
+            return dispatch_attribute(component, predicate());
+        }
+
+        // This handles the case where the attribute of the component is
+        // an STL container *and* its value_type is convertible to the
+        // target attribute's (Attr) value_type.
+        template <typename Component>
+        bool dispatch_main(Component const& component, mpl::true_) const
+        {
+            return f(component, attr);
+        }
+
+        // Dispatches to dispatch_main depending on the attribute type
+        // of the Component
+        template <typename Component>
+        bool operator()(Component const& component) const
+        {
+            typedef typename traits::result_of::value<Attr>::type rhs;
+            typedef typename traits::attribute_of<
+                Component, context_type>::type lhs_attribute;
+
+            return dispatch_main(component
+              , has_same_elements<rhs, lhs_attribute>());
+        }
+
+        F f;
+        Attr const& attr;
+        mutable typename traits::result_of::iterator<Attr>::type iter;
+    };
+
+    // Utility function to make a pass_container
+    template <typename F, typename Attr>
+    pass_container<F, Attr>
+    inline make_pass_container(F const& f, Attr& attr)
+    {
+        return pass_container<F, Attr>(f, attr);
+    }
+
+}}}}
+
+#endif
Modified: trunk/boost/spirit/home/karma/detail/string_generate.hpp
==============================================================================
--- trunk/boost/spirit/home/karma/detail/string_generate.hpp	(original)
+++ trunk/boost/spirit/home/karma/detail/string_generate.hpp	2009-04-26 10:42:24 EDT (Sun, 26 Apr 2009)
@@ -11,67 +11,72 @@
 #endif
 
 #include <string>
-#include <boost/spirit/home/karma/detail/generate_to.hpp>
 #include <boost/spirit/home/support/char_class.hpp>
+#include <boost/spirit/home/karma/detail/generate_to.hpp>
+#include <boost/foreach.hpp>
 
 namespace boost { namespace spirit { namespace karma { namespace detail
 {
     ///////////////////////////////////////////////////////////////////////////
     //  generate a string given by a pointer 
     template <typename OutputIterator, typename Char>
-    inline bool 
-    string_generate(OutputIterator& sink, Char const* str, unused_type = unused)
+    inline bool string_generate(OutputIterator& sink, Char const* str)
     {
         for (Char ch = *str; ch != 0; ch = *++str)
-            detail::generate_to(sink, ch);
+        {
+            if (!detail::generate_to(sink, ch))
+                return false;
+        }
         return true;
     }
 
     ///////////////////////////////////////////////////////////////////////////
     //  generate a string given by a std::string
-    template <typename OutputIterator, typename Char>
-    inline bool 
-    string_generate(OutputIterator& sink, std::basic_string<Char> const& str,
-        unused_type = unused)
+    template <
+        typename OutputIterator, typename Char, typename Traits
+      , typename Allocator>
+    inline bool string_generate(OutputIterator& sink
+      , std::basic_string<Char, Traits, Allocator> const& str)
     {
-        typedef std::basic_string<Char> string_type;
-        
-        typename string_type::const_iterator end = str.end();
-        for (typename string_type::const_iterator it = str.begin(); 
-             it != end; ++it)
+        BOOST_FOREACH(Char ch, str)
         {
-            detail::generate_to(sink, *it);
+            if (!detail::generate_to(sink, ch))
+                return false;
         }
         return true;
     }
 
     ///////////////////////////////////////////////////////////////////////////
     //  generate a string given by a pointer, converting according using a 
-    //  given character class tag
-    template <typename OutputIterator, typename Char, typename Tag>
-    inline bool 
-    string_generate(OutputIterator& sink, Char const* str, Tag tag)
+    //  given character class and case tag
+    template <
+        typename OutputIterator, typename Char, typename CharEncoding
+      , typename Tag>
+    inline bool string_generate(OutputIterator& sink, Char const* str
+      , CharEncoding ce, Tag tag)
     {
         for (Char ch = *str; ch != 0; ch = *++str)
-            detail::generate_to(sink, ch, tag);
+        {
+            if (!detail::generate_to(sink, ch, ce, tag))
+                return false;
+        }
         return true;
     }
 
     ///////////////////////////////////////////////////////////////////////////
     //  generate a string given by a std::string, converting according using a 
-    //  given character class tag
-    template <typename OutputIterator, typename Char, typename Tag>
-    inline bool 
-    string_generate(OutputIterator& sink, std::basic_string<Char> const& str, 
-        Tag tag)
+    //  given character class and case tag
+    template <
+        typename OutputIterator, typename Char, typename CharEncoding
+      , typename Tag, typename Traits, typename Allocator>
+    inline bool string_generate(OutputIterator& sink
+      , std::basic_string<Char, Traits, Allocator> const& str
+      , CharEncoding ce, Tag tag)
     {
-        typedef std::basic_string<Char> string_type;
-        
-        typename string_type::const_iterator end = str.end();
-        for (typename string_type::const_iterator it = str.begin(); 
-             it != end; ++it)
+        BOOST_FOREACH(Char ch, str)
         {
-            detail::generate_to(sink, *it, tag);
+            if (!detail::generate_to(sink, ch, ce, tag))
+                return false;
         }
         return true;
     }
Added: trunk/boost/spirit/home/karma/detail/unused_delimiter.hpp
==============================================================================
--- (empty file)
+++ trunk/boost/spirit/home/karma/detail/unused_delimiter.hpp	2009-04-26 10:42:24 EDT (Sun, 26 Apr 2009)
@@ -0,0 +1,43 @@
+//  Copyright (c) 2001-2009 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_UNUSED_DELIMITER_MAR_15_2009_0923PM)
+#define BOOST_SPIRIT_KARMA_UNUSED_DELIMITER_MAR_15_2009_0923PM
+
+#include <boost/spirit/home/support/unused.hpp>
+
+namespace boost { namespace spirit { namespace karma { namespace detail
+{
+    template <typename Delimiter>
+    struct unused_delimiter : unused_type
+    {
+        unused_delimiter(Delimiter const& delim)
+          : delimiter(delim) {}
+        Delimiter const& delimiter;
+    };
+
+    // If a surrounding verbatim[] directive was specified, the current
+    // delimiter is of the type unused_delimiter. In this case we 
+    // re-activate the delimiter which was active before the verbatim[]
+    // directive.
+    template <typename Delimiter, typename Default>
+    inline Delimiter const& 
+    get_delimiter(unused_delimiter<Delimiter> const& u, Default const&)
+    {
+        return u.delimiter;
+    }
+
+    // If no surrounding verbatim[] directive was specified we activate
+    // a single space as the delimiter to use.
+    template <typename Delimiter, typename Default>
+    inline Default const& 
+    get_delimiter(Delimiter const&, Default const& d)
+    {
+        return d;
+    }
+
+}}}}
+
+#endif
Modified: trunk/boost/spirit/home/karma/directive.hpp
==============================================================================
--- trunk/boost/spirit/home/karma/directive.hpp	(original)
+++ trunk/boost/spirit/home/karma/directive.hpp	2009-04-26 10:42:24 EDT (Sun, 26 Apr 2009)
@@ -17,13 +17,18 @@
 #include <boost/spirit/home/karma/directive/left_alignment.hpp>
 #include <boost/spirit/home/karma/directive/right_alignment.hpp>
 #include <boost/spirit/home/karma/directive/center_alignment.hpp>
-#include <boost/spirit/home/karma/directive/alignment_meta_grammar.hpp>
+
+///////////////////////////////////////////////////////////////////////////////
+//  directives related to truncating length
+//  maxwidth[...]
+///////////////////////////////////////////////////////////////////////////////
+#include <boost/spirit/home/karma/directive/maxwidth.hpp>
 
 ///////////////////////////////////////////////////////////////////////////////
 //  directives related to character case
 //  lower[...] and upper[...]
 ///////////////////////////////////////////////////////////////////////////////
-#include <boost/spirit/home/karma/directive/case_meta_grammar.hpp>
+#include <boost/spirit/home/karma/directive/upper_lower_case.hpp>
 
 ///////////////////////////////////////////////////////////////////////////////
 //  directives related to delimiting generators 
@@ -31,6 +36,5 @@
 ///////////////////////////////////////////////////////////////////////////////
 #include <boost/spirit/home/karma/directive/verbatim.hpp>
 #include <boost/spirit/home/karma/directive/delimit.hpp>
-#include <boost/spirit/home/karma/directive/delimiter_meta_grammar.hpp>
 
 #endif
Deleted: trunk/boost/spirit/home/karma/directive/alignment_meta_grammar.hpp
==============================================================================
--- trunk/boost/spirit/home/karma/directive/alignment_meta_grammar.hpp	2009-04-26 10:42:24 EDT (Sun, 26 Apr 2009)
+++ (empty file)
@@ -1,171 +0,0 @@
-//  Copyright (c) 2001-2009 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_ALIGNMENT_META_GRAMMAR_FEB_21_2007_0826PM)
-#define BOOST_SPIRIT_KARMA_ALIGNMENT_META_GRAMMAR_FEB_21_2007_0826PM
-
-#if defined(_MSC_VER) && (_MSC_VER >= 1020)
-#pragma once      // MS compatible compilers support #pragma once
-#endif
-
-#include <boost/spirit/home/support/modifier.hpp>
-#include <boost/spirit/home/support/meta_grammar.hpp>
-#include <boost/spirit/home/karma/domain.hpp>
-#include <boost/utility/enable_if.hpp>
-#include <boost/mpl/if.hpp>
-#include <boost/mpl/or.hpp>
-
-namespace boost { namespace spirit { namespace karma
-{
-    ///////////////////////////////////////////////////////////////////////////
-    // forwards
-    ///////////////////////////////////////////////////////////////////////////
-    struct main_meta_grammar;
-    
-    struct simple_left_aligment;
-    struct simple_right_aligment;
-    struct simple_center_aligment;
-    
-    struct width_left_aligment;
-    struct width_right_aligment;
-    struct width_center_aligment;
-    
-    struct padding_left_aligment;
-    struct padding_right_aligment;
-    struct padding_center_aligment;
-    
-    struct full_left_aligment;
-    struct full_right_aligment;
-    struct full_center_aligment;
-    
-    ///////////////////////////////////////////////////////////////////////////
-    template <typename Expr, typename Enable>
-    struct is_valid_expr;
-
-    template <typename Expr, typename Enable>
-    struct expr_transform;
-
-    ///////////////////////////////////////////////////////////////////////////
-    //  left, right and center directive meta-grammars
-    ///////////////////////////////////////////////////////////////////////////
-    struct simple_align_directive_meta_grammar 
-      : proto::or_<
-            meta_grammar::binary_rule<
-                karma::domain, proto::tag::subscript, simple_left_aligment,
-                proto::terminal<tag::left_align>, main_meta_grammar
-            >,
-            meta_grammar::binary_rule<
-                karma::domain, proto::tag::subscript, simple_right_aligment,
-                proto::terminal<tag::right_align>, main_meta_grammar
-            >,
-            meta_grammar::binary_rule<
-                karma::domain, proto::tag::subscript, simple_center_aligment,
-                proto::terminal<tag::center>, main_meta_grammar
-            >
-        >
-    {};
-    
-    ///////////////////////////////////////////////////////////////////////////
-    //  matches alignment directives defining the width only: 
-    //  left_align(width)[...], right_align(width)[...], center(width)[...]
-    ///////////////////////////////////////////////////////////////////////////
-    struct width_align_directive_meta_grammar 
-      : proto::or_<
-            meta_grammar::subscript_function1_rule<
-                karma::domain, tag::left_align, width_left_aligment,
-                proto::terminal<int>, main_meta_grammar
-            >,
-            meta_grammar::subscript_function1_rule<
-                karma::domain, tag::right_align, width_right_aligment,
-                proto::terminal<int>, main_meta_grammar
-            >,
-            meta_grammar::subscript_function1_rule<
-                karma::domain, tag::center, width_center_aligment,
-                proto::terminal<int>, main_meta_grammar
-            >
-        >
-    {};
-    
-    ///////////////////////////////////////////////////////////////////////////
-    //  matches alignment directives defining the padding generator only: 
-    //  left_align(padding)[...], right_align(padding)[...], center(padding)[...]
-    ///////////////////////////////////////////////////////////////////////////
-    struct padding_align_directive_meta_grammar 
-      : proto::or_<
-            meta_grammar::subscript_function1_rule<
-                karma::domain, tag::left_align, padding_left_aligment,
-                main_meta_grammar, main_meta_grammar
-            >,
-            meta_grammar::subscript_function1_rule<
-                karma::domain, tag::right_align, padding_right_aligment,
-                main_meta_grammar, main_meta_grammar
-            >,
-            meta_grammar::subscript_function1_rule<
-                karma::domain, tag::center, padding_center_aligment,
-                main_meta_grammar, main_meta_grammar
-            >
-        >
-    {};
-    
-    ///////////////////////////////////////////////////////////////////////////
-    //  matches full alignment directives: left_align(width, padding)[...],
-    //  right_align(width, padding)[...], center(width, padding)[...]
-    ///////////////////////////////////////////////////////////////////////////
-    struct full_align_directive_meta_grammar 
-      : proto::or_<
-            meta_grammar::subscript_function2_rule<
-                karma::domain, tag::left_align, full_left_aligment,
-                proto::terminal<int>, main_meta_grammar, main_meta_grammar
-            >,
-            meta_grammar::subscript_function2_rule<
-                karma::domain, tag::right_align, full_right_aligment,
-                proto::terminal<int>, main_meta_grammar, main_meta_grammar
-            >,
-            meta_grammar::subscript_function2_rule<
-                karma::domain, tag::center, full_center_aligment,
-                proto::terminal<int>, main_meta_grammar, main_meta_grammar
-            >
-        >
-    {};
-    
-    // main alignment_directive_meta_grammar
-    struct alignment_directive_meta_grammar
-      : proto::or_<
-            simple_align_directive_meta_grammar,
-            width_align_directive_meta_grammar,
-            padding_align_directive_meta_grammar,
-            full_align_directive_meta_grammar
-        >
-    {};
-
-    ///////////////////////////////////////////////////////////////////////////
-    //  These specializations non-intrusively hooks into the Karma meta-grammar.
-    //  (see karma/meta_grammar.hpp)
-    ///////////////////////////////////////////////////////////////////////////  
-    template <typename Expr>
-    struct is_valid_expr<
-            Expr,
-            typename enable_if<
-                proto::matches<Expr, alignment_directive_meta_grammar> 
-            >::type
-        >
-      : mpl::true_
-    {
-    };
-
-    template <typename Expr>
-    struct expr_transform<
-            Expr,
-            typename enable_if<
-                    proto::matches<Expr, alignment_directive_meta_grammar> 
-            >::type
-        >
-      : mpl::identity<alignment_directive_meta_grammar>
-    {
-    };
-    
-}}}
-
-#endif
Deleted: trunk/boost/spirit/home/karma/directive/case_meta_grammar.hpp
==============================================================================
--- trunk/boost/spirit/home/karma/directive/case_meta_grammar.hpp	2009-04-26 10:42:24 EDT (Sun, 26 Apr 2009)
+++ (empty file)
@@ -1,133 +0,0 @@
-//  Copyright (c) 2001-2009 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_CASE_META_GRAMMAR_FEB_21_2007_0826PM)
-#define BOOST_SPIRIT_KARMA_CASE_META_GRAMMAR_FEB_21_2007_0826PM
-
-#if defined(_MSC_VER) && (_MSC_VER >= 1020)
-#pragma once      // MS compatible compilers support #pragma once
-#endif
-
-#include <boost/spirit/home/support/modifier.hpp>
-#include <boost/spirit/home/support/meta_grammar.hpp>
-#include <boost/spirit/home/karma/domain.hpp>
-#include <boost/spirit/home/support/iso8859_1.hpp>
-#include <boost/spirit/home/support/ascii.hpp>
-#include <boost/spirit/home/support/standard.hpp>
-#include <boost/spirit/home/support/standard_wide.hpp>
-#include <boost/utility/enable_if.hpp>
-#include <boost/mpl/if.hpp>
-#include <boost/mpl/or.hpp>
-
-namespace boost { namespace spirit { namespace karma
-{
-    ///////////////////////////////////////////////////////////////////////////
-    // forwards
-    ///////////////////////////////////////////////////////////////////////////
-    struct main_meta_grammar;
-    
-    ///////////////////////////////////////////////////////////////////////////
-    template <typename Expr, typename Enable>
-    struct is_valid_expr;
-
-    template <typename Expr, typename Enable>
-    struct expr_transform;
-
-    ///////////////////////////////////////////////////////////////////////////
-    //  lower and upper directive meta-grammars
-    ///////////////////////////////////////////////////////////////////////////
-    struct lower_case_directive_meta_grammar 
-      : meta_grammar::deep_directive_meta_grammar<
-            spirit::char_class::lower_case_tag<proto::_>,
-            main_meta_grammar
-        >
-    {};
-
-    struct upper_case_directive_meta_grammar  
-      : meta_grammar::deep_directive_meta_grammar<
-            spirit::char_class::upper_case_tag<proto::_>,
-            main_meta_grammar
-        >
-    {};
-
-    // main directive_meta_grammar
-    struct directive_meta_grammar
-      : proto::or_<
-            lower_case_directive_meta_grammar,
-            upper_case_directive_meta_grammar
-        >
-    {};
-
-    ///////////////////////////////////////////////////////////////////////////
-    //  These specializations non-intrusively hooks into the Karma meta-grammar.
-    //  (see karma/meta_grammar.hpp)
-    ///////////////////////////////////////////////////////////////////////////  
-    template <typename Expr>
-    struct is_valid_expr<Expr,
-        typename enable_if<proto::matches<Expr, directive_meta_grammar> >::type>
-      : mpl::true_
-    {
-    };
-
-    template <typename Expr>
-    struct expr_transform<Expr,
-        typename enable_if<proto::matches<Expr, directive_meta_grammar> >::type>
-      : mpl::identity<directive_meta_grammar>
-    {
-    };
-    
-}}}
-
-namespace boost { namespace spirit 
-{
-    ///////////////////////////////////////////////////////////////////////////
-    //  The following specializations for the add_modifier template are added
-    //  to allow for special handling of the lower[] and upper[] directives
-    //  which are mutually exclusive. Since the first of these directives 
-    //  added to the modifier corresponds to the outermost one in the generator
-    //  expression, we just ignore the request to add a tag if one of the two
-    //  has been already added.
-    template <typename Modifier, typename Tag>
-    struct add_modifier<Modifier, spirit::char_class::lower_case_tag<Tag> >
-    {
-        // add the new tag to the modifier (if it isn't already)
-        typedef spirit::char_class::upper_case_tag<Tag> reciprocal_tag;
-        typedef spirit::char_class::lower_case_tag<Tag> tag;
-
-        typedef typename
-            mpl::if_<
-                mpl::or_<
-                    is_member_of_modifier<Modifier, reciprocal_tag>,
-                    is_member_of_modifier<Modifier, tag>
-                >,
-                Modifier,
-                modifier<Modifier, tag>
-            >::type 
-        type;
-    };
-    
-    ///////////////////////////////////////////////////////////////////////////
-    template <typename Modifier, typename Tag>
-    struct add_modifier<Modifier, spirit::char_class::upper_case_tag<Tag> >
-    {
-        // add the new tag to the modifier (if it isn't already)
-        typedef spirit::char_class::lower_case_tag<Tag> reciprocal_tag;
-        typedef spirit::char_class::upper_case_tag<Tag> tag;
-        
-        typedef typename
-            mpl::if_<
-                mpl::or_<
-                    is_member_of_modifier<Modifier, reciprocal_tag>,
-                    is_member_of_modifier<Modifier, tag>
-                >,
-                Modifier,
-                modifier<Modifier, tag>
-            >::type 
-        type;
-    };
-    
-}}
-
-#endif
Modified: trunk/boost/spirit/home/karma/directive/center_alignment.hpp
==============================================================================
--- trunk/boost/spirit/home/karma/directive/center_alignment.hpp	(original)
+++ trunk/boost/spirit/home/karma/directive/center_alignment.hpp	2009-04-26 10:42:24 EDT (Sun, 26 Apr 2009)
@@ -10,217 +10,277 @@
 #pragma once      // MS compatible compilers support #pragma once
 #endif
 
-#include <boost/spirit/home/support/component.hpp>
-#include <boost/spirit/home/support/attribute_of.hpp>
+#include <boost/spirit/home/karma/meta_compiler.hpp>
+#include <boost/spirit/home/karma/generator.hpp>
 #include <boost/spirit/home/karma/domain.hpp>
-#include <boost/spirit/home/karma/directive/detail/center_alignment_generate.hpp>
+#include <boost/spirit/home/karma/detail/output_iterator.hpp>
+#include <boost/spirit/home/karma/detail/default_width.hpp>
+#include <boost/spirit/home/karma/delimit_out.hpp>
+#include <boost/spirit/home/karma/auxiliary/lazy.hpp>
+#include <boost/spirit/home/support/unused.hpp>
+#include <boost/spirit/home/support/common_terminals.hpp>
+#include <boost/spirit/home/support/attributes.hpp>
+#include <boost/spirit/home/support/info.hpp>
+#include <boost/spirit/home/support/unused.hpp>
+#include <boost/fusion/include/at.hpp>
+#include <boost/fusion/include/vector.hpp>
 #include <boost/lexical_cast.hpp>
+#include <boost/integer_traits.hpp>
+#include <boost/mpl/bool.hpp>
+#include <boost/utility/enable_if.hpp>
 
 ///////////////////////////////////////////////////////////////////////////////
-//
-//  The BOOST_KARMA_DEFAULT_FIELD_LENGTH specifies the default field length
-//  to be used for padding.
-//
-///////////////////////////////////////////////////////////////////////////////
-#if !defined(BOOST_KARMA_DEFAULT_FIELD_LENGTH)
-#define BOOST_KARMA_DEFAULT_FIELD_LENGTH 10
-#endif
-
-namespace boost { namespace spirit { namespace karma
+namespace boost { namespace spirit
 {
     ///////////////////////////////////////////////////////////////////////////
-    //  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).
+    // Enablers
     ///////////////////////////////////////////////////////////////////////////
-    struct simple_center_aligment
-    {
-        template <typename Component, typename Context, typename Unused>
-        struct attribute
-          : traits::attribute_of<
-                karma::domain,
-                typename result_of::argument1<Component>::type,
-                Context
-            >
-        {
-        };
 
-        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)
-        {
-            return detail::center_generate(sink, ctx, d, param,
-                argument1(component), BOOST_KARMA_DEFAULT_FIELD_LENGTH,
-                spirit::as_component(karma::domain(), ' '));
-        }
+    // enables center[]
+    template <>
+    struct use_directive<karma::domain, tag::center>
+      : mpl::true_ {};
+
+    // enables center(d)[g] and center(w)[g], where d is a generator
+    // and w is a maximum width
+    template <typename T>
+    struct use_directive<karma::domain
+          , terminal_ex<tag::center, fusion::vector1<T> > >
+      : mpl::true_ {};
+
+    // enables *lazy* delimit(d)[g], where d provides a generator
+    template <>
+    struct use_lazy_directive<karma::domain, tag::center, 1> 
+      : mpl::true_ {};
+
+    // enables center(w, d)[g], where d is a generator and w is a maximum 
+    // width
+    template <typename Width, typename Padding>
+    struct use_directive<karma::domain
+          , terminal_ex<tag::center, fusion::vector2<Width, Padding> > >
+      : spirit::traits::matches<karma::domain, Padding> {};
+
+    // enables *lazy* delimit(w, d)[g], where d provides a generator and w is 
+    // a maximum width
+    template <>
+    struct use_lazy_directive<karma::domain, tag::center, 2> 
+      : mpl::true_ {};
 
-        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
-            director;
+///////////////////////////////////////////////////////////////////////////////
+namespace boost { namespace spirit { namespace karma
+{
+    using spirit::center;
+    using spirit::center_type;
 
-            result += director::what(spirit::argument1(component), ctx);
-            result += "]";
-            return result;
+    namespace detail
+    {
+        ///////////////////////////////////////////////////////////////////////
+        //  The center_generate template function is used for all the 
+        //  different flavors of the center[] directive. 
+        ///////////////////////////////////////////////////////////////////////
+        template <typename OutputIterator, typename Context, typename Delimiter, 
+            typename Attribute, typename Embedded, typename Padding>
+        inline static bool 
+        center_generate(OutputIterator& sink, Context& ctx, 
+            Delimiter const& d, Attribute const& attr, Embedded const& e, 
+            unsigned int const width, Padding const& p) 
+        {
+            // wrap the given output iterator to allow left padding
+            detail::enable_buffering<OutputIterator> buffering(sink, width);
+            bool r = false;
+
+            // first generate the embedded output 
+            {
+                detail::disable_counting<OutputIterator> nocounting(sink);
+                r = e.generate(sink, ctx, d, attr);
+            }   // re-enable counting
+
+            buffering.disable();    // do not perform buffering any more
+
+            // generate the left padding
+            detail::enable_counting<OutputIterator> counting(sink);
+
+            std::size_t const pre = width - (buffering.buffer_size() + width)/2;
+            while (r && counting.count() < pre) 
+                r = p.generate(sink, ctx, unused, unused);
+
+            if (r) {
+                // copy the embedded output to the target output iterator
+                buffering.buffer_copy();
+
+                // generate the right padding
+                while (r && counting.count() < width) 
+                    r = p.generate(sink, ctx, unused, unused);
+            }
+            return r;
         }
-    };
+    }
 
     ///////////////////////////////////////////////////////////////////////////
-    //  The center alignment with width directive, is used for generators
-    //  like center(width)[...]. It uses a default value for the padding
+    //  The simple left 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).
     ///////////////////////////////////////////////////////////////////////////
-    struct width_center_aligment
+    template <typename Subject, typename Width = detail::default_width>
+    struct simple_center_alignment
+      : unary_generator<simple_center_alignment<Subject, Width> >
     {
-        template <typename Component, typename Context, typename Unused>
+        typedef Subject subject_type;
+
+        template <typename Context, typename Unused>
         struct attribute
-          : traits::attribute_of<
-                karma::domain,
-                typename result_of::subject<Component>::type,
-                Context
-            >
         {
+            typedef typename
+                traits::attribute_of<subject_type, Context>::type
+            type;
         };
 
-        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)
+        simple_center_alignment(Subject const& subject, Width width = Width())
+          : subject(subject), width(width) {}
+
+        template <typename OutputIterator, typename Context, typename Delimiter
+          , typename Attribute>
+        bool generate(OutputIterator& sink, Context& ctx, Delimiter const& d
+          , Attribute const& attr) const
         {
-            return detail::center_generate(sink, ctx, d, param,
-                subject(component), proto::child_c<0>(argument1(component)), ' ');
+            return detail::center_generate(sink, ctx, d, attr,
+                subject, width, compile<karma::domain>(' '));
         }
 
-        template <typename Component, typename Context>
-        static std::string what(Component const& component, Context const& ctx)
+        template <typename Context>
+        info what(Context& context) const
         {
-            std::string result = "center(";
-
-            result += boost::lexical_cast<std::string>(
-                proto::child_c<0>(argument1(component)));
-            result += ")[";
-
-            typedef typename
-                spirit::result_of::subject<Component>::type::director
-            director;
-
-            result += director::what(spirit::subject(component), ctx);
-            result += "]";
-            return result;
+            return info("center", subject.what(context));
         }
+
+        Subject subject;
+        Width width;
     };
 
     ///////////////////////////////////////////////////////////////////////////
-    //  The center alignment directive with padding, is used for generators like
+    //  The left 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
     //  via the BOOST_KARMA_DEFAULT_FIELD_LENGTH constant).
     ///////////////////////////////////////////////////////////////////////////
-    struct padding_center_aligment
+    template <typename Subject, typename Padding
+      , typename Width = detail::default_width>
+    struct padding_center_alignment
+      : unary_generator<padding_center_alignment<Subject, Padding, Width> >
     {
-        template <typename Component, typename Context, typename Unused>
+        typedef Subject subject_type;
+        typedef Padding padding_type;
+
+        template <typename Context, typename Unused>
         struct attribute
-          : traits::attribute_of<
-                karma::domain,
-                typename result_of::subject<Component>::type,
-                Context
-            >
         {
+            typedef typename
+                traits::attribute_of<Subject, Context>::type
+            type;
         };
 
-        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)
+        padding_center_alignment(Subject const& subject, Padding const& padding
+              , Width width = Width())
+          : subject(subject), padding(padding), width(width) {}
+
+        template <typename OutputIterator, typename Context, typename Delimiter
+          , typename Attribute>
+        bool generate(OutputIterator& sink, Context& ctx, Delimiter const& d
+          , Attribute const& attr) const
         {
-            return detail::center_generate(sink, ctx, d, param,
-                subject(component), BOOST_KARMA_DEFAULT_FIELD_LENGTH,
-                argument1(component));
+            return detail::center_generate(sink, ctx, d, attr,
+                subject, width, padding);
         }
 
-        template <typename Component, typename Context>
-        static std::string what(Component const& component, Context const& ctx)
+        template <typename Context>
+        info what(Context& context) const
         {
-            std::string result = "center(";
-
-            typedef typename
-                spirit::result_of::argument1<Component>::type::director
-            padding;
-
-            result += padding::what(spirit::argument1(component), ctx);
-            result += ")[";
-
-            typedef typename
-                spirit::result_of::subject<Component>::type::director
-            director;
-
-            result += director::what(spirit::subject(component), ctx);
-            result += "]";
-            return result;
+            return info("center", subject.what(context));
         }
+
+        Subject subject;
+        Padding padding;
+        Width width;
     };
 
     ///////////////////////////////////////////////////////////////////////////
-    //  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.
+    // Generator generators: make_xxx function (objects)
     ///////////////////////////////////////////////////////////////////////////
-    struct full_center_aligment
+
+    // creates center[] directive generator
+    template <typename Subject, typename Modifiers>
+    struct make_directive<tag::center, Subject, Modifiers>
     {
-        template <typename Component, typename Context, typename Unused>
-        struct attribute
-          : traits::attribute_of<
-                karma::domain,
-                typename result_of::subject<Component>::type,
-                Context
-            >
+        typedef simple_center_alignment<Subject> result_type;
+        result_type operator()(unused_type, Subject const& subject
+          , unused_type) const
         {
-        };
+            return result_type(subject);
+        }
+    };
+
+    // creates center(width)[] directive generator
+    template <typename Width, typename Subject, typename Modifiers>
+    struct make_directive<
+        terminal_ex<tag::center, fusion::vector1<Width> >
+      , Subject, Modifiers
+      , typename enable_if_c< integer_traits<Width>::is_integral >::type>
+    {
+        typedef simple_center_alignment<Subject, Width> result_type;
 
-        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)
+        template <typename Terminal>
+        result_type operator()(Terminal const& term, Subject const& subject
+          , unused_type) const
         {
-            return detail::center_generate(sink, ctx, d, param,
-                subject(component), proto::child_c<0>(argument1(component)),
-                argument2(component));
+            return result_type(subject, fusion::at_c<0>(term.args));
         }
+    };
 
-        template <typename Component, typename Context>
-        static std::string what(Component const& component, Context const& ctx)
+    // creates center(pad)[] directive generator
+    template <typename Padding, typename Subject, typename Modifiers>
+    struct make_directive<
+        terminal_ex<tag::center, fusion::vector1<Padding> >
+      , Subject, Modifiers
+      , typename enable_if<spirit::traits::matches<karma::domain, Padding> >::type>
+    {
+        typedef typename
+            result_of::compile<karma::domain, Padding, Modifiers>::type
+        padding_type;
+
+        typedef padding_center_alignment<Subject, padding_type> result_type;
+
+        template <typename Terminal>
+        result_type operator()(Terminal const& term, Subject const& subject
+          , unused_type) const
         {
-            std::string result = "center(";
-
-            result += boost::lexical_cast<std::string>(
-                proto::child_c<0>(argument1(component)));
-            result += ", ";
-
-            typedef typename
-                spirit::result_of::argument2<Component>::type::director
-            padding;
-
-            result += padding::what(spirit::argument2(component), ctx);
-            result += ")[";
-
-            typedef typename
-                spirit::result_of::subject<Component>::type::director
-            director;
+            return result_type(subject
+              , compile<karma::domain>(fusion::at_c<0>(term.args)));
+        }
+    };
 
-            result += director::what(spirit::subject(component), ctx);
-            result += "]";
-            return result;
+    // creates center(pad, width)[] directive generator
+    template <typename Width, typename Padding, typename Subject
+      , typename Modifiers>
+    struct make_directive<
+        terminal_ex<tag::center, fusion::vector2<Width, Padding> >
+      , Subject, Modifiers>
+    {
+        typedef typename
+            result_of::compile<karma::domain, Padding, Modifiers>::type
+        padding_type;
+
+        typedef padding_center_alignment<Subject, padding_type, Width> result_type;
+
+        template <typename Terminal>
+        result_type operator()(Terminal const& term, Subject const& subject
+          , unused_type) const
+        {
+            return result_type(subject
+              , compile<karma::domain>(fusion::at_c<1>(term.args))
+              , fusion::at_c<0>(term.args));
         }
     };
 
Modified: trunk/boost/spirit/home/karma/directive/delimit.hpp
==============================================================================
--- trunk/boost/spirit/home/karma/directive/delimit.hpp	(original)
+++ trunk/boost/spirit/home/karma/directive/delimit.hpp	2009-04-26 10:42:24 EDT (Sun, 26 Apr 2009)
@@ -10,114 +10,161 @@
 #pragma once      // MS compatible compilers support #pragma once
 #endif
 
-#include <boost/spirit/home/support/component.hpp>
-#include <boost/spirit/home/support/attribute_of.hpp>
+#include <boost/spirit/home/karma/meta_compiler.hpp>
+#include <boost/spirit/home/karma/generator.hpp>
 #include <boost/spirit/home/karma/domain.hpp>
+#include <boost/spirit/home/karma/detail/unused_delimiter.hpp>
+#include <boost/spirit/home/karma/delimit_out.hpp>
+#include <boost/spirit/home/karma/auxiliary/lazy.hpp>
+#include <boost/spirit/home/support/unused.hpp>
+#include <boost/spirit/home/support/common_terminals.hpp>
+#include <boost/spirit/home/support/attributes.hpp>
+#include <boost/spirit/home/support/info.hpp>
 #include <boost/fusion/include/at.hpp>
-#include <boost/fusion/include/value_at.hpp>
+#include <boost/fusion/include/vector.hpp>
+
+namespace boost { namespace spirit
+{
+    ///////////////////////////////////////////////////////////////////////////
+    // Enablers
+    ///////////////////////////////////////////////////////////////////////////
+    template <>
+    struct use_directive<karma::domain, tag::delimit>   // enables delimit[]
+      : mpl::true_ {};
+
+    // enables delimit(d)[g], where d is a generator
+    template <typename T>
+    struct use_directive<karma::domain
+          , terminal_ex<tag::delimit, fusion::vector1<T> > > 
+      : boost::spirit::traits::matches<karma::domain, T> {};
+
+    // enables *lazy* delimit(d)[g]
+    template <>
+    struct use_lazy_directive<karma::domain, tag::delimit, 1> 
+      : mpl::true_ {};
+
+}}
 
 namespace boost { namespace spirit { namespace karma
 {
+    using spirit::delimit;
+    using spirit::delimit_type;
+
     ///////////////////////////////////////////////////////////////////////////
-    //  The delimit_space generator is used for delimit[...] directives.
+    //  The redelimit_generator generator is used for delimit[...] directives.
     ///////////////////////////////////////////////////////////////////////////
-    struct delimit_space
+    template <typename Subject>
+    struct redelimit_generator : unary_generator<redelimit_generator<Subject> >
     {
-        template <typename Component, typename Context, typename Unused>
+        typedef Subject subject_type;
+
+        template <typename Context, typename Unused>
         struct attribute
-          : traits::attribute_of<
-                karma::domain,
-                typename result_of::right<Component>::type,
-                Context
-            >
         {
+            typedef typename
+                traits::attribute_of<subject_type, Context>::type
+            type;
         };
 
-        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)
-        {
-            //  the delimit_space generator simply dispatches to the embedded
-            //  generator while supplying a single space as the new delimiter
-            //  to use
-            typedef typename
-                result_of::right<Component>::type::director
-            director;
+        redelimit_generator(Subject const& subject)
+          : subject(subject) {}
 
-            return director::generate(spirit::right(component),
-                sink, ctx, spirit::as_component(karma::domain(), ' '), param);
+        template <typename OutputIterator, typename Context, typename Delimiter
+          , typename Attribute>
+        bool generate(OutputIterator& sink, Context& ctx, Delimiter const& d
+          , Attribute const& attr) const
+        {
+            //  The delimit_space generator simply dispatches to the embedded
+            //  generator while supplying either the delimiter which has been 
+            //  used before a surrounding verbatim[] directive or a single 
+            //  space as the new delimiter to use (if no surrounding verbatim[]
+            //  was specified).
+            return subject.generate(sink, ctx
+              , detail::get_delimiter(d, compile<karma::domain>(' ')), attr);
         }
 
-        template <typename Component, typename Context>
-        static std::string what(Component const& component, Context const& ctx)
+        template <typename Context>
+        info what(Context& context) const
         {
-            std::string result = "delimit[";
-
-            typedef typename
-                spirit::result_of::right<Component>::type::director
-            director;
-
-            result += director::what(spirit::right(component), ctx);
-            result += "]";
-            return result;
+            return info("delimit", subject.what(context));
         }
+
+        Subject subject;
     };
 
     ///////////////////////////////////////////////////////////////////////////
-    //  The delimit_ generator is used for delimit(d)[...] directives.
+    //  The delimit_generator is used for delimit(d)[...] directives.
     ///////////////////////////////////////////////////////////////////////////
-    struct delimit_
+    template <typename Subject, typename Delimiter>
+    struct delimit_generator 
+      : unary_generator<delimit_generator<Subject, Delimiter> >
     {
-        template <typename Component, typename Context, typename Unused>
+        typedef Subject subject_type;
+        typedef Delimiter delimiter_type;
+
+        template <typename Context, typename Unused>
         struct attribute
-          : traits::attribute_of<
-                karma::domain,
-                typename result_of::subject<Component>::type,
-                Context
-            >
         {
+            typedef typename
+                traits::attribute_of<Subject, Context>::type
+            type;
         };
 
-        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)
+        delimit_generator(Subject const& subject, Delimiter const& delimiter)
+          : subject(subject), delimiter(delimiter) {}
+
+        template <typename OutputIterator, typename Context
+          , typename Delimiter_, typename Attribute>
+        bool generate(OutputIterator& sink, Context& ctx, Delimiter_ const&
+          , Attribute const& attr) const
         {
             //  the delimit generator simply dispatches to the embedded
             //  generator while supplying it's argument as the new delimiter
             //  to use
-            typedef typename
-                spirit::result_of::subject<Component>::type::director
-            director;
-
-            return director::generate(spirit::subject(component), sink, ctx,
-                spirit::as_component(
-                    karma::domain(), spirit::argument1(component)),
-                param);
+            return subject.generate(sink, ctx, delimiter, attr);
         }
 
-        template <typename Component, typename Context>
-        static std::string what(Component const& component, Context const& ctx)
+        template <typename Context>
+        info what(Context& context) const
         {
-            std::string result = "delimit(";
-
-            typedef typename
-                spirit::result_of::argument1<Component>::type::director
-            delimiter;
+            return info("delimit", subject.what(context));
+        }
 
-            result += delimiter::what(spirit::argument1(component), ctx);
-            result +=")[";
+        Subject subject;
+        Delimiter delimiter;
+    };
 
-            typedef typename
-                spirit::result_of::subject<Component>::type::director
-            director;
+    ///////////////////////////////////////////////////////////////////////////
+    // Generator generators: make_xxx function (objects)
+    ///////////////////////////////////////////////////////////////////////////
+    template <typename Subject, typename Modifiers>
+    struct make_directive<tag::delimit, Subject, Modifiers>
+    {
+        typedef redelimit_generator<Subject> result_type;
+        result_type operator()(unused_type, Subject const& subject
+          , unused_type) const
+        {
+            return result_type(subject);
+        }
+    };
 
-            result += director::what(spirit::subject(component), ctx);
-            result += "]";
-            return result;
+    template <typename Delimiter, typename Subject, typename Modifiers>
+    struct make_directive<
+        terminal_ex<tag::delimit, fusion::vector1<Delimiter> >
+      , Subject, Modifiers>
+    {
+        typedef typename
+            result_of::compile<karma::domain, Delimiter, Modifiers>::type
+        delimiter_type;
+
+        typedef delimit_generator<Subject, delimiter_type> result_type;
+
+        template <typename Terminal>
+        result_type operator()(Terminal const& term, Subject const& subject
+          , unused_type) const
+        {
+            return result_type(subject
+              , compile<karma::domain>(fusion::at_c<0>(term.args)));
         }
     };
 
Deleted: trunk/boost/spirit/home/karma/directive/delimiter_meta_grammar.hpp
==============================================================================
--- trunk/boost/spirit/home/karma/directive/delimiter_meta_grammar.hpp	2009-04-26 10:42:24 EDT (Sun, 26 Apr 2009)
+++ (empty file)
@@ -1,87 +0,0 @@
-//  Copyright (c) 2001-2009 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_DELIMITER_META_GRAMMAR_FEB_21_2007_0826PM)
-#define BOOST_SPIRIT_KARMA_DELIMITER_META_GRAMMAR_FEB_21_2007_0826PM
-
-#if defined(_MSC_VER) && (_MSC_VER >= 1020)
-#pragma once      // MS compatible compilers support #pragma once
-#endif
-
-#include <boost/spirit/home/support/modifier.hpp>
-#include <boost/spirit/home/support/meta_grammar.hpp>
-#include <boost/spirit/home/karma/domain.hpp>
-#include <boost/utility/enable_if.hpp>
-#include <boost/mpl/if.hpp>
-#include <boost/mpl/or.hpp>
-
-namespace boost { namespace spirit { namespace karma
-{
-    ///////////////////////////////////////////////////////////////////////////
-    // forwards
-    ///////////////////////////////////////////////////////////////////////////
-    struct main_meta_grammar;
-    
-    struct delimit_;
-    struct delimit_space;
-    struct verbatim;
-    
-    ///////////////////////////////////////////////////////////////////////////
-    template <typename Expr, typename Enable>
-    struct is_valid_expr;
-
-    template <typename Expr, typename Enable>
-    struct expr_transform;
-
-    ///////////////////////////////////////////////////////////////////////////
-    //  delimit and verbatim directive meta-grammars
-    //  delimit[...], delimit(delimiter)[...] and verbatim[...]
-    ///////////////////////////////////////////////////////////////////////////
-    struct delimiter_directive_meta_grammar
-      : proto::or_<
-            meta_grammar::binary_rule<
-                karma::domain, proto::tag::subscript, verbatim,
-                proto::terminal<tag::verbatim>, main_meta_grammar
-            >,
-            meta_grammar::binary_rule<
-                karma::domain, proto::tag::subscript, delimit_space,
-                proto::terminal<tag::delimit>, main_meta_grammar
-            >,
-            meta_grammar::subscript_function1_rule<
-                karma::domain, tag::delimit, delimit_,
-                main_meta_grammar, main_meta_grammar
-            >
-        >
-    {};
-
-    ///////////////////////////////////////////////////////////////////////////
-    //  These specializations non-intrusively hook into the Karma meta-grammar.
-    //  (see karma/meta_grammar.hpp)
-    ///////////////////////////////////////////////////////////////////////////  
-    template <typename Expr>
-    struct is_valid_expr<
-            Expr,
-            typename enable_if<
-                proto::matches<Expr, delimiter_directive_meta_grammar> 
-            >::type
-        >
-      : mpl::true_
-    {
-    };
-
-    template <typename Expr>
-    struct expr_transform<
-            Expr,
-            typename enable_if<
-                proto::matches<Expr, delimiter_directive_meta_grammar> 
-            >::type
-        >
-      : mpl::identity<delimiter_directive_meta_grammar>
-    {
-    };
-    
-}}}
-
-#endif
Modified: trunk/boost/spirit/home/karma/directive/left_alignment.hpp
==============================================================================
--- trunk/boost/spirit/home/karma/directive/left_alignment.hpp	(original)
+++ trunk/boost/spirit/home/karma/directive/left_alignment.hpp	2009-04-26 10:42:24 EDT (Sun, 26 Apr 2009)
@@ -10,111 +10,137 @@
 #pragma once      // MS compatible compilers support #pragma once
 #endif
 
-#include <boost/spirit/home/support/component.hpp>
-#include <boost/spirit/home/support/attribute_of.hpp>
+#include <boost/spirit/home/karma/meta_compiler.hpp>
+#include <boost/spirit/home/karma/generator.hpp>
 #include <boost/spirit/home/karma/domain.hpp>
-#include <boost/spirit/home/karma/directive/detail/left_alignment_generate.hpp>
+#include <boost/spirit/home/karma/detail/output_iterator.hpp>
+#include <boost/spirit/home/karma/detail/default_width.hpp>
+#include <boost/spirit/home/karma/delimit_out.hpp>
+#include <boost/spirit/home/karma/auxiliary/lazy.hpp>
+#include <boost/spirit/home/support/unused.hpp>
+#include <boost/spirit/home/support/common_terminals.hpp>
+#include <boost/spirit/home/support/attributes.hpp>
+#include <boost/spirit/home/support/info.hpp>
+#include <boost/spirit/home/support/unused.hpp>
+#include <boost/fusion/include/at.hpp>
+#include <boost/fusion/include/vector.hpp>
 #include <boost/lexical_cast.hpp>
+#include <boost/integer_traits.hpp>
+#include <boost/mpl/bool.hpp>
+#include <boost/utility/enable_if.hpp>
 
 ///////////////////////////////////////////////////////////////////////////////
-//
-//  The BOOST_KARMA_DEFAULT_FIELD_LENGTH specifies the default field length
-//  to be used for padding.
-//
-///////////////////////////////////////////////////////////////////////////////
-#if !defined(BOOST_KARMA_DEFAULT_FIELD_LENGTH)
-#define BOOST_KARMA_DEFAULT_FIELD_LENGTH 10
-#endif
-
-namespace boost { namespace spirit { namespace karma
+namespace boost { namespace spirit
 {
     ///////////////////////////////////////////////////////////////////////////
-    //  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).
+    // Enablers
     ///////////////////////////////////////////////////////////////////////////
-    struct simple_left_aligment
-    {
-        template <typename Component, typename Context, typename Unused>
-        struct attribute
-          : traits::attribute_of<
-                karma::domain,
-                typename result_of::argument1<Component>::type,
-                Context
-            >
-        {
-        };
 
-        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)
-        {
-            return detail::left_align_generate(sink, ctx, d, param,
-                argument1(component), BOOST_KARMA_DEFAULT_FIELD_LENGTH, ' ');
-        }
+    // enables left_align[]
+    template <>
+    struct use_directive<karma::domain, tag::left_align>
+      : mpl::true_ {};
+
+    // enables left_align(d)[g] and left_align(w)[g], where d is a generator
+    // and w is a maximum width
+    template <typename T>
+    struct use_directive<karma::domain
+          , terminal_ex<tag::left_align, fusion::vector1<T> > >
+      : mpl::true_ {};
+
+    // enables *lazy* delimit(d)[g], where d provides a generator
+    template <>
+    struct use_lazy_directive<karma::domain, tag::left_align, 1> 
+      : mpl::true_ {};
+
+    // enables left_align(w, d)[g], where d is a generator and w is a maximum 
+    // width
+    template <typename Width, typename Padding>
+    struct use_directive<karma::domain
+          , terminal_ex<tag::left_align, fusion::vector2<Width, Padding> > >
+      : spirit::traits::matches<karma::domain, Padding> {};
+
+    // enables *lazy* delimit(w, d)[g], where d provides a generator and w is 
+    // a maximum width
+    template <>
+    struct use_lazy_directive<karma::domain, tag::left_align, 2> 
+      : mpl::true_ {};
 
-        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
-            director;
+///////////////////////////////////////////////////////////////////////////////
+namespace boost { namespace spirit { namespace karma
+{
+    using spirit::left_align;
+    using spirit::left_align_type;
 
-            result += director::what(spirit::argument1(component), ctx);
-            result += "]";
-            return result;
+    namespace detail
+    {
+        ///////////////////////////////////////////////////////////////////////
+        //  The left_align_generate template function is used for all the 
+        //  different flavors of the left_align[] directive. 
+        ///////////////////////////////////////////////////////////////////////
+        template <typename OutputIterator, typename Context, typename Delimiter, 
+            typename Attribute, typename Embedded, typename Padding>
+        inline static bool 
+        left_align_generate(OutputIterator& sink, Context& ctx, 
+            Delimiter const& d, Attribute const& attr, Embedded const& e, 
+            unsigned int const width, Padding const& p) 
+        {
+            // wrap the given output iterator to allow counting
+            detail::enable_counting<OutputIterator> counting(sink);
+
+            // first generate the underlying output 
+            bool r = e.generate(sink, ctx, d, attr);
+
+            // pad the output until the max width is reached
+            while(r && counting.count() < width) 
+                r = p.generate(sink, ctx, unused, unused);
+
+            return r;
         }
-    };
+    }
 
     ///////////////////////////////////////////////////////////////////////////
-    //  The left alignment with width directive, is used for generators
-    //  like left_align(width)[...]. It uses a default value for the padding
+    //  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).
     ///////////////////////////////////////////////////////////////////////////
-    struct width_left_aligment
+    template <typename Subject, typename Width = detail::default_width>
+    struct simple_left_alignment 
+      : unary_generator<simple_left_alignment<Subject, Width> >
     {
-        template <typename Component, typename Context, typename Unused>
+        typedef Subject subject_type;
+
+        template <typename Context, typename Unused>
         struct attribute
-          : traits::attribute_of<
-                karma::domain,
-                typename result_of::subject<Component>::type,
-                Context
-            >
         {
+            typedef typename
+                traits::attribute_of<subject_type, Context>::type
+            type;
         };
 
-        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)
+        simple_left_alignment(Subject const& subject, Width width = Width())
+          : subject(subject), width(width) {}
+
+        template <typename OutputIterator, typename Context, typename Delimiter
+          , typename Attribute>
+        bool generate(OutputIterator& sink, Context& ctx, Delimiter const& d
+          , Attribute const& attr) const
         {
-            return detail::left_align_generate(sink, ctx, d, param,
-                subject(component), proto::child_c<0>(argument1(component)), ' ');
+            return detail::left_align_generate(sink, ctx, d, attr,
+                subject, width, compile<karma::domain>(' '));
         }
 
-        template <typename Component, typename Context>
-        static std::string what(Component const& component, Context const& ctx)
+        template <typename Context>
+        info what(Context& context) const
         {
-            std::string result = "left_align(";
-
-            result += boost::lexical_cast<std::string>(
-                proto::child_c<0>(argument1(component)));
-            result += ")[";
-
-            typedef typename
-                spirit::result_of::subject<Component>::type::director
-            director;
-
-            result += director::what(spirit::subject(component), ctx);
-            result += "]";
-            return result;
+            return info("left_align", subject.what(context));
         }
+
+        Subject subject;
+        Width width;
     };
 
     ///////////////////////////////////////////////////////////////////////////
@@ -123,103 +149,121 @@
     //  expression. It uses a default value for the generated width (defined
     //  via the BOOST_KARMA_DEFAULT_FIELD_LENGTH constant).
     ///////////////////////////////////////////////////////////////////////////
-    struct padding_left_aligment
+    template <typename Subject, typename Padding
+      , typename Width = detail::default_width>
+    struct padding_left_alignment 
+      : unary_generator<padding_left_alignment<Subject, Padding, Width> >
     {
-        template <typename Component, typename Context, typename Unused>
+        typedef Subject subject_type;
+        typedef Padding padding_type;
+
+        template <typename Context, typename Unused>
         struct attribute
-          : traits::attribute_of<
-                karma::domain,
-                typename result_of::subject<Component>::type,
-                Context
-            >
         {
+            typedef typename
+                traits::attribute_of<Subject, Context>::type
+            type;
         };
 
-        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)
+        padding_left_alignment(Subject const& subject, Padding const& padding
+              , Width width = Width())
+          : subject(subject), padding(padding), width(width) {}
+
+        template <typename OutputIterator, typename Context, typename Delimiter
+          , typename Attribute>
+        bool generate(OutputIterator& sink, Context& ctx, Delimiter const& d
+          , Attribute const& attr) const
         {
-            return detail::left_align_generate(sink, ctx, d, param,
-                subject(component), BOOST_KARMA_DEFAULT_FIELD_LENGTH,
-                argument1(component));
+            return detail::left_align_generate(sink, ctx, d, attr,
+                subject, width, padding);
         }
 
-        template <typename Component, typename Context>
-        static std::string what(Component const& component, Context const& ctx)
+        template <typename Context>
+        info what(Context& context) const
         {
-            std::string result = "left_align(";
-
-            typedef typename
-                spirit::result_of::argument1<Component>::type::director
-            padding;
-
-            result += padding::what(spirit::argument1(component), ctx);
-            result += ")[";
-
-            typedef typename
-                spirit::result_of::subject<Component>::type::director
-            director;
-
-            result += director::what(spirit::subject(component), ctx);
-            result += "]";
-            return result;
+            return info("left_align", subject.what(context));
         }
+
+        Subject subject;
+        Padding padding;
+        Width width;
     };
 
     ///////////////////////////////////////////////////////////////////////////
-    //  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.
+    // Generator generators: make_xxx function (objects)
     ///////////////////////////////////////////////////////////////////////////
-    struct full_left_aligment
+
+    // creates left_align[] directive generator
+    template <typename Subject, typename Modifiers>
+    struct make_directive<tag::left_align, Subject, Modifiers>
     {
-        template <typename Component, typename Context, typename Unused>
-        struct attribute
-          : traits::attribute_of<
-                karma::domain,
-                typename result_of::subject<Component>::type,
-                Context
-            >
+        typedef simple_left_alignment<Subject> result_type;
+        result_type operator()(unused_type, Subject const& subject
+          , unused_type) const
         {
-        };
+            return result_type(subject);
+        }
+    };
+
+    // creates left_align(width)[] directive generator
+    template <typename Width, typename Subject, typename Modifiers>
+    struct make_directive<
+        terminal_ex<tag::left_align, fusion::vector1<Width> >
+      , Subject, Modifiers
+      , typename enable_if_c< integer_traits<Width>::is_integral >::type>
+    {
+        typedef simple_left_alignment<Subject, Width> result_type;
 
-        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)
+        template <typename Terminal>
+        result_type operator()(Terminal const& term, Subject const& subject
+          , unused_type) const
         {
-            return detail::left_align_generate(sink, ctx, d, param,
-                subject(component), proto::child_c<0>(argument1(component)),
-                argument2(component));
+            return result_type(subject, fusion::at_c<0>(term.args));
         }
+    };
 
-        template <typename Component, typename Context>
-        static std::string what(Component const& component, Context const& ctx)
+    // creates left_align(pad)[] directive generator
+    template <typename Padding, typename Subject, typename Modifiers>
+    struct make_directive<
+        terminal_ex<tag::left_align, fusion::vector1<Padding> >
+      , Subject, Modifiers
+      , typename enable_if<spirit::traits::matches<karma::domain, Padding> >::type>
+    {
+        typedef typename
+            result_of::compile<karma::domain, Padding, Modifiers>::type
+        padding_type;
+
+        typedef padding_left_alignment<Subject, padding_type> result_type;
+
+        template <typename Terminal>
+        result_type operator()(Terminal const& term, Subject const& subject
+          , unused_type) const
         {
-            std::string result = "left_align(";
-
-            result += boost::lexical_cast<std::string>(
-                proto::child_c<0>(argument1(component)));
-            result += ", ";
-
-            typedef typename
-                spirit::result_of::argument2<Component>::type::director
-            padding;
-
-            result += padding::what(spirit::argument2(component), ctx);
-            result += ")[";
-
-            typedef typename
-                spirit::result_of::subject<Component>::type::director
-            director;
+            return result_type(subject
+              , compile<karma::domain>(fusion::at_c<0>(term.args)));
+        }
+    };
 
-            result += director::what(spirit::subject(component), ctx);
-            result += "]";
-            return result;
+    // creates left_align(pad, width)[] directive generator
+    template <typename Width, typename Padding, typename Subject
+      , typename Modifiers>
+    struct make_directive<
+        terminal_ex<tag::left_align, fusion::vector2<Width, Padding> >
+      , Subject, Modifiers>
+    {
+        typedef typename
+            result_of::compile<karma::domain, Padding, Modifiers>::type
+        padding_type;
+
+        typedef padding_left_alignment<Subject, padding_type, Width> result_type;
+
+        template <typename Terminal>
+        result_type operator()(Terminal const& term, Subject const& subject
+          , unused_type) const
+        {
+            return result_type(subject
+              , compile<karma::domain>(fusion::at_c<1>(term.args))
+              , fusion::at_c<0>(term.args));
         }
     };
 
Added: trunk/boost/spirit/home/karma/directive/maxwidth.hpp
==============================================================================
--- (empty file)
+++ trunk/boost/spirit/home/karma/directive/maxwidth.hpp	2009-04-26 10:42:24 EDT (Sun, 26 Apr 2009)
@@ -0,0 +1,224 @@
+//  Copyright (c) 2001-2009 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_MAXWIDTH_MAR_18_2009_0827AM)
+#define BOOST_SPIRIT_KARMA_MAXWIDTH_MAR_18_2009_0827AM
+
+#if defined(_MSC_VER) && (_MSC_VER >= 1020)
+#pragma once      // MS compatible compilers support #pragma once
+#endif
+
+#include <boost/spirit/home/karma/meta_compiler.hpp>
+#include <boost/spirit/home/karma/generator.hpp>
+#include <boost/spirit/home/karma/domain.hpp>
+#include <boost/spirit/home/karma/detail/output_iterator.hpp>
+#include <boost/spirit/home/karma/detail/default_width.hpp>
+#include <boost/spirit/home/karma/delimit_out.hpp>
+#include <boost/spirit/home/karma/auxiliary/lazy.hpp>
+#include <boost/spirit/home/support/unused.hpp>
+#include <boost/spirit/home/support/common_terminals.hpp>
+#include <boost/spirit/home/support/attributes.hpp>
+#include <boost/spirit/home/support/info.hpp>
+#include <boost/spirit/home/support/unused.hpp>
+#include <boost/fusion/include/at.hpp>
+#include <boost/fusion/include/vector.hpp>
+#include <boost/lexical_cast.hpp>
+
+///////////////////////////////////////////////////////////////////////////////
+namespace boost { namespace spirit
+{
+    ///////////////////////////////////////////////////////////////////////////
+    // Enablers
+    ///////////////////////////////////////////////////////////////////////////
+
+    // enables maxwidth[]
+    template <>
+    struct use_directive<karma::domain, tag::maxwidth>
+      : mpl::true_ {};
+
+    // enables maxwidth(w)[g], where w provides a maxwidth
+    template <typename T>
+    struct use_directive<karma::domain
+          , terminal_ex<tag::maxwidth, fusion::vector1<T> > > 
+      : mpl::true_ {};
+
+    // enables *lazy* maxwidth(w)[g], where w provides a maxwidth
+    template <>
+    struct use_lazy_directive<karma::domain, tag::maxwidth, 1> 
+      : mpl::true_ {};
+
+//     // enables maxwidth(w, r)[g], where w provides a maxwidth and r is a output
+//     // iterator used to receive the rest of the output not fitting into the 
+//     // maxwidth limit
+//     template <typename T, typename RestIter>
+//     struct use_directive<karma::domain
+//           , terminal_ex<tag::maxwidth, fusion::vector2<T, RestIter> > > 
+//       : mpl::true_ {};
+// 
+//     // enables *lazy* maxwidth(w, r)[g], where w provides a maxwidth and r is 
+//     // a output iterator used to receive the rest of the output not fitting 
+//     // into the maxwidth limit
+//     template <>
+//     struct use_lazy_directive<karma::domain, tag::maxwidth, 2> 
+//       : mpl::true_ {};
+
+}}
+
+///////////////////////////////////////////////////////////////////////////////
+namespace boost { namespace spirit { namespace karma
+{
+    using spirit::maxwidth;
+    using spirit::maxwidth_type;
+
+    namespace detail
+    {
+        ///////////////////////////////////////////////////////////////////////
+        template <typename OutputIterator, typename T>
+        bool buffer_copy_rest(detail::enable_buffering<OutputIterator>& buff
+          , std::size_t start_at, T& dest)
+        {
+            // not implemented yet
+            return true; // buff.buffer_copy_rest(start_at);
+        }
+
+        template <typename OutputIterator>
+        bool buffer_copy_rest(detail::enable_buffering<OutputIterator>& buff
+          , std::size_t start_at, unused_type)
+        {
+            return true;
+        }
+
+        ///////////////////////////////////////////////////////////////////////
+        //  The maxwidth_generate template function is used for all the 
+        //  different flavors of the maxwidth[] directive. 
+        ///////////////////////////////////////////////////////////////////////
+        template <typename OutputIterator, typename Context, typename Delimiter, 
+            typename Attribute, typename Embedded, typename Rest>
+        inline static bool 
+        maxwidth_generate(OutputIterator& sink, Context& ctx, 
+            Delimiter const& d, Attribute const& attr, Embedded const& e, 
+            unsigned int const maxwidth, Rest& restdest) 
+        {
+            // wrap the given output iterator to allow buffering, but disable 
+            // counting
+            detail::enable_buffering<OutputIterator> buffering(sink);
+
+            // generate the underlying output and copy the embedded 
+            // output to the target output iterator applying the given 
+            // maxwidth
+            bool r = false;
+
+            {            
+                detail::disable_counting<OutputIterator> nocounting(sink);
+                r = e.generate(sink, ctx, d, attr);
+            }   // re-enable counting
+            
+            return r && buffering.buffer_copy(maxwidth) &&
+                   buffer_copy_rest(buffering, maxwidth, restdest);
+        }
+    }
+
+    ///////////////////////////////////////////////////////////////////////////
+    //  The maxwidth directive is used for maxwidth[...]
+    //  generators. It uses default values for the generated width (defined via
+    //  the BOOST_KARMA_DEFAULT_FIELD_MAXWIDTH constant).
+    // 
+    //  The maxwidth with width directive, is used for generators
+    //  like maxwidth(width)[...]. 
+    ///////////////////////////////////////////////////////////////////////////
+    template <typename Subject, typename Width = detail::default_max_width
+      , typename Rest = unused_type>
+    struct maxwidth_width
+      : unary_generator<maxwidth_width<Subject, Width, Rest> >
+    {
+        typedef Subject subject_type;
+
+        template <typename Context, typename Unused>
+        struct attribute
+        {
+            typedef typename
+                traits::attribute_of<subject_type, Context>::type
+            type;
+        };
+
+        maxwidth_width(Subject const& subject, Width const& w = Width()
+            , Rest const& r = Rest())
+          : subject(subject), width(w), rest(r) {}
+
+        template <typename OutputIterator, typename Context, typename Delimiter
+          , typename Attribute>
+        bool generate(OutputIterator& sink, Context& ctx, Delimiter const& d
+          , Attribute const& attr) const
+        {
+            return detail::maxwidth_generate(sink, ctx, d, attr, subject
+              , width, rest);
+        }
+
+        template <typename Context>
+        info what(Context& context) const
+        {
+            return info("maxwidth", subject.what(context));
+        }
+
+        Subject subject;
+        Width width;
+        Rest rest;
+    };
+
+    ///////////////////////////////////////////////////////////////////////////
+    // Generator generators: make_xxx function (objects)
+    ///////////////////////////////////////////////////////////////////////////
+
+    // creates left_align[] directive generator
+    template <typename Subject, typename Modifiers>
+    struct make_directive<tag::maxwidth, Subject, Modifiers>
+    {
+        typedef maxwidth_width<Subject> result_type;
+        result_type operator()(unused_type, Subject const& subject
+          , unused_type) const
+        {
+            return result_type(subject);
+        }
+    };
+
+    // creates maxwidth(width)[] directive generator
+    template <typename T, typename Subject, typename Modifiers>
+    struct make_directive<
+        terminal_ex<tag::maxwidth, fusion::vector1<T> >
+      , Subject, Modifiers>
+    {
+        typedef maxwidth_width<Subject, T> result_type;
+
+        template <typename Terminal>
+        result_type operator()(Terminal const& term, Subject const& subject
+          , unused_type) const
+        {
+            return result_type(subject, fusion::at_c<0>(term.args), unused);
+        }
+    };
+
+//     // creates maxwidth(width, restiter)[] directive generator
+//     template <
+//         typename T, typename RestIter, typename Subject, typename Modifiers>
+//     struct make_directive<
+//         terminal_ex<tag::maxwidth, fusion::vector2<T, RestIter> >
+//       , Subject, Modifiers>
+//     {
+//         typedef maxwidth_width<Subject, T, RestIter> result_type;
+// 
+//         template <typename Terminal>
+//         result_type operator()(Terminal const& term, Subject const& subject
+//           , unused_type) const
+//         {
+//             return result_type(subject, fusion::at_c<0>(term.args)
+//               , fusion::at_c<1>(term.args));
+//         }
+//     };
+
+}}} // namespace boost::spirit::karma
+
+#endif
+
+
Modified: trunk/boost/spirit/home/karma/directive/right_alignment.hpp
==============================================================================
--- trunk/boost/spirit/home/karma/directive/right_alignment.hpp	(original)
+++ trunk/boost/spirit/home/karma/directive/right_alignment.hpp	2009-04-26 10:42:24 EDT (Sun, 26 Apr 2009)
@@ -10,217 +10,270 @@
 #pragma once      // MS compatible compilers support #pragma once
 #endif
 
-#include <boost/spirit/home/support/component.hpp>
-#include <boost/spirit/home/support/attribute_of.hpp>
+#include <boost/spirit/home/karma/meta_compiler.hpp>
+#include <boost/spirit/home/karma/generator.hpp>
 #include <boost/spirit/home/karma/domain.hpp>
-#include <boost/spirit/home/karma/directive/detail/right_alignment_generate.hpp>
+#include <boost/spirit/home/karma/detail/output_iterator.hpp>
+#include <boost/spirit/home/karma/detail/default_width.hpp>
+#include <boost/spirit/home/karma/delimit_out.hpp>
+#include <boost/spirit/home/karma/auxiliary/lazy.hpp>
+#include <boost/spirit/home/support/unused.hpp>
+#include <boost/spirit/home/support/common_terminals.hpp>
+#include <boost/spirit/home/support/attributes.hpp>
+#include <boost/spirit/home/support/info.hpp>
+#include <boost/spirit/home/support/unused.hpp>
+#include <boost/fusion/include/at.hpp>
+#include <boost/fusion/include/vector.hpp>
 #include <boost/lexical_cast.hpp>
+#include <boost/integer_traits.hpp>
+#include <boost/mpl/bool.hpp>
+#include <boost/utility/enable_if.hpp>
 
 ///////////////////////////////////////////////////////////////////////////////
-//
-//  The BOOST_KARMA_DEFAULT_FIELD_LENGTH specifies the default field length
-//  to be used for padding.
-//
-///////////////////////////////////////////////////////////////////////////////
-#if !defined(BOOST_KARMA_DEFAULT_FIELD_LENGTH)
-#define BOOST_KARMA_DEFAULT_FIELD_LENGTH 10
-#endif
-
-namespace boost { namespace spirit { namespace karma
+namespace boost { namespace spirit
 {
     ///////////////////////////////////////////////////////////////////////////
-    //  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).
+    // Enablers
     ///////////////////////////////////////////////////////////////////////////
-    struct simple_right_aligment
-    {
-        template <typename Component, typename Context, typename Unused>
-        struct attribute
-          : traits::attribute_of<
-                karma::domain,
-                typename result_of::argument1<Component>::type,
-                Context
-            >
-        {
-        };
 
-        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)
-        {
-            return detail::right_align_generate(sink, ctx, d, param,
-                argument1(component), BOOST_KARMA_DEFAULT_FIELD_LENGTH,
-                spirit::as_component(karma::domain(), ' '));
-        }
+    // enables right_align[]
+    template <>
+    struct use_directive<karma::domain, tag::right_align>
+      : mpl::true_ {};
+
+    // enables right_align(d)[g] and right_align(w)[g], where d is a generator
+    // and w is a maximum width
+    template <typename T>
+    struct use_directive<karma::domain
+          , terminal_ex<tag::right_align, fusion::vector1<T> > >
+      : mpl::true_ {};
+
+    // enables *lazy* delimit(d)[g], where d provides a generator
+    template <>
+    struct use_lazy_directive<karma::domain, tag::right_align, 1> 
+      : mpl::true_ {};
+
+    // enables right_align(w, d)[g], where d is a generator and w is a maximum 
+    // width
+    template <typename Width, typename Padding>
+    struct use_directive<karma::domain
+          , terminal_ex<tag::right_align, fusion::vector2<Width, Padding> > >
+      : spirit::traits::matches<karma::domain, Padding> {};
+
+    // enables *lazy* delimit(w, d)[g], where d provides a generator and w is 
+    // a maximum width
+    template <>
+    struct use_lazy_directive<karma::domain, tag::right_align, 2> 
+      : mpl::true_ {};
 
-        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
-            director;
+///////////////////////////////////////////////////////////////////////////////
+namespace boost { namespace spirit { namespace karma
+{
+    using spirit::right_align;
+    using spirit::right_align_type;
 
-            result += director::what(spirit::argument1(component), ctx);
-            result += "]";
-            return result;
+    namespace detail
+    {
+        ///////////////////////////////////////////////////////////////////////
+        //  The right_align_generate template function is used for all the 
+        //  different flavors of the right_align[] directive. 
+        ///////////////////////////////////////////////////////////////////////
+        template <typename OutputIterator, typename Context, typename Delimiter, 
+            typename Attribute, typename Embedded, typename Padding>
+        inline static bool 
+        right_align_generate(OutputIterator& sink, Context& ctx, 
+            Delimiter const& d, Attribute const& attr, Embedded const& e, 
+            unsigned int const width, Padding const& p) 
+        {
+            // wrap the given output iterator to allow left padding
+            detail::enable_buffering<OutputIterator> buffering(sink, width);
+            bool r = false;
+
+            // first generate the embedded output 
+            {
+                detail::disable_counting<OutputIterator> nocounting(sink);
+                r = e.generate(sink, ctx, d, attr);
+            }   // re-enable counting
+
+            buffering.disable();    // do not perform buffering any more
+            
+            // generate the left padding
+            detail::enable_counting<OutputIterator> counting(sink, buffering.buffer_size());
+            while(r && counting.count() < width) 
+                r = p.generate(sink, ctx, unused, unused);
+
+            // copy the buffered output to the target output iterator
+            if (r) 
+                buffering.buffer_copy();
+            return r;
         }
-    };
+    }
 
     ///////////////////////////////////////////////////////////////////////////
-    //  The right alignment with width directive, is used for generators
-    //  like right_align(width)[...]. It uses a default value for the padding
+    //  The simple left 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).
     ///////////////////////////////////////////////////////////////////////////
-    struct width_right_aligment
+    template <typename Subject, typename Width = detail::default_width>
+    struct simple_right_alignment 
+      : unary_generator<simple_right_alignment<Subject, Width> >
     {
-        template <typename Component, typename Context, typename Unused>
+        typedef Subject subject_type;
+
+        template <typename Context, typename Unused>
         struct attribute
-          : traits::attribute_of<
-                karma::domain,
-                typename result_of::subject<Component>::type,
-                Context
-            >
         {
+            typedef typename
+                traits::attribute_of<subject_type, Context>::type
+            type;
         };
 
-        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)
+        simple_right_alignment(Subject const& subject, Width width = Width())
+          : subject(subject), width(width) {}
+
+        template <typename OutputIterator, typename Context, typename Delimiter
+          , typename Attribute>
+        bool generate(OutputIterator& sink, Context& ctx, Delimiter const& d
+          , Attribute const& attr) const
         {
-            return detail::right_align_generate(sink, ctx, d, param,
-                subject(component), proto::child_c<0>(argument1(component)), ' ');
+            return detail::right_align_generate(sink, ctx, d, attr,
+                subject, width, compile<karma::domain>(' '));
         }
 
-        template <typename Component, typename Context>
-        static std::string what(Component const& component, Context const& ctx)
+        template <typename Context>
+        info what(Context& context) const
         {
-            std::string result = "right_align(";
-
-            result += boost::lexical_cast<std::string>(
-                proto::child_c<0>(argument1(component)));
-            result += ")[";
-
-            typedef typename
-                spirit::result_of::subject<Component>::type::director
-            director;
-
-            result += director::what(spirit::subject(component), ctx);
-            result += "]";
-            return result;
+            return info("right_align", subject.what(context));
         }
+
+        Subject subject;
+        Width width;
     };
 
     ///////////////////////////////////////////////////////////////////////////
-    //  The right alignment directive with padding, is used for generators like
+    //  The left 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
     //  via the BOOST_KARMA_DEFAULT_FIELD_LENGTH constant).
     ///////////////////////////////////////////////////////////////////////////
-    struct padding_right_aligment
+    template <typename Subject, typename Padding
+      , typename Width = detail::default_width>
+    struct padding_right_alignment 
+      : unary_generator<padding_right_alignment<Subject, Padding, Width> >
     {
-        template <typename Component, typename Context, typename Unused>
+        typedef Subject subject_type;
+        typedef Padding padding_type;
+
+        template <typename Context, typename Unused>
         struct attribute
-          : traits::attribute_of<
-                karma::domain,
-                typename result_of::subject<Component>::type,
-                Context
-            >
         {
+            typedef typename
+                traits::attribute_of<Subject, Context>::type
+            type;
         };
 
-        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)
+        padding_right_alignment(Subject const& subject, Padding const& padding
+              , Width width = Width())
+          : subject(subject), padding(padding), width(width) {}
+
+        template <typename OutputIterator, typename Context, typename Delimiter
+          , typename Attribute>
+        bool generate(OutputIterator& sink, Context& ctx, Delimiter const& d
+          , Attribute const& attr) const
         {
-            return detail::right_align_generate(sink, ctx, d, param,
-                subject(component), BOOST_KARMA_DEFAULT_FIELD_LENGTH,
-                argument1(component));
+            return detail::right_align_generate(sink, ctx, d, attr,
+                subject, width, padding);
         }
 
-        template <typename Component, typename Context>
-        static std::string what(Component const& component, Context const& ctx)
+        template <typename Context>
+        info what(Context& context) const
         {
-            std::string result = "right_align(";
-
-            typedef typename
-                spirit::result_of::argument1<Component>::type::director
-            padding;
-
-            result += padding::what(spirit::argument1(component), ctx);
-            result += ")[";
-
-            typedef typename
-                spirit::result_of::subject<Component>::type::director
-            director;
-
-            result += director::what(spirit::subject(component), ctx);
-            result += "]";
-            return result;
+            return info("right_align", subject.what(context));
         }
+
+        Subject subject;
+        Padding padding;
+        Width width;
     };
 
     ///////////////////////////////////////////////////////////////////////////
-    //  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.
+    // Generator generators: make_xxx function (objects)
     ///////////////////////////////////////////////////////////////////////////
-    struct full_right_aligment
+
+    // creates right_align[] directive generator
+    template <typename Subject, typename Modifiers>
+    struct make_directive<tag::right_align, Subject, Modifiers>
     {
-        template <typename Component, typename Context, typename Unused>
-        struct attribute
-          : traits::attribute_of<
-                karma::domain,
-                typename result_of::subject<Component>::type,
-                Context
-            >
+        typedef simple_right_alignment<Subject> result_type;
+        result_type operator()(unused_type, Subject const& subject
+          , unused_type) const
         {
-        };
+            return result_type(subject);
+        }
+    };
+
+    // creates right_align(width)[] directive generator
+    template <typename Width, typename Subject, typename Modifiers>
+    struct make_directive<
+        terminal_ex<tag::right_align, fusion::vector1<Width> >
+      , Subject, Modifiers
+      , typename enable_if_c< integer_traits<Width>::is_integral >::type>
+    {
+        typedef simple_right_alignment<Subject, Width> result_type;
 
-        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)
+        template <typename Terminal>
+        result_type operator()(Terminal const& term, Subject const& subject
+          , unused_type) const
         {
-            return detail::right_align_generate(sink, ctx, d, param,
-                subject(component), proto::child_c<0>(argument1(component)),
-                argument2(component));
+            return result_type(subject, fusion::at_c<0>(term.args));
         }
+    };
 
-        template <typename Component, typename Context>
-        static std::string what(Component const& component, Context const& ctx)
+    // creates right_align(pad)[] directive generator
+    template <typename Padding, typename Subject, typename Modifiers>
+    struct make_directive<
+        terminal_ex<tag::right_align, fusion::vector1<Padding> >
+      , Subject, Modifiers
+      , typename enable_if<spirit::traits::matches<karma::domain, Padding> >::type>
+    {
+        typedef typename
+            result_of::compile<karma::domain, Padding, Modifiers>::type
+        padding_type;
+
+        typedef padding_right_alignment<Subject, padding_type> result_type;
+
+        template <typename Terminal>
+        result_type operator()(Terminal const& term, Subject const& subject
+          , unused_type) const
         {
-            std::string result = "right_align(";
-
-            result += boost::lexical_cast<std::string>(
-                proto::child_c<0>(argument1(component)));
-            result += ", ";
-
-            typedef typename
-                spirit::result_of::argument2<Component>::type::director
-            padding;
-
-            result += padding::what(spirit::argument2(component), ctx);
-            result += ")[";
-
-            typedef typename
-                spirit::result_of::subject<Component>::type::director
-            director;
+            return result_type(subject
+              , compile<karma::domain>(fusion::at_c<0>(term.args)));
+        }
+    };
 
-            result += director::what(spirit::subject(component), ctx);
-            result += "]";
-            return result;
+    // creates right_align(pad, width)[] directive generator
+    template <typename Width, typename Padding, typename Subject
+      , typename Modifiers>
+    struct make_directive<
+        terminal_ex<tag::right_align, fusion::vector2<Width, Padding> >
+      , Subject, Modifiers>
+    {
+        typedef typename
+            result_of::compile<karma::domain, Padding, Modifiers>::type
+        padding_type;
+
+        typedef padding_right_alignment<Subject, padding_type, Width> result_type;
+
+        template <typename Terminal>
+        result_type operator()(Terminal const& term, Subject const& subject
+          , unused_type) const
+        {
+            return result_type(subject
+              , compile<karma::domain>(fusion::at_c<1>(term.args))
+              , fusion::at_c<0>(term.args));
         }
     };
 
Added: trunk/boost/spirit/home/karma/directive/upper_lower_case.hpp
==============================================================================
--- (empty file)
+++ trunk/boost/spirit/home/karma/directive/upper_lower_case.hpp	2009-04-26 10:42:24 EDT (Sun, 26 Apr 2009)
@@ -0,0 +1,86 @@
+//  Copyright (c) 2001-2009 Hartmut Kaiser
+//  Copyright (c) 2001-2009 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(SPIRIT_UPPER_LOWER_CASE_JANUARY_19_2009_1142AM)
+#define SPIRIT_UPPER_LOWER_CASE_JANUARY_19_2009_1142AM
+
+#if defined(_MSC_VER)
+#pragma once
+#endif
+
+#include <boost/spirit/home/support/common_terminals.hpp>
+#include <boost/spirit/home/support/modify.hpp>
+#include <boost/spirit/home/karma/domain.hpp>
+#include <boost/spirit/home/karma/meta_compiler.hpp>
+
+namespace boost { namespace spirit
+{
+    ///////////////////////////////////////////////////////////////////////////
+    // Enablers
+    ///////////////////////////////////////////////////////////////////////////
+    template <typename CharEncoding>
+    struct use_directive<
+        karma::domain, tag::char_code<tag::upper, CharEncoding> > // enables upper
+      : mpl::true_ {};
+
+    template <typename CharEncoding>
+    struct use_directive<
+        karma::domain, tag::char_code<tag::lower, CharEncoding> > // enables lower
+      : mpl::true_ {};
+
+    ///////////////////////////////////////////////////////////////////////////
+    template <typename CharEncoding>
+    struct is_modifier_directive<karma::domain
+        , tag::char_code<tag::upper, CharEncoding> >
+      : mpl::true_ {};
+
+    template <typename CharEncoding>
+    struct is_modifier_directive<karma::domain
+        , tag::char_code<tag::lower, CharEncoding> >
+      : mpl::true_ {};
+
+    ///////////////////////////////////////////////////////////////////////////
+    // Don't add tag::upper or tag::lower if there is already one of those in
+    // the modifier list
+    template <typename Current, typename CharEncoding>
+    struct compound_modifier<
+            Current
+          , tag::char_code<tag::upper, CharEncoding>
+          , typename enable_if<
+                has_modifier<Current, tag::char_code<tag::lower, CharEncoding> > 
+            >::type
+          >
+      : Current
+    {
+        compound_modifier()
+          : Current() {}
+
+        compound_modifier(Current const& current, 
+                tag::char_code<tag::upper, CharEncoding> const&)
+          : Current(current) {}
+    };
+
+    template <typename Current, typename CharEncoding>
+    struct compound_modifier<
+            Current
+          , tag::char_code<tag::lower, CharEncoding>
+          , typename enable_if<
+                has_modifier<Current, tag::char_code<tag::upper, CharEncoding> > 
+            >::type
+          >
+      : Current
+    {
+        compound_modifier()
+          : Current() {}
+
+        compound_modifier(Current const& current, 
+                tag::char_code<tag::lower, CharEncoding> const&)
+          : Current(current) {}
+    };
+
+}}
+
+#endif
Modified: trunk/boost/spirit/home/karma/directive/verbatim.hpp
==============================================================================
--- trunk/boost/spirit/home/karma/directive/verbatim.hpp	(original)
+++ trunk/boost/spirit/home/karma/directive/verbatim.hpp	2009-04-26 10:42:24 EDT (Sun, 26 Apr 2009)
@@ -10,63 +10,85 @@
 #pragma once      // MS compatible compilers support #pragma once
 #endif
 
-#include <boost/spirit/home/support/unused.hpp>
-#include <boost/spirit/home/support/attribute_of.hpp>
+#include <boost/spirit/home/karma/meta_compiler.hpp>
+#include <boost/spirit/home/karma/generator.hpp>
 #include <boost/spirit/home/karma/domain.hpp>
-#include <boost/fusion/include/at.hpp>
-#include <boost/fusion/include/value_at.hpp>
+#include <boost/spirit/home/karma/detail/unused_delimiter.hpp>
+#include <boost/spirit/home/karma/delimit_out.hpp>
+#include <boost/spirit/home/karma/auxiliary/lazy.hpp>
+#include <boost/spirit/home/support/unused.hpp>
+#include <boost/spirit/home/support/common_terminals.hpp>
+#include <boost/spirit/home/support/attributes.hpp>
+#include <boost/spirit/home/support/info.hpp>
+
+namespace boost { namespace spirit
+{
+    ///////////////////////////////////////////////////////////////////////////
+    // Enablers
+    ///////////////////////////////////////////////////////////////////////////
+    template <>
+    struct use_directive<karma::domain, tag::verbatim>   // enables verbatim[]
+      : mpl::true_ {};
+
+}}
 
 namespace boost { namespace spirit { namespace karma
 {
+    using spirit::verbatim;
+    using spirit::verbatim_type;
+
     ///////////////////////////////////////////////////////////////////////////
     //  The verbatim generator is used for verbatim[...] directives.
     ///////////////////////////////////////////////////////////////////////////
-    struct verbatim
+    template <typename Subject>
+    struct verbatim_generator : unary_generator<verbatim_generator<Subject> >
     {
-        template <typename Component, typename Context, typename Unused>
+        typedef Subject subject_type;
+
+        template <typename Context, typename Unused>
         struct attribute
-          : traits::attribute_of<
-                karma::domain,
-                typename result_of::right<Component>::type, 
-                Context
-            >
         {
+            typedef typename
+                traits::attribute_of<subject_type, Context>::type
+            type;
         };
 
-        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) 
+        verbatim_generator(Subject const& subject)
+          : subject(subject) {}
+
+        template <typename OutputIterator, typename Context, typename Delimiter
+          , typename Attribute>
+        bool generate(OutputIterator& sink, Context& ctx, Delimiter const& d
+          , Attribute const& attr) const
         {
             //  the verbatim generator simply dispatches to the embedded 
-            //  generator while supplying unused as the new delimiter
+            //  generator while supplying unused_delimiter as the new delimiter
             //  to avoid delimiting down the generator stream
-            typedef typename 
-                spirit::result_of::right<Component>::type::director
-            director;
-            
-            if (director::generate(spirit::right(component), sink, ctx, 
-                    unused, param))
-            {
-                karma::delimit(sink, d);           // always do post-delimiting 
-                return true;
-            }
-            return false;
+            typedef detail::unused_delimiter<Delimiter> unused_delimiter;
+
+            return subject.generate(sink, ctx, unused_delimiter(d), attr) &&
+                   karma::delimit_out(sink, d);     // always do post-delimiting 
         }
 
-        template <typename Component, typename Context>
-        static std::string what(Component const& component, Context const& ctx)
+        template <typename Context>
+        info what(Context& context) const
         {
-            std::string result = "verbatim[";
+            return info("verbatim", subject.what(context));
+        }
 
-            typedef typename
-                spirit::result_of::right<Component>::type::director
-            director;
+        Subject subject;
+    };
 
-            result += director::what(spirit::right(component), ctx);
-            result += "]";
-            return result;
+    ///////////////////////////////////////////////////////////////////////////
+    // Generator generators: make_xxx function (objects)
+    ///////////////////////////////////////////////////////////////////////////
+    template <typename Subject, typename Modifiers>
+    struct make_directive<tag::verbatim, Subject, Modifiers>
+    {
+        typedef verbatim_generator<Subject> result_type;
+        result_type operator()(unused_type, Subject const& subject, unused_type) const
+        {
+            return result_type(subject);
         }
     };
 
Modified: trunk/boost/spirit/home/karma/domain.hpp
==============================================================================
--- trunk/boost/spirit/home/karma/domain.hpp	(original)
+++ trunk/boost/spirit/home/karma/domain.hpp	2009-04-26 10:42:24 EDT (Sun, 26 Apr 2009)
@@ -1,5 +1,5 @@
-//  Copyright (c) 2001-2007 Joel de Guzman
 //  Copyright (c) 2001-2009 Hartmut Kaiser
+//  Copyright (c) 2001-2009 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)
@@ -7,15 +7,49 @@
 #if !defined(BOOST_SPIRIT_KARMA_DOMAIN_FEB_20_2007_0943AM)
 #define BOOST_SPIRIT_KARMA_DOMAIN_FEB_20_2007_0943AM
 
-#if defined(_MSC_VER) && (_MSC_VER >= 1020)
-#pragma once      // MS compatible compilers support #pragma once
+#if defined(_MSC_VER)
+#pragma once
 #endif
 
+#include <boost/spirit/home/support/unused.hpp>
+#include <boost/spirit/home/support/meta_compiler.hpp>
+#include <boost/spirit/home/support/info.hpp>
+#include <boost/spirit/home/support/argument.hpp>
+#include <boost/spirit/home/support/context.hpp>
+
+#include <boost/preprocessor/repeat.hpp>
+#include <boost/preprocessor/cat.hpp>
+
 namespace boost { namespace spirit { namespace karma
 {
-    struct domain 
-    {};
-    
+    // karma's domain
+    struct domain {};
+
+    // bring in some of spirit parts into spirit::karma
+    using spirit::unused;
+    using spirit::unused_type;
+    using spirit::compile;
+    using spirit::info;
+
+    // You can bring these in with the using directive
+    // without worrying about bringing in too much.
+    namespace labels
+    {
+        BOOST_PP_REPEAT(SPIRIT_ARGUMENTS_LIMIT, SPIRIT_USING_ARGUMENT, _)
+        BOOST_PP_REPEAT(SPIRIT_ATTRIBUTES_LIMIT, SPIRIT_USING_ATTRIBUTE, _)
+        using spirit::_val;
+        using spirit::_a;
+        using spirit::_b;
+        using spirit::_c;
+        using spirit::_d;
+        using spirit::_e;
+        using spirit::_f;
+        using spirit::_g;
+        using spirit::_h;
+        using spirit::_i;
+        using spirit::_j;
+    }
+
 }}}
 
 #endif
Modified: trunk/boost/spirit/home/karma/generate.hpp
==============================================================================
--- trunk/boost/spirit/home/karma/generate.hpp	(original)
+++ trunk/boost/spirit/home/karma/generate.hpp	2009-04-26 10:42:24 EDT (Sun, 26 Apr 2009)
@@ -1,262 +1,197 @@
 //  Copyright (c) 2001-2009 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_GENERATE_FEB_20_2007_0959AM)
 #define BOOST_SPIRIT_KARMA_GENERATE_FEB_20_2007_0959AM
 
-#if defined(_MSC_VER) && (_MSC_VER >= 1020)
-#pragma once      // MS compatible compilers support #pragma once
+#if defined(_MSC_VER)
+#pragma once
 #endif
 
-#include <boost/spirit/home/karma/meta_grammar.hpp>
-#include <boost/spirit/home/karma/delimit.hpp>
+#include <boost/spirit/home/karma/meta_compiler.hpp>
+#include <boost/spirit/home/karma/delimit_out.hpp>
 #include <boost/spirit/home/karma/detail/output_iterator.hpp>
 #include <boost/spirit/home/support/unused.hpp>
+#include <boost/spirit/home/support/detail/scoped_enum_emulation.hpp>
 #include <boost/mpl/assert.hpp>
 #include <boost/mpl/bool.hpp>
 
-///////////////////////////////////////////////////////////////////////////////
 namespace boost { namespace spirit { namespace karma
 {
     ///////////////////////////////////////////////////////////////////////////
+    BOOST_SCOPED_ENUM_START(delimit_flag) 
+    { 
+        predelimit,         // force predelimiting in generate_delimited()
+        dont_predelimit     // inhibit predelimiting in generate_delimited()
+    };
+    BOOST_SCOPED_ENUM_END
+
+    ///////////////////////////////////////////////////////////////////////////
     template <typename OutputIterator, typename Expr>
     inline bool
-    generate(OutputIterator target_sink, Expr const& xpr)
-    {
-        typedef spirit::traits::is_component<karma::domain, Expr> is_component;
-
-        // report invalid expression error as early as possible
-        BOOST_MPL_ASSERT_MSG(is_component::value,
-            xpr_is_not_convertible_to_a_generator, 
-            (OutputIterator, Expr));
+    generate(
+        OutputIterator& target_sink
+      , Expr const& expr)
+    {
+        // Report invalid expression error as early as possible.
+        // If you got an error_invalid_expression error message here,
+        // then the expression (expr) is not a valid spirit karma expression.
+        BOOST_SPIRIT_ASSERT_MATCH(karma::domain, Expr)
 
         // wrap user supplied iterator into our own output iterator
         detail::output_iterator<OutputIterator> sink(target_sink);
-        
-        typedef
-            typename result_of::as_component<karma::domain, Expr>::type
-        component;
-        typedef typename component::director director;
-
-        component c = spirit::as_component(karma::domain(), xpr);
-        return director::generate(c, sink, unused, unused, unused);
+        return compile<karma::domain>(expr).generate(sink, unused, unused, unused);
     }
 
-    ///////////////////////////////////////////////////////////////////////////
     template <typename OutputIterator, typename Expr>
     inline bool
-    generate(detail::output_iterator<OutputIterator>& sink, Expr const& xpr)
+    generate(
+        detail::output_iterator<OutputIterator>& sink
+      , Expr const& expr)
     {
-        typedef spirit::traits::is_component<karma::domain, Expr> is_component;
-
-        // report invalid expression error as early as possible
-        BOOST_MPL_ASSERT_MSG(is_component::value,
-            xpr_is_not_convertible_to_a_generator, 
-            (OutputIterator, Expr));
-
-        typedef
-            typename result_of::as_component<karma::domain, Expr>::type
-        component;
-        typedef typename component::director director;
-
-        component c = spirit::as_component(karma::domain(), xpr);
-        return director::generate(c, sink, unused, unused, unused);
+        // Report invalid expression error as early as possible.
+        // If you got an error_invalid_expression error message here,
+        // then the expression (expr) is not a valid spirit karma expression.
+        BOOST_SPIRIT_ASSERT_MATCH(karma::domain, Expr)
+        return compile<karma::domain>(expr).generate(sink, unused, unused, unused);
     }
 
     ///////////////////////////////////////////////////////////////////////////
-    template <typename OutputIterator, typename Expr, typename Parameter>
+    template <typename OutputIterator, typename Expr, typename Attr>
     inline bool
-    generate(OutputIterator target_sink, Expr const& xpr, Parameter const& param)
+    generate(
+        OutputIterator& target_sink
+      , Expr const& expr
+      , Attr const& attr)
     {
-        typedef spirit::traits::is_component<karma::domain, Expr> is_component;
-
-        // report invalid expression error as early as possible
-        BOOST_MPL_ASSERT_MSG(is_component::value,
-            xpr_is_not_convertible_to_a_generator, 
-            (OutputIterator, Expr, Parameter));
+        // Report invalid expression error as early as possible.
+        // If you got an error_invalid_expression error message here,
+        // then the expression (expr) is not a valid spirit karma expression.
+        BOOST_SPIRIT_ASSERT_MATCH(karma::domain, Expr)
 
         // wrap user supplied iterator into our own output iterator
         detail::output_iterator<OutputIterator> sink(target_sink);
-        
-        typedef
-            typename result_of::as_component<karma::domain, Expr>::type
-        component;
-        typedef typename component::director director;
-
-        component c = spirit::as_component(karma::domain(), xpr);
-        return director::generate(c, sink, unused, unused, param);
+        return compile<karma::domain>(expr).generate(sink, unused, unused, attr);
     }
 
-    ///////////////////////////////////////////////////////////////////////////
-    template <typename OutputIterator, typename Expr, typename Parameter>
+    template <typename OutputIterator, typename Expr, typename Attr>
     inline bool
-    generate(detail::output_iterator<OutputIterator>& sink, Expr const& xpr, 
-        Parameter const& param)
+    generate(
+        detail::output_iterator<OutputIterator>& sink
+      , Expr const& expr
+      , Attr const& attr)
     {
-        typedef spirit::traits::is_component<karma::domain, Expr> is_component;
+        // Report invalid expression error as early as possible.
+        // If you got an error_invalid_expression error message here,
+        // then the expression (expr) is not a valid spirit karma expression.
+        BOOST_SPIRIT_ASSERT_MATCH(karma::domain, Expr)
+        return compile<karma::domain>(expr).generate(sink, unused, unused, attr);
+    }
 
-        // report invalid expression error as early as possible
-        BOOST_MPL_ASSERT_MSG(is_component::value,
-            xpr_is_not_convertible_to_a_generator, 
-            (OutputIterator, Expr, Parameter));
-
-        typedef
-            typename result_of::as_component<karma::domain, Expr>::type
-        component;
-        typedef typename component::director director;
+    ///////////////////////////////////////////////////////////////////////////
+    template <typename OutputIterator, typename Expr, typename Delimiter>
+    inline bool
+    generate_delimited(
+        detail::output_iterator<OutputIterator>& sink
+      , Expr const& expr
+      , Delimiter const& delimiter
+      , BOOST_SCOPED_ENUM(delimit_flag) pre_delimit = 
+            delimit_flag::dont_predelimit)
+    {
+        // Report invalid expression error as early as possible.
+        // If you got an error_invalid_expression error message here,
+        // then either the expression (expr) or skipper is not a valid
+        // spirit karma expression.
+        BOOST_SPIRIT_ASSERT_MATCH(karma::domain, Expr)
+        BOOST_SPIRIT_ASSERT_MATCH(karma::domain, Delimiter)
+
+        typename result_of::compile<karma::domain, Delimiter>::type const 
+            delimiter_ = compile<karma::domain>(delimiter);
+
+        if (pre_delimit == delimit_flag::predelimit &&
+            !karma::delimit_out(sink, delimiter_))
+        {
+            return false;
+        }
 
-        component c = spirit::as_component(karma::domain(), xpr);
-        return director::generate(c, sink, unused, unused, param);
+        return compile<karma::domain>(expr).
+            generate(sink, unused, delimiter_, unused);
     }
 
-    ///////////////////////////////////////////////////////////////////////////
     template <typename OutputIterator, typename Expr, typename Delimiter>
     inline bool
-    generate_delimited(OutputIterator target_sink, Expr const& xpr,
-        Delimiter const& delimiter)
+    generate_delimited(
+        OutputIterator& target_sink
+      , Expr const& expr
+      , Delimiter const& delimiter
+      , BOOST_SCOPED_ENUM(delimit_flag) pre_delimit = 
+            delimit_flag::dont_predelimit)
     {
-        typedef
-            spirit::traits::is_component<karma::domain, Expr>
-        expr_is_component;
-        typedef
-            spirit::traits::is_component<karma::domain, Delimiter>
-        delimiter_is_component;
-
-        // report invalid expression errors as early as possible
-        BOOST_MPL_ASSERT_MSG(expr_is_component::value,
-            xpr_is_not_convertible_to_a_generator, 
-            (OutputIterator, Expr, Delimiter));
-
-        BOOST_MPL_ASSERT_MSG(delimiter_is_component::value,
-            delimiter_is_not_convertible_to_a_generator, 
-            (OutputIterator, Expr, Delimiter));
-        
         // wrap user supplied iterator into our own output iterator
         detail::output_iterator<OutputIterator> sink(target_sink);
-        
-        typedef
-            typename result_of::as_component<karma::domain, Expr>::type
-        component;
-        typedef typename component::director director;
-        typedef
-            typename result_of::as_component<karma::domain, Delimiter>::type
-        delim_component;
-
-        component c = spirit::as_component(karma::domain(), xpr);
-        delim_component d = spirit::as_component(karma::domain(), delimiter);
-        return director::generate(c, sink, unused, d, unused);
+        return generate_delimited(sink, expr, delimiter, pre_delimit);
     }
 
     ///////////////////////////////////////////////////////////////////////////
-    template <typename OutputIterator, typename Expr, typename Delimiter>
+    template <typename OutputIterator, typename Expr, typename Delimiter
+      , typename Attribute>
     inline bool
-    generate_delimited(detail::output_iterator<OutputIterator>& sink, 
-        Expr const& xpr, Delimiter const& delimiter)
+    generate_delimited(
+        detail::output_iterator<OutputIterator>& sink
+      , Expr const& expr
+      , Delimiter const& delimiter
+      , BOOST_SCOPED_ENUM(delimit_flag) pre_delimit
+      , Attribute const& attr)
     {
-        typedef
-            spirit::traits::is_component<karma::domain, Expr>
-        expr_is_component;
-        typedef
-            spirit::traits::is_component<karma::domain, Delimiter>
-        delimiter_is_component;
-
-        // report invalid expression errors as early as possible
-        BOOST_MPL_ASSERT_MSG(expr_is_component::value,
-            xpr_is_not_convertible_to_a_generator, 
-            (OutputIterator, Expr, Delimiter));
-
-        BOOST_MPL_ASSERT_MSG(delimiter_is_component::value,
-            delimiter_is_not_convertible_to_a_generator, 
-            (OutputIterator, Expr, Delimiter));
-        
-        typedef
-            typename result_of::as_component<karma::domain, Expr>::type
-        component;
-        typedef typename component::director director;
-        typedef
-            typename result_of::as_component<karma::domain, Delimiter>::type
-        delim_component;
-
-        component c = spirit::as_component(karma::domain(), xpr);
-        delim_component d = spirit::as_component(karma::domain(), delimiter);
-        return director::generate(c, sink, unused, d, unused);
+        // Report invalid expression error as early as possible.
+        // If you got an error_invalid_expression error message here,
+        // then either the expression (expr) or skipper is not a valid
+        // spirit karma expression.
+        BOOST_SPIRIT_ASSERT_MATCH(karma::domain, Expr)
+        BOOST_SPIRIT_ASSERT_MATCH(karma::domain, Delimiter)
+
+        typename result_of::compile<karma::domain, Delimiter>::type const 
+            delimiter_ = compile<karma::domain>(delimiter);
+
+        if (pre_delimit == delimit_flag::predelimit &&
+            !karma::delimit_out(sink, delimiter_))
+        {
+            return false;
+        }
+
+        return compile<karma::domain>(expr).
+            generate(sink, unused, delimiter_, attr);
     }
 
     ///////////////////////////////////////////////////////////////////////////
-    template <typename OutputIterator, typename Expr, typename Parameter,
-        typename Delimiter>
+    template <typename OutputIterator, typename Expr, typename Delimiter
+      , typename Attribute>
     inline bool
-    generate_delimited(OutputIterator target_sink, Expr const& xpr,
-        Parameter const& param, Delimiter const& delimiter)
+    generate_delimited(
+        OutputIterator& target_sink
+      , Expr const& expr
+      , Delimiter const& delimiter
+      , BOOST_SCOPED_ENUM(delimit_flag) pre_delimit
+      , Attribute const& attr)
     {
-        typedef
-            spirit::traits::is_component<karma::domain, Expr>
-        expr_is_component;
-        typedef
-            spirit::traits::is_component<karma::domain, Delimiter>
-        delimiter_is_component;
-
-        // report invalid expression errors as early as possible
-        BOOST_MPL_ASSERT_MSG(expr_is_component::value,
-            xpr_is_not_convertible_to_a_generator, 
-            (OutputIterator, Expr, Parameter, Delimiter));
-
-        BOOST_MPL_ASSERT_MSG(delimiter_is_component::value,
-            delimiter_is_not_convertible_to_a_generator, 
-            (OutputIterator, Expr, Parameter, Delimiter));
-        
         // wrap user supplied iterator into our own output iterator
         detail::output_iterator<OutputIterator> sink(target_sink);
-        
-        typedef
-            typename result_of::as_component<karma::domain, Expr>::type
-        component;
-        typedef typename component::director director;
-        typedef
-            typename result_of::as_component<karma::domain, Delimiter>::type
-        delim_component;
-
-        component c = spirit::as_component(karma::domain(), xpr);
-        delim_component d = spirit::as_component(karma::domain(), delimiter);
-        return director::generate(c, sink, unused, d, param);
+        return generate_delimited(sink, expr, delimiter, pre_delimit, attr);
     }
 
-    ///////////////////////////////////////////////////////////////////////////
-    template <typename OutputIterator, typename Expr, typename Parameter,
-        typename Delimiter>
+    template <typename OutputIterator, typename Expr, typename Attribute
+      , typename Delimiter>
     inline bool
-    generate_delimited(detail::output_iterator<OutputIterator>& sink, 
-        Expr const& xpr, Parameter const& param, Delimiter const& delimiter)
+    generate_delimited(
+        OutputIterator& sink
+      , Expr const& expr
+      , Delimiter const& delimiter
+      , Attribute const& attr)
     {
-        typedef
-            spirit::traits::is_component<karma::domain, Expr>
-        expr_is_component;
-        typedef
-            spirit::traits::is_component<karma::domain, Delimiter>
-        delimiter_is_component;
-
-        // report invalid expression errors as early as possible
-        BOOST_MPL_ASSERT_MSG(expr_is_component::value,
-            xpr_is_not_convertible_to_a_generator, 
-            (OutputIterator, Expr, Parameter, Delimiter));
-
-        BOOST_MPL_ASSERT_MSG(delimiter_is_component::value,
-            delimiter_is_not_convertible_to_a_generator, 
-            (OutputIterator, Expr, Parameter, Delimiter));
-        
-        typedef
-            typename result_of::as_component<karma::domain, Expr>::type
-        component;
-        typedef typename component::director director;
-        typedef
-            typename result_of::as_component<karma::domain, Delimiter>::type
-        delim_component;
-
-        component c = spirit::as_component(karma::domain(), xpr);
-        delim_component d = spirit::as_component(karma::domain(), delimiter);
-        return director::generate(c, sink, unused, d, param);
+        return generate_delimited(sink, expr, delimiter
+          , delimit_flag::dont_predelimit, attr);
     }
 
 }}}
Added: trunk/boost/spirit/home/karma/generate_attr.hpp
==============================================================================
--- (empty file)
+++ trunk/boost/spirit/home/karma/generate_attr.hpp	2009-04-26 10:42:24 EDT (Sun, 26 Apr 2009)
@@ -0,0 +1,147 @@
+//  Copyright (c) 2001-2009 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_PP_IS_ITERATING)
+
+#if !defined(BOOST_SPIRIT_KARMA_GENERATE_ATTR_APR_23_2009_0541PM)
+#define BOOST_SPIRIT_KARMA_GENERATE_ATTR_APR_23_2009_0541PM
+
+#include <boost/spirit/home/karma/generate.hpp>
+
+#include <boost/fusion/include/vector.hpp>
+#include <boost/preprocessor/cat.hpp>
+#include <boost/preprocessor/iterate.hpp>
+#include <boost/preprocessor/repetition/enum.hpp>
+#include <boost/preprocessor/repetition/enum_params.hpp>
+#include <boost/preprocessor/repetition/enum_binary_params.hpp>
+
+#define BOOST_PP_FILENAME_1 <boost/spirit/home/karma/generate_attr.hpp>
+#define BOOST_PP_ITERATION_LIMITS (2, SPIRIT_ARGUMENTS_LIMIT)
+#include BOOST_PP_ITERATE()
+
+#endif
+
+///////////////////////////////////////////////////////////////////////////////
+//
+//  Preprocessor vertical repetition code
+//
+///////////////////////////////////////////////////////////////////////////////
+#else // defined(BOOST_PP_IS_ITERATING)
+
+#define N BOOST_PP_ITERATION()
+#define BOOST_SPIRIT_KARMA_ATTRIBUTE_REFERENCE(z, n, A)                       \
+    BOOST_PP_CAT(A, n) const&
+
+namespace boost { namespace spirit { namespace karma
+{
+    ///////////////////////////////////////////////////////////////////////////
+    template <typename OutputIterator, typename Expr
+      , BOOST_PP_ENUM_PARAMS(N, typename A)>
+    inline bool
+    generate(
+        detail::output_iterator<OutputIterator>& sink
+      , Expr const& expr
+      , BOOST_PP_ENUM_BINARY_PARAMS(N, A, const& attr))
+    {
+        // Report invalid expression error as early as possible.
+        // If you got an error_invalid_expression error message here,
+        // then the expression (expr) is not a valid spirit karma expression.
+        BOOST_SPIRIT_ASSERT_MATCH(karma::domain, Expr)
+
+        typedef fusion::vector<
+            BOOST_PP_ENUM(N, BOOST_SPIRIT_KARMA_ATTRIBUTE_REFERENCE, A)
+        > vector_type;
+
+        vector_type attr (BOOST_PP_ENUM_PARAMS(N, attr));
+        return compile<karma::domain>(expr).generate(sink, unused, unused, attr);
+    }
+
+    template <typename OutputIterator, typename Expr
+      , BOOST_PP_ENUM_PARAMS(N, typename A)>
+    inline bool
+    generate(
+        OutputIterator& target_sink
+      , Expr const& expr
+      , BOOST_PP_ENUM_BINARY_PARAMS(N, A, const& attr))
+    {
+        // wrap user supplied iterator into our own output iterator
+        detail::output_iterator<OutputIterator> sink(target_sink);
+        return generate(sink, expr, BOOST_PP_ENUM_PARAMS(N, attr));
+    }
+
+    ///////////////////////////////////////////////////////////////////////////
+    template <typename OutputIterator, typename Expr, typename Delimiter
+      , BOOST_PP_ENUM_PARAMS(N, typename A)>
+    inline bool
+    generate_delimited(
+        detail::output_iterator<OutputIterator>& sink
+      , Expr const& expr
+      , Delimiter const& delimiter
+      , BOOST_SCOPED_ENUM(delimit_flag) pre_delimit
+      , BOOST_PP_ENUM_BINARY_PARAMS(N, A, const& attr))
+    {
+        // Report invalid expression error as early as possible.
+        // If you got an error_invalid_expression error message here,
+        // then either the expression (expr) or skipper is not a valid
+        // spirit karma expression.
+        BOOST_SPIRIT_ASSERT_MATCH(karma::domain, Expr)
+        BOOST_SPIRIT_ASSERT_MATCH(karma::domain, Delimiter)
+
+        typename result_of::compile<karma::domain, Delimiter>::type const 
+            delimiter_ = compile<karma::domain>(delimiter);
+
+        if (pre_delimit == delimit_flag::predelimit &&
+            !karma::delimit_out(sink, delimiter_))
+        {
+            return false;
+        }
+
+        typedef fusion::vector<
+            BOOST_PP_ENUM(N, BOOST_SPIRIT_KARMA_ATTRIBUTE_REFERENCE, A)
+        > vector_type;
+
+        vector_type attr (BOOST_PP_ENUM_PARAMS(N, attr));
+        return compile<karma::domain>(expr).
+            generate(sink, unused, delimiter_, attr);
+    }
+
+    template <typename OutputIterator, typename Expr, typename Delimiter
+      , BOOST_PP_ENUM_PARAMS(N, typename A)>
+    inline bool
+    generate_delimited(
+        OutputIterator& target_sink
+      , Expr const& expr
+      , Delimiter const& delimiter
+      , BOOST_SCOPED_ENUM(delimit_flag) pre_delimit
+      , BOOST_PP_ENUM_BINARY_PARAMS(N, A, const& attr))
+    {
+        // wrap user supplied iterator into our own output iterator
+        detail::output_iterator<OutputIterator> sink(target_sink);
+        return generate_delimited(sink, expr, delimiter, pre_delimit
+          , BOOST_PP_ENUM_PARAMS(N, attr));
+    }
+
+    template <typename OutputIterator, typename Expr, typename Delimiter
+      , BOOST_PP_ENUM_PARAMS(N, typename A)>
+    inline bool
+    generate_delimited(
+        OutputIterator& target_sink
+      , Expr const& expr
+      , Delimiter const& delimiter
+      , BOOST_PP_ENUM_BINARY_PARAMS(N, A, const& attr))
+    {
+        // wrap user supplied iterator into our own output iterator
+        detail::output_iterator<OutputIterator> sink(target_sink);
+        return generate_delimited(sink, expr, delimiter
+          , delimit_flag::dont_predelimit, BOOST_PP_ENUM_PARAMS(N, attr));
+    }
+
+}}}
+
+#undef BOOST_SPIRIT_KARMA_ATTRIBUTE_REFERENCE
+#undef N
+
+#endif // defined(BOOST_PP_IS_ITERATING)
+
Added: trunk/boost/spirit/home/karma/generator.hpp
==============================================================================
--- (empty file)
+++ trunk/boost/spirit/home/karma/generator.hpp	2009-04-26 10:42:24 EDT (Sun, 26 Apr 2009)
@@ -0,0 +1,137 @@
+//  Copyright (c) 2001-2009 Hartmut Kaiser
+//  Copyright (c) 2001-2009 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_GENERATOR_JANUARY_13_2009_1002AM)
+#define BOOST_SPIRIT_GENERATOR_JANUARY_13_2009_1002AM
+
+#if defined(_MSC_VER)
+#pragma once
+#endif
+
+#include <boost/mpl/has_xxx.hpp>
+#include <boost/spirit/home/karma/domain.hpp>
+
+namespace boost { namespace spirit { namespace karma
+{
+    template <typename Derived>
+    struct generator
+    {
+        struct generator_id;
+        typedef Derived derived_type;
+        typedef karma::domain domain;
+
+        // Requirement: g.generate(o, context, delimiter, attr) -> bool
+        //
+        //  g:          a generator
+        //  o:          output iterator
+        //  context:    enclosing rule context (can be unused_type)
+        //  delimit:    delimiter (can be unused_type)
+        //  attr:       attribute (can be unused_type)
+
+        // Requirement: g.what(context) -> void
+        //
+        //  g:          a generator
+        //  context:    enclosing rule context (can be unused_type)
+
+        // Requirement: G::template attribute<Ctx, Iter>::type
+        //
+        //  G:          a generator type
+        //  Ctx:        A context type (can be unused_type)
+        //  Iter:       An iterator type (always unused_type)
+
+        Derived const& derived() const
+        {
+            return *static_cast<Derived const*>(this);
+        }
+    };
+
+    template <typename Derived>
+    struct primitive_generator : generator<Derived>
+    {
+        struct primitive_generator_id;
+    };
+
+    template <typename Derived>
+    struct nary_generator : generator<Derived>
+    {
+        struct nary_generator_id;
+
+        // Requirement: g.elements -> fusion sequence
+        //
+        // g:   a composite generator
+
+        // Requirement: G::elements_type -> fusion sequence
+        //
+        // G:   a composite generator type
+    };
+
+    template <typename Derived>
+    struct unary_generator : generator<Derived>
+    {
+        struct unary_generator_id;
+
+        // Requirement: g.subject -> subject generator
+        //
+        // g:   a unary generator
+
+        // Requirement: G::subject_type -> subject generator type
+        //
+        // G:   a unary generator type
+    };
+
+    template <typename Derived>
+    struct binary_generator : generator<Derived>
+    {
+        struct binary_generator_id;
+
+        // Requirement: g.left -> left generator
+        //
+        // g:   a binary generator
+
+        // Requirement: G::left_type -> left generator type
+        //
+        // G:   a binary generator type
+
+        // Requirement: g.right -> right generator
+        //
+        // g:   a binary generator
+
+        // Requirement: G::right_type -> right generator type
+        //
+        // G:   a binary generator type
+    };
+
+}}}
+
+namespace boost { namespace spirit { namespace traits // classification
+{
+    namespace detail
+    {
+        BOOST_MPL_HAS_XXX_TRAIT_DEF(generator_id)
+        BOOST_MPL_HAS_XXX_TRAIT_DEF(primitive_generator_id)
+        BOOST_MPL_HAS_XXX_TRAIT_DEF(nary_generator_id)
+        BOOST_MPL_HAS_XXX_TRAIT_DEF(unary_generator_id)
+        BOOST_MPL_HAS_XXX_TRAIT_DEF(binary_generator_id)
+    }
+
+    template <typename T>
+    struct is_generator : detail::has_generator_id<T> {};
+
+    template <typename T>
+    struct is_primitive_generator : detail::has_primitive_generator_id<T> {};
+
+    template <typename T>
+    struct is_nary_generator : detail::has_nary_generator_id<T> {};
+
+    template <typename T>
+    struct is_unary_generator : detail::has_unary_generator_id<T> {};
+
+    template <typename T>
+    struct is_binary_generator : detail::has_binary_generator_id<T> {};
+
+}}}
+
+#endif
Added: trunk/boost/spirit/home/karma/meta_compiler.hpp
==============================================================================
--- (empty file)
+++ trunk/boost/spirit/home/karma/meta_compiler.hpp	2009-04-26 10:42:24 EDT (Sun, 26 Apr 2009)
@@ -0,0 +1,177 @@
+//  Copyright (c) 2001-2009 Hartmut Kaiser
+//  Copyright (c) 2001-2009 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_KARMA_META_COMPILER_JANUARY_13_2009_1011AM)
+#define BOOST_SPIRIT_KARMA_META_COMPILER_JANUARY_13_2009_1011AM
+
+#if defined(_MSC_VER)
+#pragma once
+#endif
+
+#include <boost/spirit/home/support/meta_compiler.hpp>
+#include <boost/spirit/home/karma/domain.hpp>
+#include <boost/spirit/home/karma/generator.hpp>
+#include <boost/spirit/home/support/string_traits.hpp>
+#include <boost/type_traits/remove_reference.hpp>
+#include <boost/utility/enable_if.hpp>
+#include <boost/fusion/include/at.hpp>
+
+namespace boost { namespace spirit
+{
+    template <typename T>
+    struct use_terminal<karma::domain, T
+      , typename enable_if<traits::is_generator<T> >::type> // enables generators
+      : mpl::true_ {};
+
+    namespace karma
+    {
+        template <typename T, typename Modifiers, typename Enable = void>
+        struct make_primitive // by default, return it as-is
+        {
+            typedef T result_type;
+
+            template <typename T_>
+            T_& operator()(T_& val, unused_type) const
+            {
+                return val;
+            }
+
+            template <typename T_>
+            T_ const& operator()(T_ const& val, unused_type) const
+            {
+                return val;
+            }
+        };
+
+        template <typename Tag, typename Elements
+          , typename Modifiers, typename Enable = void>
+        struct make_composite;
+
+        template <typename Directive, typename Body
+          , typename Modifiers, typename Enable = void>
+        struct make_directive
+        {
+            typedef Body result_type;
+            result_type operator()(unused_type, Body const& body, unused_type) const
+            {
+                return body; // By default, a directive simply returns its subject
+            }
+        };
+    }
+
+    // Karma primitive meta-compiler
+    template <>
+    struct make_component<karma::domain, proto::tag::terminal>
+    {
+        template <typename Sig>
+        struct result;
+
+        template <typename This, typename Elements, typename Modifiers>
+        struct result<This(Elements, Modifiers)>
+        {
+            typedef typename karma::make_primitive<
+                typename remove_const<typename Elements::car_type>::type
+              , typename remove_reference<Modifiers>::type
+            >::result_type type;
+        };
+
+        template <typename Elements, typename Modifiers>
+        typename result<make_component(Elements, Modifiers)>::type
+        operator()(Elements const& elements, Modifiers const& modifiers) const
+        {
+            typedef typename remove_const<typename Elements::car_type>::type term;
+            return karma::make_primitive<term, Modifiers>()(elements.car, modifiers);
+        }
+    };
+
+    // Karma composite meta-compiler
+    template <typename Tag>
+    struct make_component<karma::domain, Tag>
+    {
+        template <typename Sig>
+        struct result;
+
+        template <typename This, typename Elements, typename Modifiers>
+        struct result<This(Elements, Modifiers)>
+        {
+            typedef typename
+                karma::make_composite<Tag, Elements
+                  , typename remove_reference<Modifiers>::type>::result_type
+            type;
+        };
+
+        template <typename Elements, typename Modifiers>
+        typename result<make_component(Elements, Modifiers)>::type
+        operator()(Elements const& elements, Modifiers const& modifiers) const
+        {
+            return karma::make_composite<Tag, Elements, Modifiers>()(
+                elements, modifiers);
+        }
+    };
+
+    // Karma function meta-compiler
+    template <>
+    struct make_component<karma::domain, proto::tag::function>
+    {
+        template <typename Sig>
+        struct result;
+
+        template <typename This, typename Elements, typename Modifiers>
+        struct result<This(Elements, Modifiers)>
+        {
+            typedef typename
+                karma::make_composite<
+                    typename remove_const<typename Elements::car_type>::type,
+                    typename Elements::cdr_type,
+                    typename remove_reference<Modifiers>::type
+                >::result_type
+            type;
+        };
+
+        template <typename Elements, typename Modifiers>
+        typename result<make_component(Elements, Modifiers)>::type
+        operator()(Elements const& elements, Modifiers const& modifiers) const
+        {
+            return karma::make_composite<
+                typename remove_const<typename Elements::car_type>::type,
+                typename Elements::cdr_type,
+                Modifiers>()(elements.cdr, modifiers);
+        }
+    };
+
+    // Karma directive meta-compiler
+    template <>
+    struct make_component<karma::domain, tag::directive>
+    {
+        template <typename Sig>
+        struct result;
+
+        template <typename This, typename Elements, typename Modifiers>
+        struct result<This(Elements, Modifiers)>
+        {
+            typedef typename
+                karma::make_directive<
+                    typename remove_const<typename Elements::car_type>::type,
+                    typename remove_const<typename Elements::cdr_type::car_type>::type,
+                    typename remove_reference<Modifiers>::type
+                >::result_type
+            type;
+        };
+
+        template <typename Elements, typename Modifiers>
+        typename result<make_component(Elements, Modifiers)>::type
+        operator()(Elements const& elements, Modifiers const& modifiers) const
+        {
+            return karma::make_directive<
+                typename remove_const<typename Elements::car_type>::type,
+                typename remove_const<typename Elements::cdr_type::car_type>::type,
+                Modifiers>()(elements.car, elements.cdr.car, modifiers);
+        }
+    };
+
+}}
+
+#endif
Deleted: trunk/boost/spirit/home/karma/meta_grammar.hpp
==============================================================================
--- trunk/boost/spirit/home/karma/meta_grammar.hpp	2009-04-26 10:42:24 EDT (Sun, 26 Apr 2009)
+++ (empty file)
@@ -1,53 +0,0 @@
-//  Copyright (c) 2001-2007 Joel de Guzman
-//  Copyright (c) 2001-2009 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_META_GRAMMAR_FEB_20_2007_0939AM)
-#define BOOST_SPIRIT_KARMA_META_GRAMMAR_FEB_20_2007_0939AM
-
-#if defined(_MSC_VER) && (_MSC_VER >= 1020)
-#pragma once      // MS compatible compilers support #pragma once
-#endif
-
-#include <boost/spirit/home/support/meta_grammar/grammar.hpp>
-#include <boost/spirit/home/support/meta_grammar/basic_transforms.hpp>
-#include <boost/spirit/home/karma/domain.hpp>
-#include <boost/mpl/bool.hpp>
-#include <boost/mpl/placeholders.hpp>
-
-namespace boost { namespace spirit { namespace karma
-{
-    // Check if Expr is a valid Karma expression
-    template <typename Expr, typename Enable = void>
-    struct is_valid_expr : mpl::false_ {};
-
-    // Return a suitable transform for the given Expr
-    template <typename Expr, typename Enable = void>
-    struct expr_transform;
-
-    struct main_meta_grammar
-      : meta_grammar::if_transform<
-            is_valid_expr<proto::_>(),
-            expr_transform<proto::_> 
-        >
-    {
-    };
-    
-}}}
-
-namespace boost { namespace spirit { namespace meta_grammar
-{
-    ///////////////////////////////////////////////////////////////////////////
-    //  The spirit karma domain meta-grammar
-    ///////////////////////////////////////////////////////////////////////////
-    template <>
-    struct grammar<karma::domain>
-    {
-        typedef karma::main_meta_grammar type;
-    };
-    
-}}}
-
-#endif
Modified: trunk/boost/spirit/home/karma/nonterminal.hpp
==============================================================================
--- trunk/boost/spirit/home/karma/nonterminal.hpp	(original)
+++ trunk/boost/spirit/home/karma/nonterminal.hpp	2009-04-26 10:42:24 EDT (Sun, 26 Apr 2009)
@@ -12,6 +12,5 @@
 
 #include <boost/spirit/home/karma/nonterminal/rule.hpp>
 #include <boost/spirit/home/karma/nonterminal/grammar.hpp>
-#include <boost/spirit/home/karma/nonterminal/meta_grammar.hpp>
 
 #endif
Added: trunk/boost/spirit/home/karma/nonterminal/detail/fcall.hpp
==============================================================================
--- (empty file)
+++ trunk/boost/spirit/home/karma/nonterminal/detail/fcall.hpp	2009-04-26 10:42:24 EDT (Sun, 26 Apr 2009)
@@ -0,0 +1,54 @@
+//  Copyright (c) 2001-2009 Joel de Guzman
+//  Copyright (c) 2001-2009 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)
+
+#ifndef BOOST_PP_IS_ITERATING
+
+#include <boost/preprocessor/iterate.hpp>
+#include <boost/preprocessor/repetition/enum_params.hpp>
+#include <boost/preprocessor/repetition/enum_binary_params.hpp>
+
+#define BOOST_PP_FILENAME_1 \
+    <boost/spirit/home/karma/nonterminal/detail/fcall.hpp>
+#define BOOST_PP_ITERATION_LIMITS (1, SPIRIT_ARGUMENTS_LIMIT)
+#include BOOST_PP_ITERATE()
+
+///////////////////////////////////////////////////////////////////////////////
+//
+//  Preprocessor vertical repetition code
+//
+///////////////////////////////////////////////////////////////////////////////
+#else // defined(BOOST_PP_IS_ITERATING)
+
+#define N BOOST_PP_ITERATION()
+
+    template <BOOST_PP_ENUM_PARAMS(N, typename A)>
+    typename lazy_enable_if_c<
+        (params_size == N)
+      , proto::terminal<
+            parameterized_rule<rule_type
+          , fusion::vector<BOOST_PP_ENUM_PARAMS(N, A)> >
+        >
+    >::type
+    operator()(BOOST_PP_ENUM_BINARY_PARAMS(N, A, const& f)) const
+    {
+        typedef fusion::vector<BOOST_PP_ENUM_PARAMS(N, A)> vector_type;
+        typedef parameterized_rule<
+            rule_type
+          , vector_type>
+        parameterized_rule;
+        typedef typename proto::terminal<parameterized_rule>::type result_type;
+
+        return result_type::make(
+            parameterized_rule(
+                this->get_rule()
+              , fusion::make_vector(BOOST_PP_ENUM_PARAMS(N, f)))
+        );
+    }
+
+#undef N
+#endif // defined(BOOST_PP_IS_ITERATING)
+
+
Added: trunk/boost/spirit/home/karma/nonterminal/detail/generator_binder.hpp
==============================================================================
--- (empty file)
+++ trunk/boost/spirit/home/karma/nonterminal/detail/generator_binder.hpp	2009-04-26 10:42:24 EDT (Sun, 26 Apr 2009)
@@ -0,0 +1,87 @@
+//  Copyright (c) 2001-2009 Joel de Guzman
+//  Copyright (c) 2001-2009 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_GENERATOR_BINDER_APR_17_2009_0952PM)
+#define BOOST_SPIRIT_GENERATOR_BINDER_APR_17_2009_0952PM
+
+#if defined(_MSC_VER)
+#pragma once
+#endif
+
+#include <utility>
+#include <boost/type_traits/remove_reference.hpp>
+#include <boost/fusion/include/value_at.hpp>
+#include <boost/fusion/include/at.hpp>
+#include <boost/type_traits/is_same.hpp>
+#include <boost/mpl/eval_if.hpp>
+#include <boost/mpl/identity.hpp>
+#include <boost/mpl/deref.hpp>
+#include <boost/mpl/end.hpp>
+#include <boost/mpl/find_if.hpp>
+
+namespace boost { namespace spirit { namespace karma { namespace detail
+{
+    // generator_binder for plain rules
+    template <typename Generator, typename Auto>
+    struct generator_binder
+    {
+        generator_binder(Generator const& g)
+          : g(g) {}
+
+        template <typename OutputIterator, typename Delimiter, typename Context>
+        bool operator()(OutputIterator& sink, Context& context
+          , Delimiter const& delim) const
+        {
+            // If Auto is false, the component's attribute is unused.
+            return g.generate(sink, context, delim, unused);
+        }
+
+        Generator g;
+    };
+
+    // generator_binder for auto rules
+    template <typename Generator>
+    struct generator_binder<Generator, mpl::true_>
+    {
+        generator_binder(Generator const& g)
+          : g(g) {};
+
+        template <typename OutputIterator, typename Delimiter, typename Context>
+        bool operator()(OutputIterator& sink, Context& context
+          , Delimiter const& delim) const
+        {
+            // If Auto is true, we pass the rule's attribute on to the component.
+            return g.generate(sink, context, delim
+                , fusion::at_c<0>(context.attributes));
+        }
+
+        Generator g;
+    };
+
+    template <typename Auto, typename Generator>
+    inline generator_binder<Generator, Auto>
+    bind_generator(Generator const& g)
+    {
+        return generator_binder<Generator, Auto>(g);
+    }
+
+    template <typename Types, typename Pred, typename Default>
+    struct extract_param
+    {
+        typedef typename mpl::find_if<Types, Pred>::type pos;
+
+        typedef typename
+            mpl::eval_if<
+                is_same<pos, typename mpl::end<Types>::type>
+              , mpl::identity<Default>
+              , mpl::deref<pos>
+            >::type
+        type;
+    };
+
+}}}}
+
+#endif
Deleted: trunk/boost/spirit/home/karma/nonterminal/detail/rule.hpp
==============================================================================
--- trunk/boost/spirit/home/karma/nonterminal/detail/rule.hpp	2009-04-26 10:42:24 EDT (Sun, 26 Apr 2009)
+++ (empty file)
@@ -1,174 +0,0 @@
-//  Copyright (c) 2001-2007 Joel de Guzman
-//  Copyright (c) 2001-2009 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_RULE_MAR_05_2007_0519PM)
-#define BOOST_SPIRIT_KARMA_RULE_MAR_05_2007_0519PM
-
-#if defined(_MSC_VER) && (_MSC_VER >= 1020)
-#pragma once      // MS compatible compilers support #pragma once
-#endif
-
-#include <boost/spirit/home/support/unused.hpp>
-#include <boost/spirit/home/support/attribute_of.hpp>
-#include <boost/spirit/home/karma/domain.hpp>
-#include <boost/intrusive_ptr.hpp>
-#include <boost/detail/atomic_count.hpp>
-#include <boost/mpl/eval_if.hpp>
-#include <boost/mpl/identity.hpp>
-#include <boost/mpl/size.hpp>
-#include <boost/mpl/bool.hpp>
-#include <boost/mpl/not.hpp>
-#include <boost/mpl/and.hpp>
-#include <boost/mpl/equal_to.hpp>
-#include <boost/type_traits/is_same.hpp>
-#include <boost/type_traits/add_const.hpp>
-#include <boost/type_traits/remove_reference.hpp>
-#include <boost/function_types/is_function.hpp>
-#include <boost/assert.hpp>
-#include <boost/fusion/include/pop_front.hpp>
-#include <boost/fusion/include/is_sequence.hpp>
-
-namespace boost { namespace spirit { namespace karma { namespace detail
-{
-    struct no_delimiter
-    {
-        // this struct accepts only unused types and
-        // nothing else. This is used by the second
-        // pure virtual parse member function of
-        // virtual_component_base below.
-
-        no_delimiter(unused_type) {}
-    };
-
-    template <typename OutputIterator, typename Context, typename Delimiter>
-    struct virtual_component_base
-    {
-        struct take_no_delimiter {};
-
-        typedef typename
-            mpl::eval_if<
-                is_same<Delimiter, unused_type>,
-                mpl::identity<take_no_delimiter>,
-                result_of::as_component<karma::domain, Delimiter>
-            >::type
-        delimiter_type;
-
-        virtual_component_base()
-          : use_count(0)
-        {
-        }
-
-        virtual ~virtual_component_base()
-        {
-        }
-
-        virtual bool
-        generate(OutputIterator& sink, Context& context,
-            delimiter_type const& delim) = 0;
-
-        virtual bool
-        generate(OutputIterator& sink, Context& context, no_delimiter) = 0;
-
-        boost::detail::atomic_count use_count;
-    };
-
-    template <typename OutputIterator, typename Context, typename Delimiter>
-    inline void
-    intrusive_ptr_add_ref(
-        virtual_component_base<OutputIterator, Context, Delimiter>* p)
-    {
-        ++p->use_count;
-    }
-
-    template <typename OutputIterator, typename Context, typename Delimiter>
-    inline void
-    intrusive_ptr_release(
-        virtual_component_base<OutputIterator, Context, Delimiter>* p)
-    {
-        if (--p->use_count == 0)
-            delete p;
-    }
-
-    ///////////////////////////////////////////////////////////////////////////
-    template <typename OutputIterator, typename Component, typename Context,
-        typename Delimiter, typename Auto>
-    struct virtual_component
-      : virtual_component_base<OutputIterator, Context, Delimiter>
-    {
-        typedef
-            virtual_component_base<OutputIterator, Context, Delimiter>
-        base_type;
-        typedef typename base_type::delimiter_type delimiter_type;
-        typedef typename base_type::take_no_delimiter take_no_delimiter;
-
-        virtual_component(Component const& component)
-          : component(component)
-        {
-        }
-
-        virtual ~virtual_component()
-        {
-        }
-
-        template <typename Delimiter_>
-        bool generate_main(OutputIterator& sink, Context& context,
-            Delimiter_ const& delim, mpl::false_)
-        {
-            // If Auto is false, we synthesize a new (default constructed) 
-            // attribute instance based on the attributes of the embedded 
-            // generator.
-            typename traits::attribute_of<
-                    karma::domain, Component, Context
-                >::type param;
-                
-            typedef typename Component::director director;
-            return director::generate(component, sink, context, delim, param);
-        }
-
-        template <typename Delimiter_>
-        bool generate_main(OutputIterator& sink, Context& context,
-            Delimiter_ const& delim, mpl::true_)
-        {
-            //  If Auto is true, we pass the rule's attribute on to the
-            //  component.
-            typedef typename Component::director director;
-            return director::generate(component, sink, context, delim,
-                fusion::at_c<0>(fusion::at_c<0>(context)));
-        }
-
-        bool
-        generate_main(OutputIterator&, Context&, take_no_delimiter, mpl::false_)
-        {
-            BOOST_ASSERT(false); // this should never be called
-            return false;
-        }
-
-        bool
-        generate_main(OutputIterator&, Context&, take_no_delimiter, mpl::true_)
-        {
-            BOOST_ASSERT(false); // this should never be called
-            return false;
-        }
-
-        virtual bool
-        generate(OutputIterator& sink, Context& context,
-            delimiter_type const& delim)
-        {
-            return generate_main(sink, context, delim, Auto());
-        }
-
-        virtual bool
-        generate(OutputIterator& sink, Context& context, no_delimiter)
-        {
-            return generate_main(sink, context, unused, Auto());
-        }
-
-        Component component;
-    };
-
-}}}}
-
-#endif
Modified: trunk/boost/spirit/home/karma/nonterminal/grammar.hpp
==============================================================================
--- trunk/boost/spirit/home/karma/nonterminal/grammar.hpp	(original)
+++ trunk/boost/spirit/home/karma/nonterminal/grammar.hpp	2009-04-26 10:42:24 EDT (Sun, 26 Apr 2009)
@@ -1,4 +1,4 @@
-//  Copyright (c) 2001-2007 Joel de Guzman
+//  Copyright (c) 2001-2009 Joel de Guzman
 //  Copyright (c) 2001-2009 Hartmut Kaiser
 // 
 //  Distributed under the Boost Software License, Version 1.0. (See accompanying 
@@ -7,34 +7,52 @@
 #if !defined(BOOST_SPIRIT_KARMA_GRAMMAR_MAR_05_2007_0542PM)
 #define BOOST_SPIRIT_KARMA_GRAMMAR_MAR_05_2007_0542PM
 
+#if defined(_MSC_VER)
+#pragma once
+#endif
+
 #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/support/info.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>
-#include <boost/function_types/is_function.hpp>
+#include <boost/spirit/home/karma/reference.hpp>
 #include <boost/noncopyable.hpp>
 
 namespace boost { namespace spirit { namespace karma
 {
-    template <typename Iterator, typename T0 , typename T1 , typename T2>
+    template <
+        typename OutputIterator
+      , typename T1 = unused_type
+      , typename T2 = unused_type
+      , typename T3 = unused_type
+    >
     struct grammar
-      : nonterminal<
-            grammar<Iterator, T0, T1, T2>,
-            typename karma::rule<Iterator, T0, T1, T2>::sig_type,
-            typename karma::rule<Iterator, T0, T1, T2>::locals_type
-        >, noncopyable
+      : proto::extends<
+            typename proto::terminal<
+                reference<rule<OutputIterator, T1, T2, T3> const>
+            >::type
+          , grammar<OutputIterator, T1, T2, T3>
+        >
+      , generator<grammar<OutputIterator, T1, T2, T3> >
+      , noncopyable
     {
-        typedef Iterator iterator_type;
-        typedef karma::rule<Iterator, T0, T1, T2> start_type;
+        typedef OutputIterator iterator_type;
+        typedef rule<OutputIterator, T1, T2, T3> 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_) 
+        typedef grammar<OutputIterator, T1, T2, T3> base_type;
+        typedef reference<start_type const> reference_;
+        typedef typename proto::terminal<reference_>::type terminal;
+        static size_t const params_size = start_type::params_size;
+
+        // the output iterator is always wrapped by karma
+        typedef detail::output_iterator<OutputIterator> output_iterator;
+
+        grammar(start_type const& start
+              , std::string const& name_ = "unnamed-grammar")
+          : proto::extends<terminal, base_type>(terminal::make(start.alias()))
+          , name_(name_)
         {}
 
         std::string name() const
@@ -42,35 +60,33 @@
             return name_;
         }
 
-        void name(std::string const& name__)
+        void name(std::string const& str)
         {
-            name_ = name__;
+            name_ = str;
         }
 
-        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
+        template <typename Context, typename Delimiter, typename Attribute>
+        bool generate(output_iterator& sink, Context& context
+          , Delimiter const& delim, Attribute const& attr) const
         {
-            return start_.generate(sink, context, delim);
+            return this->proto_base().child0.generate(
+                sink, context, delim, attr);
         }
 
-        std::string what() const
+        template <typename Context>
+        info what(Context& context) const
         {
-            if (name().empty())
-            {
-                return start_.what();
-            }
-            else
-            {
-                return name();
-            }
+            return info(name_);
         }
 
-        friend struct nonterminal_director;
+        // bring in the operator() overloads
+        start_type const& get_rule() const
+        { return this->proto_base().child0.ref.get(); }
+
+        typedef start_type rule_type;
+        #include <boost/spirit/home/karma/nonterminal/detail/fcall.hpp>
+
+        std::string name_;
     };
 
 }}}
Deleted: trunk/boost/spirit/home/karma/nonterminal/grammar_fwd.hpp
==============================================================================
--- trunk/boost/spirit/home/karma/nonterminal/grammar_fwd.hpp	2009-04-26 10:42:24 EDT (Sun, 26 Apr 2009)
+++ (empty file)
@@ -1,26 +0,0 @@
-/*=============================================================================
-    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
Deleted: trunk/boost/spirit/home/karma/nonterminal/meta_grammar.hpp
==============================================================================
--- trunk/boost/spirit/home/karma/nonterminal/meta_grammar.hpp	2009-04-26 10:42:24 EDT (Sun, 26 Apr 2009)
+++ (empty file)
@@ -1,72 +0,0 @@
-//  Copyright (c) 2001-2009 Hartmut Kaiser
-//  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_KARMA_META_GRAMMAR_MAR_05_2007_0436PM)
-#define BOOST_SPIRIT_KARMA_META_GRAMMAR_MAR_05_2007_0436PM
-
-#if defined(_MSC_VER) && (_MSC_VER >= 1020)
-#pragma once      // MS compatible compilers support #pragma once
-#endif
-
-#include <boost/spirit/home/support/nonterminal/nonterminal.hpp>
-#include <boost/spirit/home/karma/nonterminal/nonterminal.hpp>
-#include <boost/spirit/home/karma/domain.hpp>
-#include <boost/spirit/home/support/meta_grammar.hpp>
-#include <boost/utility/enable_if.hpp>
-
-namespace boost { namespace spirit { namespace karma
-{
-    ///////////////////////////////////////////////////////////////////////////
-    // forwards
-    ///////////////////////////////////////////////////////////////////////////
-    struct nonterminal_director;
-    
-    template <typename Expr, typename Enable>
-    struct is_valid_expr;
-
-    template <typename Expr, typename Enable>
-    struct expr_transform;
-
-    ///////////////////////////////////////////////////////////////////////////
-    // nonterminal meta-grammar
-    ///////////////////////////////////////////////////////////////////////////
-    struct nonterminal_meta_grammar
-      : meta_grammar::terminal_rule<
-            karma::domain,
-            nonterminal_holder<proto::_, proto::_>,
-            nonterminal_director
-        >
-    {
-    };
-
-    ///////////////////////////////////////////////////////////////////////////
-    //  These specializations non-intrusively hook into the Karma meta-grammar.
-    //  (see karma/meta_grammar.hpp)
-    ///////////////////////////////////////////////////////////////////////////
-    template <typename Expr>
-    struct is_valid_expr<
-            Expr,
-            typename enable_if<
-                proto::matches<Expr, nonterminal_meta_grammar> 
-            >::type
-        >
-      : mpl::true_
-    {
-    };
-
-    template <typename Expr>
-    struct expr_transform<
-            Expr,
-            typename enable_if<
-                proto::matches<Expr, nonterminal_meta_grammar> 
-            >::type
-        >
-      : mpl::identity<nonterminal_meta_grammar>
-    {
-    };
-}}}
-
-#endif
Deleted: trunk/boost/spirit/home/karma/nonterminal/nonterminal.hpp
==============================================================================
--- trunk/boost/spirit/home/karma/nonterminal/nonterminal.hpp	2009-04-26 10:42:24 EDT (Sun, 26 Apr 2009)
+++ (empty file)
@@ -1,154 +0,0 @@
-//  Copyright (c) 2001-2007 Joel de Guzman
-//  Copyright (c) 2001-2009 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_NONTERMINAL_MAR_06_2007_0750AM)
-#define BOOST_SPIRIT_KARMA_NONTERMINAL_MAR_06_2007_0750AM
-
-#if defined(_MSC_VER) && (_MSC_VER >= 1020)
-#pragma once      // MS compatible compilers support #pragma once
-#endif
-
-#include <boost/spirit/home/support/nonterminal/nonterminal.hpp>
-#include <boost/spirit/home/support/nonterminal/locals.hpp>
-#include <boost/spirit/home/support/argument.hpp>
-
-#include <boost/proto/core.hpp>
-#include <boost/function_types/result_type.hpp>
-#include <boost/function_types/parameter_types.hpp>
-#include <boost/function_types/is_function.hpp>
-#include <boost/fusion/include/as_vector.hpp>
-#include <boost/fusion/include/mpl.hpp>
-#include <boost/fusion/include/joint_view.hpp>
-#include <boost/fusion/include/single_view.hpp>
-
-#include <boost/type_traits/add_reference.hpp>
-#include <boost/type_traits/is_same.hpp>
-#include <boost/mpl/if.hpp>
-#include <boost/mpl/copy_if.hpp>
-#include <boost/mpl/filter_view.hpp>
-#include <boost/mpl/find_if.hpp>
-#include <boost/mpl/not.hpp>
-#include <boost/mpl/size.hpp>
-#include <boost/mpl/eval_if.hpp>
-#include <boost/preprocessor/enum_params.hpp>
-#include <boost/preprocessor/enum_params_with_a_default.hpp>
-#include <boost/utility/enable_if.hpp>
-
-namespace boost { namespace spirit { namespace karma
-{
-    ///////////////////////////////////////////////////////////////////////////
-    template <typename Derived, typename Sig, typename Locals>
-    struct nonterminal
-      : proto::extends<
-            typename make_nonterminal_holder<
-                Derived const*, Derived
-            >::type,
-            Derived
-        >
-    {
-        typedef Sig sig_type;
-        typedef typename 
-            function_types::result_type<sig_type>::type 
-        result_type_;
-
-        // This is the nonterminal return type
-        typedef typename
-            mpl::if_<
-                is_same<result_type_, void>, unused_type, result_type_
-            >::type
-        attribute_type;
-
-        // param_types is a sequence of types passed as parameters to the 
-        // nonterminal
-        typedef typename 
-            function_types::parameter_types<sig_type>::type 
-        param_types;
-
-        // the parameter tuple has the attribute value pre-pended
-        typedef typename 
-            fusion::result_of::as_vector<
-                fusion::joint_view<
-                    fusion::single_view<attribute_type const&>,
-                    param_types
-                >
-            >::type
-        retval_param_types;
-        
-        // locals_type is a sequence of types to be used as local variables
-        typedef typename 
-            fusion::result_of::as_vector<Locals>::type 
-        locals_type;
-
-        //  The overall context_type consists of a tuple with:
-        //      1) a tuple of the return value and parameters
-        //      2) the locals
-        typedef fusion::vector<retval_param_types, locals_type> context_type;
-
-        typedef nonterminal<Derived, Sig, Locals> self_type;
-        typedef nonterminal_holder<Derived const*, Derived> nonterminal_holder_;
-        typedef typename proto::terminal<nonterminal_holder_>::type nonterminal_tag;
-        typedef proto::extends<nonterminal_tag, Derived> base_type;
-
-        explicit nonterminal()
-          : base_type(make_tag())
-        {
-        }
-
-        // bring in the operator() overloads
-        #include <boost/spirit/home/support/nonterminal/detail/nonterminal_fcall.hpp>
-
-    private:
-
-        nonterminal_tag make_tag() const
-        {
-            nonterminal_tag xpr = {{static_cast<Derived const*>(this)}};
-            return xpr;
-        }
-    };
-
-    ///////////////////////////////////////////////////////////////////////////
-    template <typename Derived, typename T0, typename T1, typename T2>
-    struct make_nonterminal
-    {
-        typedef mpl::vector<T0, T1, T2> types;
-        typedef function_types::is_function<mpl::_> is_function;
-        typedef spirit::detail::is_locals<mpl::_> is_locals;
-        typedef spirit::traits::is_component<karma::domain, mpl::_> is_delimiter;
-
-        typedef typename mpl::find_if<types, is_function>::type sig_;
-        typedef typename mpl::find_if<types, is_locals>::type locals_;
-        typedef typename mpl::find_if<types, is_delimiter>::type delimiter_;
-
-        typedef typename
-            mpl::eval_if<
-                is_same<sig_, typename mpl::end<types>::type>,
-                mpl::identity<unused_type()>,
-                mpl::deref<sig_>
-            >::type
-        sig_type;
-
-        typedef typename
-            mpl::eval_if<
-                is_same<locals_, typename mpl::end<types>::type>,
-                mpl::identity<locals<> >,
-                mpl::deref<locals_>
-            >::type
-        locals_type;
-
-        typedef typename
-            mpl::eval_if<
-                is_same<delimiter_, typename mpl::end<types>::type>,
-                mpl::identity<unused_type>,
-                mpl::deref<delimiter_>
-            >::type
-        delimiter_type;
-
-        typedef nonterminal<Derived, sig_type, locals_type> type;
-    };
-
-}}}
-
-#endif
Deleted: trunk/boost/spirit/home/karma/nonterminal/nonterminal_director.hpp
==============================================================================
--- trunk/boost/spirit/home/karma/nonterminal/nonterminal_director.hpp	2009-04-26 10:42:24 EDT (Sun, 26 Apr 2009)
+++ (empty file)
@@ -1,160 +0,0 @@
-//  Copyright (c) 2001-2007 Joel de Guzman
-//  Copyright (c) 2001-2009 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_NONTERMINAL_DIRECTOR_MAR_05_2007_0524PM)
-#define BOOST_SPIRIT_KARMA_NONTERMINAL_DIRECTOR_MAR_05_2007_0524PM
-
-#if defined(_MSC_VER) && (_MSC_VER >= 1020)
-#pragma once      // MS compatible compilers support #pragma once
-#endif
-
-#include <boost/spirit/home/support/nonterminal/nonterminal.hpp>
-#include <boost/spirit/home/support/nonterminal/detail/expand_arg.hpp>
-#include <boost/spirit/home/karma/domain.hpp>
-#include <boost/spirit/home/support/component.hpp>
-#include <boost/spirit/home/support/attribute_transform.hpp>
-#include <boost/spirit/home/support/detail/values.hpp>
-#include <boost/fusion/include/transform.hpp>
-#include <boost/fusion/include/join.hpp>
-#include <boost/fusion/include/single_view.hpp>
-#include <boost/intrusive_ptr.hpp>
-#include <boost/mpl/at.hpp>
-#include <boost/type_traits/is_same.hpp>
-#include <boost/type_traits/remove_const.hpp>
-
-namespace boost { namespace spirit { namespace karma
-{
-    struct nonterminal_director
-    {
-        // The attribute (parameter) of nonterminals is the type given to them 
-        // as the return value of the function signature.
-        template <typename Component, typename Context, typename Unused>
-        struct attribute
-        {
-            typedef typename 
-                result_of::subject<Component>::type 
-            nonterminal_holder;
-            typedef typename 
-                nonterminal_holder::nonterminal_type::attribute_type 
-            type;
-        };
-
-        // the nonterminal_holder holds an actual nonterminal_object
-        template <
-            typename NonterminalContext, typename Nonterminal,
-            typename OutputIterator, typename Context, typename Delimiter, 
-            typename Parameter>
-        static bool generate_nonterminal(
-            nonterminal_object<Nonterminal> const& x,
-            OutputIterator& sink, Context&, Delimiter const& delim, 
-            Parameter const& param)
-        {
-            typedef typename Nonterminal::locals_type locals_type;
-            fusion::vector<Parameter const&> front(param);
-            NonterminalContext context(front, locals_type());
-            return x.obj.generate(sink, context, delim);
-        }
-
-        // the nonterminal_holder holds a pointer to a nonterminal
-        template <
-            typename NonterminalContext, typename Nonterminal,
-            typename OutputIterator, typename Context, typename Delimiter, 
-            typename Parameter>
-        static bool generate_nonterminal(
-            Nonterminal const* ptr,
-            OutputIterator& sink, Context&, Delimiter const& delim, 
-            Parameter const& param)
-        {
-            typedef typename Nonterminal::locals_type locals_type;
-            fusion::vector<Parameter const&> front(param);
-            NonterminalContext context(front, locals_type());
-            return ptr->generate(sink, context, delim);
-        }
-
-        // the nonterminal_holder holds a parameterized_nonterminal
-        template <
-            typename NonterminalContext, typename Nonterminal,
-            typename FSequence, typename OutputIterator,
-            typename Context, typename Delimiter, typename Parameter>
-        static bool generate_nonterminal(
-            parameterized_nonterminal<Nonterminal, FSequence> const& x,
-            OutputIterator& sink, Context& context_, Delimiter const& delim, 
-            Parameter const& param)
-        {
-            typedef typename Nonterminal::locals_type locals_type;
-            fusion::single_view<Parameter const&> front(param);
-            NonterminalContext context(
-                fusion::join(
-                    front,
-                    fusion::transform(
-                        x.fseq,
-                        spirit::detail::expand_arg<Context>(context_)
-                    )
-                ),
-                locals_type()
-            );
-            return x.ptr->generate(sink, context, delim);
-        }
-
-        ///////////////////////////////////////////////////////////////////////
-        // main entry point
-        ///////////////////////////////////////////////////////////////////////
-        template <
-            typename Component, typename OutputIterator, typename Context,
-            typename Delimiter, typename Parameter>
-        static bool generate(
-            Component const& component, OutputIterator& sink,
-            Context& context, Delimiter const& delim, Parameter const& param)
-        {
-            typedef typename
-                result_of::subject<Component>::type
-            nonterminal_holder;
-            
-            //  The overall context_type consists of a tuple with:
-            //      1) a tuple of the attribute and parameters
-            //      2) the locals
-            //  if no signature is specified the first tuple contains
-            //  the attribute at position zero only.
-            typedef typename 
-                nonterminal_holder::nonterminal_type::context_type 
-            context_type;
-
-            return generate_nonterminal<context_type>(
-                subject(component).held, sink, context, delim, param);
-        }
-
-        template <typename Nonterminal>
-        static std::string what_nonterminal(nonterminal_object<Nonterminal> const& x)
-        {
-            // the nonterminal_holder holds an actual nonterminal_object
-            return x.obj.what();
-        }
-
-        template <typename Nonterminal>
-        static std::string what_nonterminal(Nonterminal const* ptr)
-        {
-            // the nonterminal_holder holds a pointer to a nonterminal
-            return ptr->what();
-        }
-
-        template <typename Nonterminal, typename FSequence>
-        static std::string what_nonterminal(
-            parameterized_nonterminal<Nonterminal, FSequence> const& x)
-        {
-            // the nonterminal_holder holds a parameterized_nonterminal
-            return x.ptr->what();
-        }
-
-        template <typename Component, typename Context>
-        static std::string what(Component const& component, Context const& ctx)
-        {
-            return what_nonterminal(subject(component).held);
-        }
-    };
-
-}}}
-
-#endif
Modified: trunk/boost/spirit/home/karma/nonterminal/rule.hpp
==============================================================================
--- trunk/boost/spirit/home/karma/nonterminal/rule.hpp	(original)
+++ trunk/boost/spirit/home/karma/nonterminal/rule.hpp	2009-04-26 10:42:24 EDT (Sun, 26 Apr 2009)
@@ -1,132 +1,196 @@
-//  Copyright (c) 2001-2007 Joel de Guzman
+//  Copyright (c) 2001-2009 Joel de Guzman
 //  Copyright (c) 2001-2009 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_RULE_MAR_05_2007_0455PM)
 #define BOOST_SPIRIT_KARMA_RULE_MAR_05_2007_0455PM
 
-#if defined(_MSC_VER) && (_MSC_VER >= 1020)
-#pragma once      // MS compatible compilers support #pragma once
+#if defined(_MSC_VER)
+#pragma once
 #endif
 
+#include <boost/function.hpp>
+#include <boost/mpl/eval_if.hpp>
+#include <boost/function_types/result_type.hpp>
+#include <boost/function_types/parameter_types.hpp>
+#include <boost/function_types/is_function.hpp>
+#include <boost/type_traits/remove_reference.hpp>
+#include <boost/utility/enable_if.hpp>
+
+#include <boost/fusion/include/vector.hpp>
+#include <boost/fusion/include/make_vector.hpp>
+#include <boost/fusion/include/cons.hpp>
+#include <boost/fusion/include/as_list.hpp>
+#include <boost/fusion/include/as_vector.hpp>
+
 #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>
-#include <boost/mpl/if.hpp>
-#include <boost/mpl/assert.hpp>
-
-#if defined(BOOST_MSVC)
-# pragma warning(push)
-# pragma warning(disable: 4355) // 'this' : used in base member initializer list warning
-#endif
+#include <boost/spirit/home/support/argument.hpp>
+#include <boost/spirit/home/support/context.hpp>
+#include <boost/spirit/home/support/info.hpp>
+#include <boost/spirit/home/support/attributes.hpp>
+#include <boost/spirit/home/support/nonterminal/locals.hpp>
+#include <boost/spirit/home/karma/reference.hpp>
+#include <boost/spirit/home/karma/nonterminal/detail/generator_binder.hpp>
 
 namespace boost { namespace spirit { namespace karma
 {
-    template <typename OutputIterator, typename T0 = unused_type,
-        typename T1 = unused_type, typename T2 = unused_type>
-    struct rule
-      : make_nonterminal<rule<OutputIterator, T0, T1, T2>, T0, T1, T2>::type
-    {
-        typedef
-            make_nonterminal<rule<OutputIterator, T0, T1, T2>, T0, T1, T2>
-        make_nonterminal_;
-
-        typedef typename make_nonterminal_::delimiter_type delimiter_type;
-        typedef typename make_nonterminal_::type base_type;
-        typedef detail::output_iterator<OutputIterator> iterator_type;
-        typedef rule<OutputIterator, T0, T1, T2> self_type;
-
-        typedef
-            detail::virtual_component_base<
-                iterator_type,
-                typename base_type::context_type,
-                delimiter_type
-            >
-        virtual_component;
+    BOOST_PP_REPEAT(SPIRIT_ATTRIBUTES_LIMIT, SPIRIT_USING_ATTRIBUTE, _)
 
-        typedef intrusive_ptr<virtual_component> pointer_type;
+    using spirit::_val;
+    using spirit::_a;
+    using spirit::_b;
+    using spirit::_c;
+    using spirit::_d;
+    using spirit::_e;
+    using spirit::_f;
+    using spirit::_g;
+    using spirit::_h;
+    using spirit::_i;
+    using spirit::_j;
 
-        rule() {}
-        ~rule() {}
+    using spirit::info;
+    using spirit::locals;
 
-        rule(rule const& rhs)
-          : ptr(rhs.ptr)
-        {
-        }
+    template <typename Rule, typename Params>
+    struct parameterized_rule : generator<parameterized_rule<Rule, Params> >
+    {
+        parameterized_rule(Rule const& rule, Params const& params)
+          : ref(rule), params(params) {}
 
-        rule& operator=(rule const& rhs)
+        template <typename Context, typename Unused>
+        struct attribute : Rule::template attribute<Context, Unused> {};
+
+        template <typename OutputIterator, typename Context, typename Delimiter
+          , typename Attribute>
+        bool generate(OutputIterator& sink, Context& context
+          , Delimiter const& delim, Attribute const& attr) const
         {
-            ptr = rhs.ptr;
-            return *this;
+            // We pass the additional params argument to parse
+            return ref.get().generate(sink, context, delim, attr, params);
         }
 
-        template <typename Expr>
-        rule& operator=(Expr const& xpr)
+        template <typename Context>
+        info what(Context& context) const
         {
-            typedef
-                spirit::traits::is_component<karma::domain, Expr>
-            is_component;
-
-            // report invalid expression error as early as possible
-//             BOOST_MPL_ASSERT_MSG(
-//                 is_component::value,
-//                 xpr_is_not_convertible_to_a_generator, ());
+            return ref.get().what(context);
+        }
 
-            // temp workaround for mpl problem
-            BOOST_STATIC_ASSERT(is_component::value);
+        boost::reference_wrapper<Rule const> ref;
+        Params params;
+    };
 
-            define(xpr, mpl::false_());
-            return *this;
-        }
+    template <
+        typename OutputIterator
+      , typename T1 = unused_type
+      , typename T2 = unused_type
+      , typename T3 = unused_type
+    >
+    struct rule
+      : proto::extends<
+            typename proto::terminal<
+                reference<rule<OutputIterator, T1, T2, T3> const>
+            >::type
+          , rule<OutputIterator, T1, T2, T3>
+        >
+      , generator<rule<OutputIterator, T1, T2, T3> >
+    {
+        typedef rule<OutputIterator, T1, T2, T3> this_type;
+        typedef reference<this_type const> reference_;
+        typedef typename proto::terminal<reference_>::type terminal;
+        typedef proto::extends<terminal, this_type> base_type;
+        typedef mpl::vector<T1, T2, T3> template_params;
+
+        // the output iterator is always wrapped by karma
+        typedef detail::output_iterator<OutputIterator> output_iterator;
+
+        // locals_type is a sequence of types to be used as local variables
+        typedef typename fusion::result_of::as_vector<
+            typename detail::extract_param<
+                    template_params
+                  , spirit::detail::is_locals<mpl::_>
+                  , locals<>
+                >::type
+            >::type
+        locals_type;
 
-        template <typename Expr>
-        friend rule& operator%=(rule& r, Expr const& xpr)
-        {
-            typedef
-                spirit::traits::is_component<karma::domain, Expr>
-            is_component;
+        // The delimiter-generator type
+        typedef typename
+            result_of::compile<
+                karma::domain
+              , typename detail::extract_param<
+                    template_params
+                  , traits::matches<karma::domain, mpl::_>
+                  , unused_type
+                >::type
+            >::type
+        delimiter_type;
 
-            // report invalid expression error as early as possible
-//             BOOST_MPL_ASSERT_MSG(
-//                 is_component::value,
-//                 xpr_is_not_convertible_to_a_generator, ());
+        typedef typename
+            detail::extract_param<
+                template_params
+              , function_types::is_function<mpl::_>
+              , void()
+            >::type
+        sig_type;
 
-            // temp workaround for mpl problem
-            BOOST_STATIC_ASSERT(is_component::value);
+        typedef typename function_types::result_type<sig_type>::type attr_type_;
 
-            r.define(xpr, mpl::true_());
-            return r;
+        // This is the rule's attribute type
+        typedef typename
+            mpl::if_<
+                is_same<attr_type_, void>
+              , unused_type
+              , attr_type_
+            >::type
+        attr_type;
+        typedef typename add_reference<
+            typename add_const<attr_type>::type>::type 
+        attr_reference_type;
+
+        // parameter_types is a sequence of types passed as parameters to the rule
+        typedef typename
+            function_types::parameter_types<sig_type>::type
+        params_;
+
+        typedef typename
+            fusion::result_of::as_list<params_>::type
+        parameter_types;
+
+        static size_t const params_size = mpl::size<params_>::value;
+
+        // the context passed to the right hand side of a rule contains
+        // the attribute and the parameters for this particular rule invocation
+        typedef context<
+            fusion::cons<attr_reference_type, parameter_types>, locals_type>
+        context_type;
+
+        typedef function<
+            bool(output_iterator&, context_type&, delimiter_type const&)>
+        function_type;
+
+        rule(std::string const& name_ = "unnamed-rule")
+          : base_type(terminal::make(alias()))
+          , name_(name_)
+        {
         }
 
-        self_type alias() const
+        rule(rule const& rhs)
+          : base_type(terminal::make(alias()))
+          , name_(rhs.name_)
+          , f(rhs.f)
         {
-            self_type result;
-            result.define(*this, mpl::false_());
-            return result;
         }
 
-        typename
-            make_nonterminal_holder<
-                nonterminal_object<self_type>
-              , self_type
-            >::type
-        copy() const
+        rule& operator=(rule const& rhs)
         {
-            typename
-                make_nonterminal_holder<
-                    nonterminal_object<self_type>
-                  , self_type
-                >::type
-            result = {{*this}};
-            return result;
+            f = rhs.f;
+            name_ = rhs.name_;
+            return *this;
         }
 
-        std::string name() const
+        std::string const& name() const
         {
             return name_;
         }
@@ -136,69 +200,120 @@
             name_ = str;
         }
 
-    private:
+        template <typename Expr>
+        rule& operator=(Expr const& expr)
+        {
+            // Report invalid expression error as early as possible.
+            // If you got an error_invalid_expression error message here,
+            // then the expression (expr) is not a valid spirit karma expression.
+            BOOST_SPIRIT_ASSERT_MATCH(karma::domain, Expr)
+
+            f = detail::bind_generator<mpl::false_>(compile<karma::domain>(expr));
+            return *this;
+        }
+
+        // g++ 3.3 barfs if this is a member function :(
+        template <typename Expr>
+        friend rule& operator%=(rule& r, Expr const& expr)
+        {
+            // Report invalid expression error as early as possible.
+            // If you got an error_invalid_expression error message here,
+            // then the expression (expr) is not a valid spirit karma expression.
+            BOOST_SPIRIT_ASSERT_MATCH(karma::domain, Expr)
 
-        template <typename Iterator_, typename T0_, typename T1_, typename T2_>
-        friend struct grammar;
+            r.f = detail::bind_generator<mpl::true_>(compile<karma::domain>(expr));
+            return r;
+        }
 
-        template <typename Expr, typename Auto>
-        void define(Expr const& xpr, Auto)
+        // non-const version needed to suppress proto's %= kicking in
+        template <typename Expr>
+        friend rule& operator%=(rule& r, Expr& expr)
         {
-            typedef typename
-                result_of::as_component<karma::domain, Expr>::type
-            component;
-            typedef
-                detail::virtual_component<
-                    iterator_type,
-                    component,
-                    typename base_type::context_type,
-                    delimiter_type,
-                    Auto
-                >
-            virtual_component;
-            ptr = new virtual_component(spirit::as_component(karma::domain(), xpr));
-        }
-
-        template <typename OutputIterator_, typename Context, typename Delimiter>
-        bool generate(
-            OutputIterator_& sink, Context& context, Delimiter const& delim) const
-        {
-            // If the following line produces a compilation error stating the
-            // 3rd parameter is not convertible to the expected type, then you
-            // are probably trying to use this rule instance with a delimiter 
-            // which is not compatible with the delimiter type used while 
-            // defining the type of this rule instance.
-            return ptr->generate(sink, context, delim);
+            return r %= static_cast<Expr const&>(expr);
         }
 
-        std::string what() const
+        template <typename Context, typename Unused>
+        struct attribute
         {
-            if (name_.empty())
+            typedef attr_type type;
+        };
+
+        template <typename Context, typename Delimiter, typename Attribute>
+        bool generate(output_iterator& sink, Context&, Delimiter const& delim
+          , Attribute const& attr) const
+        {
+            if (f)
             {
-                if (ptr)
-                {
-                    return "unnamed-rule";
-                }
-                else
+                // Create an attribute if none is supplied. 
+                typedef traits::make_attribute<attr_type, Attribute> 
+                    make_attribute;
+
+                context_type context(make_attribute::call(attr));
+
+                // If you are seeing a compilation error here stating that the 
+                // third parameter can't be converted to a karma::reference
+                // then you are probably trying to use a rule or a grammar with 
+                // an incompatible delimiter type.
+                if (f(sink, context, delim))
                 {
-                    return "empty-rule";
+                    return true;
                 }
             }
-            else
+            return false;
+        }
+
+        template <typename Context, typename Delimiter, typename Attribute
+          , typename Params>
+        bool generate(output_iterator& sink, Context& caller_context
+          , Delimiter const& delim, Attribute const& attr
+          , Params const& params) const
+        {
+            if (f)
             {
-                return name_;
+                // Create an attribute if none is supplied. 
+                typedef traits::make_attribute<attr_type, Attribute> 
+                    make_attribute;
+
+                context_type context(make_attribute::call(attr), params, caller_context);
+
+                // If you are seeing a compilation error here stating that the 
+                // third parameter can't be converted to a karma::reference
+                // then you are probably trying to use a rule or a grammar with 
+                // an incompatible delimiter type.
+                if (f(sink, context, delim))
+                {
+                    return true;
+                }
             }
+            return false;
         }
 
-        friend struct nonterminal_director;
-        pointer_type ptr;
+        template <typename Context>
+        info what(Context& context) const
+        {
+            return info(name_);
+        }
+
+        reference_ alias() const
+        {
+            return reference_(*this);
+        }
+
+        typename proto::terminal<this_type>::type copy() const
+        {
+            typename proto::terminal<this_type>::type result = {*this};
+            return result;
+        }
+
+        // bring in the operator() overloads
+        rule const& get_rule() const { return *this; }
+        typedef this_type rule_type;
+        #include <boost/spirit/home/karma/nonterminal/detail/fcall.hpp>
+
         std::string name_;
+        function_type f;
     };
 
 }}}
 
-#if defined(BOOST_MSVC)
-# pragma warning(pop)
-#endif
-
 #endif
Modified: trunk/boost/spirit/home/karma/numeric.hpp
==============================================================================
--- trunk/boost/spirit/home/karma/numeric.hpp	(original)
+++ trunk/boost/spirit/home/karma/numeric.hpp	2009-04-26 10:42:24 EDT (Sun, 26 Apr 2009)
@@ -10,10 +10,8 @@
 #pragma once      // MS compatible compilers support #pragma once
 #endif
 
-#include <boost/spirit/home/karma/numeric/numeric_fwd.hpp>
 #include <boost/spirit/home/karma/numeric/int.hpp>
 #include <boost/spirit/home/karma/numeric/uint.hpp>
 #include <boost/spirit/home/karma/numeric/real.hpp>
-#include <boost/spirit/home/karma/numeric/meta_grammar.hpp>
 
 #endif
Modified: trunk/boost/spirit/home/karma/numeric/detail/numeric_utils.hpp
==============================================================================
--- trunk/boost/spirit/home/karma/numeric/detail/numeric_utils.hpp	(original)
+++ trunk/boost/spirit/home/karma/numeric/detail/numeric_utils.hpp	2009-04-26 10:42:24 EDT (Sun, 26 Apr 2009)
@@ -1,4 +1,4 @@
-//  Copyright (c) 2001-2008 Hartmut Kaiser
+//  Copyright (c) 2001-2009 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)
@@ -15,13 +15,11 @@
 
 #include <boost/type_traits/is_integral.hpp>
 #include <boost/spirit/home/support/char_class.hpp>
-#include <boost/spirit/home/support/iso8859_1.hpp>
-#include <boost/spirit/home/support/ascii.hpp>
 #include <boost/spirit/home/support/unused.hpp>
+#include <boost/spirit/home/support/detail/pow10.hpp>
+#include <boost/spirit/home/support/detail/sign.hpp>
 #include <boost/spirit/home/karma/detail/generate_to.hpp>
 #include <boost/spirit/home/karma/detail/string_generate.hpp>
-#include <boost/spirit/home/support/detail/math/fpclassify.hpp>
-#include <boost/spirit/home/support/detail/math/signbit.hpp>
 
 ///////////////////////////////////////////////////////////////////////////////
 //
@@ -38,7 +36,7 @@
 #endif
 
 #if BOOST_KARMA_NUMERICS_LOOP_UNROLL < 0 
-#error "Please set the BOOST_KARMA_NUMERICS_LOOP_UNROLL to a positive value!"
+#error "Please set the BOOST_KARMA_NUMERICS_LOOP_UNROLL to a non-negative value!"
 #endif
 
 namespace boost { namespace spirit { namespace karma { 
@@ -55,7 +53,7 @@
         {
             return (n >= 0) ? n : (unsigned short)(-n);
         }
-        
+
         inline unsigned int absolute_value (int n)
         {
             return (n >= 0) ? n : (unsigned int)(-n);
@@ -72,25 +70,26 @@
             return (n >= 0) ? n : (boost::ulong_long_type)(-n);
         }
 #endif
-        
+
         inline float absolute_value (float n)
         {
-            return boost::spirit::math::signbit(n) ? boost::spirit::math::changesign(n) : n;
+            return spirit::detail::signbit(n) ? -n : n;
         }
-        
+
         inline double absolute_value (double n)
         {
-            return boost::spirit::math::signbit(n) ? boost::spirit::math::changesign(n) : n;
+            return spirit::detail::signbit(n) ? -n : n;
         }
-        
+
         inline long double absolute_value (long double n)
         {
-            return boost::spirit::math::signbit(n) ? boost::spirit::math::changesign(n) : n;
+            return spirit::detail::signbit(n) ? -n : n;
         }
-        
+
         template <typename T>
         inline T absolute_value (T n)
         {
+            // allow for ADL to find the correct overloads for fabs
             using namespace std;
             return fabs(n);
         }
@@ -98,47 +97,47 @@
         ///////////////////////////////////////////////////////////////////////
         inline bool is_negative(float n) 
         { 
-            return boost::spirit::math::signbit(n); 
+            return spirit::detail::signbit(n) ? true : false; 
         }
-        
+
         inline bool is_negative(double n) 
         { 
-            return boost::spirit::math::signbit(n); 
+            return spirit::detail::signbit(n) ? true : false; 
         }
-        
+
         inline bool is_negative(long double n) 
         { 
-            return boost::spirit::math::signbit(n); 
+            return spirit::detail::signbit(n) ? true : false; 
         }
-        
+
         template <typename T>
         inline bool is_negative(T n)
         {
             return (n < 0) ? true : false;
         }
-        
+
         ///////////////////////////////////////////////////////////////////////
         inline bool is_zero(float n) 
         { 
-            return boost::spirit::math::fpclassify(n) == FP_ZERO; 
+            return math::fpclassify(n) == FP_ZERO; 
         }
-        
+
         inline bool is_zero(double n) 
         { 
-            return boost::spirit::math::fpclassify(n) == FP_ZERO; 
+            return math::fpclassify(n) == FP_ZERO; 
         }
-        
+
         inline bool is_zero(long double n) 
         { 
-            return boost::spirit::math::fpclassify(n) == FP_ZERO; 
+            return math::fpclassify(n) == FP_ZERO; 
         }
-        
+
         template <typename T>
         inline bool is_zero(T n)
         {
             return (n == 0) ? true : false;
         }
-        
+
         ///////////////////////////////////////////////////////////////////////
         struct cast_to_long
         {
@@ -146,17 +145,17 @@
             {
                 return static_cast<long>(std::floor(n));
             }
-            
+
             static long call(double n, mpl::false_)
             {
                 return static_cast<long>(std::floor(n));
             }
-            
+
             static long call(long double n, mpl::false_)
             {
                 return static_cast<long>(std::floor(n));
             }
-            
+
             template <typename T>
             static long call(T n, mpl::false_)
             {
@@ -178,30 +177,34 @@
                 return call(n, mpl::bool_<is_integral<T>::value>());
             }
         };
-        
+
         ///////////////////////////////////////////////////////////////////////
-        struct round_to_long
+        struct truncate_to_long
         {
             static long call(float n, mpl::false_)
             {
-                return static_cast<long>(std::floor(n + 0.5f));
+                return is_negative(n) ? static_cast<long>(std::ceil(n)) : 
+                    static_cast<long>(std::floor(n));
             }
-            
+
             static long call(double n, mpl::false_)
             {
-                return static_cast<long>(std::floor(n + 0.5));
+                return is_negative(n) ? static_cast<long>(std::ceil(n)) : 
+                    static_cast<long>(std::floor(n));
             }
-            
+
             static long call(long double n, mpl::false_)
             {
-                return static_cast<long>(std::floor(n + 0.5l));
+                return is_negative(n) ? static_cast<long>(std::ceil(n)) : 
+                    static_cast<long>(std::floor(n));
             }
-            
+
             template <typename T>
             static long call(T n, mpl::false_)
             {
+                // allow for ADL to find the correct overloads for ltrunc
                 using namespace std;
-                return lround(n);
+                return ltrunc(n);
             }
 
             template <typename T>
@@ -216,7 +219,7 @@
                 return call(n, mpl::bool_<is_integral<T>::value>());
             }
         };
-        
+
         ///////////////////////////////////////////////////////////////////////
         //
         //  Traits class for radix specific number conversion
@@ -227,12 +230,12 @@
         //          static int digit(unsigned n);
         //
         ///////////////////////////////////////////////////////////////////////
-        template<unsigned Radix, typename Tag>
+        template<unsigned Radix, typename CharEncoding, typename Tag>
         struct radix_traits;
 
         // Binary
-        template<typename Tag>
-        struct radix_traits<2, Tag>
+        template<typename CharEncoding, typename Tag>
+        struct radix_traits<2, CharEncoding, Tag>
         {
             static int digit(unsigned n)
             {
@@ -241,8 +244,8 @@
         };
 
         // Octal
-        template<typename Tag>
-        struct radix_traits<8, Tag>
+        template<typename CharEncoding, typename Tag>
+        struct radix_traits<8, CharEncoding, Tag>
         {
             static int digit(unsigned n)
             {
@@ -251,8 +254,8 @@
         };
 
         // Decimal 
-        template<typename Tag>
-        struct radix_traits<10, Tag>
+        template<typename CharEncoding, typename Tag>
+        struct radix_traits<10, CharEncoding, Tag>
         {
             static int digit(unsigned n)
             {
@@ -262,7 +265,7 @@
 
         // Hexadecimal, lower case
         template<>
-        struct radix_traits<16, unused_type>
+        struct radix_traits<16, unused_type, unused_type>
         {
             static int digit(unsigned n)
             {
@@ -273,19 +276,16 @@
         };
 
         // Hexadecimal, upper case
-        template<typename Tag>
-        struct radix_traits<16, Tag>
+        template<typename CharEncoding, typename Tag>
+        struct radix_traits<16, CharEncoding, Tag>
         {
-            typedef typename Tag::char_set char_set;
-            typedef typename Tag::char_class char_class_;
-
             static int digit(unsigned n)
             {
                 if (n <= 9)
                     return n + '0';
 
                 using spirit::char_class::convert;
-                return convert<char_set>::to(char_class_(), n - 10 + 'a');
+                return convert<CharEncoding>::to(Tag(), n - 10 + 'a');
             }
         };
 
@@ -298,7 +298,7 @@
             {
                 return n / Radix;
             }
-            
+
             template <typename T>
             static T call(T& n, mpl::false_)
             {
@@ -306,14 +306,51 @@
                 using namespace std; 
                 return floor(n / Radix);
             }
-            
+
             template <typename T>
-            static T call(T& n)
+            static T call(T& n, T, int)
             {
                 return call(n, mpl::bool_<is_integral<T>::value>());
             }
+
+            template <typename T>
+            static T call(T& n)
+            {
+                return call(n, n, 1);
+            }
+        };
+
+        // specialization for division by 10
+        template <>
+        struct divide<10>
+        {
+            template <typename T>
+            static T call(T& n, T, int, mpl::true_)
+            {
+                return n / 10;
+            }
+
+            template <typename T>
+            static T call(T, T& num, int exp, mpl::false_)
+            {
+                // Allow ADL to find the correct overload for floor
+                using namespace std; 
+                return floor(num / spirit::detail::pow10<T>(exp));
+            }
+
+            template <typename T>
+            static T call(T& n, T& num, int exp)
+            {
+                return call(n, num, exp, mpl::bool_<is_integral<T>::value>());
+            }
+
+            template <typename T>
+            static T call(T& n)
+            {
+                return call(n, n, 1);
+            }
         };
-        
+
         ///////////////////////////////////////////////////////////////////////
         template <unsigned Radix>
         struct remainder
@@ -340,9 +377,9 @@
                 return call(n, mpl::bool_<is_integral<T>::value>());
             }
         };
-        
+
     }   // namespace detail
-    
+
     ///////////////////////////////////////////////////////////////////////////
     //
     //  The int_inserter template takes care of the integer to string 
@@ -357,7 +394,7 @@
 #define BOOST_KARMA_NUMERICS_INNER_LOOP_PREFIX(z, x, data)                    \
         if (!detail::is_zero(n)) {                                            \
             int ch = radix_type::digit(remainder_type::call(n));              \
-            n = divide_type::call(n);                                         \
+            n = divide_type::call(n, num, ++exp);                             \
     /**/
 
 #define BOOST_KARMA_NUMERICS_INNER_LOOP_SUFFIX(z, x, data)                    \
@@ -366,28 +403,30 @@
         }                                                                     \
     /**/
 
-    template <unsigned Radix, typename Tag = unused_type>
+    template <
+        unsigned Radix, typename CharEncoding = unused_type
+      , typename Tag = unused_type>
     struct int_inserter
     {
-        typedef detail::radix_traits<Radix, Tag> radix_type;
+        typedef detail::radix_traits<Radix, CharEncoding, Tag> radix_type;
         typedef detail::divide<Radix> divide_type;
         typedef detail::remainder<Radix> remainder_type;
-        
+
         //  Common code for integer string representations
         template <typename OutputIterator, typename T>
         static bool
-        call(OutputIterator& sink, T n)
+        call(OutputIterator& sink, T n, T& num, int exp)
         {
             // remainder_type::call returns n % Radix
             int ch = radix_type::digit(remainder_type::call(n));
-            n = divide_type::call(n);
+            n = divide_type::call(n, num, ++exp);
 
             BOOST_PP_REPEAT(
                 BOOST_KARMA_NUMERICS_LOOP_UNROLL,
                 BOOST_KARMA_NUMERICS_INNER_LOOP_PREFIX, _);
 
             if (!detail::is_zero(n)) 
-                call(sink, n);
+                call(sink, n, num, exp);
 
             BOOST_PP_REPEAT(
                 BOOST_KARMA_NUMERICS_LOOP_UNROLL,
@@ -397,6 +436,14 @@
             ++sink;
             return true;
         }
+
+        //  Common code for integer string representations
+        template <typename OutputIterator, typename T>
+        static bool
+        call(OutputIterator& sink, T n)
+        {
+            return call(sink, n, n, 0);
+        }
     };
 
 #undef BOOST_KARMA_NUMERICS_INNER_LOOP_PREFIX
@@ -425,7 +472,7 @@
             return true;
         }
     };
-    
+
     template <>
     struct sign_inserter<true>
     {
@@ -448,97 +495,97 @@
     //  These are helper functions for the real policies allowing to generate
     //  a single character and a string
     ///////////////////////////////////////////////////////////////////////////
-    template <typename Tag = unused_type>
+    template <typename CharEncoding = unused_type, typename Tag = unused_type>
     struct char_inserter
     {
         template <typename OutputIterator, typename Char>
-        static bool
-        call(OutputIterator& sink, Char c)
+        static bool call(OutputIterator& sink, Char c)
         {
-            return detail::generate_to(sink, c, Tag());
+            return detail::generate_to(sink, c, CharEncoding(), Tag());
         }
     };
-    
-    template <typename Tag = unused_type>
+
+    template <typename CharEncoding = unused_type, typename Tag = unused_type>
     struct string_inserter
     {
         template <typename OutputIterator, typename String>
-        static bool
-        call(OutputIterator& sink, String str)
+        static bool call(OutputIterator& sink, String str)
         {
-            return detail::string_generate(sink, str, Tag());
+            return detail::string_generate(sink, str, CharEncoding(), Tag());
         }
     };
-    
+
     ///////////////////////////////////////////////////////////////////////////
     //
     //  The real_inserter template takes care of the floating point number to 
-    //  string conversion. The RealPolicies template parameter is used to allow
+    //  string conversion. The Policies template parameter is used to allow
     //  customization of the formatting process
     //
     ///////////////////////////////////////////////////////////////////////////
-    template <typename T, typename RealPolicies, typename Tag = unused_type>
-    struct real_inserter    
+    template <
+        typename T, typename Policies, typename CharEncoding = unused_type
+      , typename Tag = unused_type>
+    struct real_inserter
     {
-        enum { force_sign = RealPolicies::force_sign };
-        
+        enum { force_sign = Policies::force_sign };
+
         template <typename OutputIterator>
         static bool
-        call (OutputIterator& sink, float n, RealPolicies const& p)
+        call (OutputIterator& sink, float n, Policies const& p = Policies())
         {
-            int fpclass = boost::spirit::math::fpclassify(n);
+            int fpclass = math::fpclassify(n);
             if (FP_NAN == fpclass)
-                return RealPolicies::template nan<force_sign, Tag>(sink, n);
+                return Policies::template nan<force_sign, CharEncoding, Tag>(sink, n);
             else if (FP_INFINITE == fpclass)
-                return RealPolicies::template inf<force_sign, Tag>(sink, n);
+                return Policies::template inf<force_sign, CharEncoding, Tag>(sink, n);
             return call_n(sink, n, p);
         }
-        
+
         template <typename OutputIterator>
         static bool
-        call (OutputIterator& sink, double n, RealPolicies const& p)
+        call (OutputIterator& sink, double n, Policies const& p = Policies())
         {
-            int fpclass = boost::spirit::math::fpclassify(n);
+            int fpclass = math::fpclassify(n);
             if (FP_NAN == fpclass)
-                return RealPolicies::template nan<force_sign, Tag>(sink, n);
+                return Policies::template nan<force_sign, CharEncoding, Tag>(sink, n);
             else if (FP_INFINITE == fpclass)
-                return RealPolicies::template inf<force_sign, Tag>(sink, n);
+                return Policies::template inf<force_sign, CharEncoding, Tag>(sink, n);
             return call_n(sink, n, p);
         }
-        
+
         template <typename OutputIterator>
         static bool
-        call (OutputIterator& sink, long double n, RealPolicies const& p)
+        call (OutputIterator& sink, long double n, Policies const& p = Policies())
         {
-            int fpclass = boost::spirit::math::fpclassify(n);
+            int fpclass = math::fpclassify(n);
             if (FP_NAN == fpclass)
-                return RealPolicies::template nan<force_sign, Tag>(sink, n);
+                return Policies::template nan<force_sign, CharEncoding, Tag>(sink, n);
             else if (FP_INFINITE == fpclass)
-                return RealPolicies::template inf<force_sign, Tag>(sink, n);
+                return Policies::template inf<force_sign, CharEncoding, Tag>(sink, n);
             return call_n(sink, n, p);
         }
-                        
+
         template <typename OutputIterator, typename U>
         static bool
-        call (OutputIterator& sink, U n, RealPolicies const& p)
+        call (OutputIterator& sink, U n, Policies const& p = Policies())
         {
             // we have no means of testing whether the number is normalized if
             // the type is not float, double or long double
             return call_n(sink, T(n), p);
         }
-        
+
 #if BOOST_WORKAROUND(BOOST_MSVC, >= 1400)  
-# pragma warning(push)  
+# pragma warning(push)
 # pragma warning(disable: 4100)   // 'p': unreferenced formal parameter  
 # pragma warning(disable: 4127)   // conditional expression is constant
+# pragma warning(disable: 4267)   // conversion from 'size_t' to 'unsigned int', possible loss of data
 #endif 
-
         ///////////////////////////////////////////////////////////////////////
         //  This is the workhorse behind the real generator
         ///////////////////////////////////////////////////////////////////////
         template <typename OutputIterator, typename U>
         static bool
-        call_n (OutputIterator& sink, U n, RealPolicies const& p)
+        call_n (OutputIterator& sink, U n, Policies const& p)
         {
         // prepare sign and get output format
             bool sign_val = false;
@@ -548,30 +595,38 @@
                 n = -n;
                 sign_val = true;
             }
-            
+
         // The scientific representation requires the normalization of the 
         // value to convert.
 
+            // get correct precision for generated number
+            unsigned precision = p.precision(n);
+            if (std::numeric_limits<U>::digits10) 
+            {
+                // limit generated precision to digits10, if defined
+                precision = (std::min)(precision, 
+                    (unsigned)std::numeric_limits<U>::digits10 + 1);
+            }
+
             // allow for ADL to find the correct overloads for log10 et.al.
             using namespace std;
-            
+
             U dim = 0;
-            if (0 == (p.fixed & flags) && !detail::is_zero(n))
+            if (0 == (Policies::fmtflags::fixed & flags) && !detail::is_zero(n))
             {
                 dim = log10(n);
-                if (dim > 0)
-                    n /= pow(U(10.0), (int)detail::round_to_long::call(dim));
+                if (dim > 0) 
+                    n /= spirit::detail::pow10<U>(detail::truncate_to_long::call(dim));
                 else if (n < 1.) 
-                    n *= pow(U(10.0), (int)detail::round_to_long::call(-dim));
+                    n *= spirit::detail::pow10<U>(detail::truncate_to_long::call(-dim) + 1);
             }
-            
+
         // prepare numbers (sign, integer and fraction part)
-            unsigned precision = p.precision(n);
             U integer_part;
-            U precexp = std::pow(10.0, (int)precision);
+            U precexp = spirit::detail::pow10<U>(precision);
             U fractional_part = modf(n, &integer_part);
-            
-            fractional_part = floor(fractional_part * precexp + 0.5);
+
+            fractional_part = floor(fractional_part * precexp + U(0.5));
             if (fractional_part >= precexp) 
             {
                 fractional_part -= precexp;
@@ -582,50 +637,57 @@
         // fractional part
             U long_int_part = floor(integer_part);
             U long_frac_part = floor(fractional_part);
-            if (!p.trailing_zeros)
+            unsigned prec = precision;
+            if (!p.trailing_zeros(n))
             {
                 if (0 != long_frac_part) {
                     // remove the trailing zeros
-                    while (0 != precision && 
+                    while (0 != prec && 
                            0 == detail::remainder<10>::call(long_frac_part)) 
                     {
                         long_frac_part = detail::divide<10>::call(long_frac_part);
-                        --precision;
+                        --prec;
                     }
                 }
                 else {
                     // if the fractional part is zero, we don't need to output 
                     // any additional digits
-                    precision = 0;
+                    prec = 0;
+                }
+
+                if (precision != prec)
+                {
+                    long_frac_part = floor(fractional_part) / 
+                        spirit::detail::pow10<U>(precision-prec);
                 }
             }
-            
+
         // call the actual generating functions to output the different parts
             if (sign_val && detail::is_zero(long_int_part) && 
                 detail::is_zero(long_frac_part))
             {
                 sign_val = false;     // result is zero, no sign please
             }
-            
+
         // generate integer part
             bool r = p.template integer_part<force_sign>(
                 sink, long_int_part, sign_val);
 
         // generate decimal point
             r = r && p.dot(sink, long_frac_part);
-            
+
         // generate fractional part with the desired precision
-            r = r && p.fraction_part(sink, long_frac_part, precision);
+            r = r && p.fraction_part(sink, long_frac_part, prec);
 
-            if (r && 0 == (p.fixed & flags)) {
-                return p.template exponent<Tag>(sink, 
-                    detail::round_to_long::call(dim));
+            if (r && 0 == (Policies::fmtflags::fixed & flags)) {
+                return p.template exponent<CharEncoding, Tag>(sink, 
+                    detail::truncate_to_long::call(dim >= 0 ? dim : dim - 1));
             }
             return r;
         }
 
-#if BOOST_WORKAROUND(BOOST_MSVC, >= 1400)  
-# pragma warning(pop)  
+#if BOOST_WORKAROUND(BOOST_MSVC, >= 1400)
+# pragma warning(pop)
 #endif 
 
     };
Modified: trunk/boost/spirit/home/karma/numeric/int.hpp
==============================================================================
--- trunk/boost/spirit/home/karma/numeric/int.hpp	(original)
+++ trunk/boost/spirit/home/karma/numeric/int.hpp	2009-04-26 10:42:24 EDT (Sun, 26 Apr 2009)
@@ -12,33 +12,159 @@
 
 #include <limits>
 
-#include <boost/spirit/home/support/modifier.hpp>
+#include <boost/spirit/home/support/common_terminals.hpp>
+#include <boost/spirit/home/support/string_traits.hpp>
+#include <boost/spirit/home/support/info.hpp>
+#include <boost/spirit/home/support/char_class.hpp>
+#include <boost/spirit/home/support/detail/get_encoding.hpp>
+#include <boost/spirit/home/karma/meta_compiler.hpp>
+#include <boost/spirit/home/karma/delimit_out.hpp>
+#include <boost/spirit/home/karma/auxiliary/lazy.hpp>
+#include <boost/spirit/home/karma/detail/get_casetag.hpp>
 #include <boost/spirit/home/karma/domain.hpp>
-#include <boost/spirit/home/karma/delimit.hpp>
-#include <boost/spirit/home/karma/numeric/numeric_fwd.hpp>
 #include <boost/spirit/home/karma/numeric/detail/numeric_utils.hpp>
 #include <boost/fusion/include/at.hpp>
 #include <boost/fusion/include/value_at.hpp>
 #include <boost/fusion/include/vector.hpp>
-#include <boost/mpl/assert.hpp>
 
+///////////////////////////////////////////////////////////////////////////////
+namespace boost { namespace spirit
+{
+    namespace tag
+    {
+        template <typename T, unsigned Radix, bool force_sign>
+        struct int_tag {};
+    }
+
+    namespace karma
+    {
+        ///////////////////////////////////////////////////////////////////////
+        // This one is the class that the user can instantiate directly in 
+        // order to create a customized int generator
+        template <typename T, unsigned Radix = 10, bool force_sign = false>
+        struct int_generator
+          : spirit::terminal<tag::int_tag<T, Radix, force_sign> > 
+        {};
+    }
+
+    ///////////////////////////////////////////////////////////////////////////
+    // Enablers
+    ///////////////////////////////////////////////////////////////////////////
+    template <>
+    struct use_terminal<karma::domain, tag::short_>    // enables short_
+      : mpl::true_ {};
+
+    template <>
+    struct use_terminal<karma::domain, tag::int_>      // enables int_
+      : mpl::true_ {};
+
+    template <>
+    struct use_terminal<karma::domain, tag::long_>     // enables long_
+      : mpl::true_ {};
+
+#ifdef BOOST_HAS_LONG_LONG
+    template <>
+    struct use_terminal<karma::domain, tag::long_long> // enables long_long
+      : mpl::true_ {};
+#endif
+
+    ///////////////////////////////////////////////////////////////////////////
+    template <typename A0>
+    struct use_terminal<karma::domain         // enables short_(...)
+      , terminal_ex<tag::short_, fusion::vector1<A0> >
+    > : mpl::true_ {};
+
+    template <typename A0>
+    struct use_terminal<karma::domain         // enables int_(...)
+      , terminal_ex<tag::int_, fusion::vector1<A0> >
+    > : mpl::true_ {};
+
+    template <typename A0>
+    struct use_terminal<karma::domain         // enables long_(...)
+      , terminal_ex<tag::long_, fusion::vector1<A0> >
+    > : mpl::true_ {};
+
+#ifdef BOOST_HAS_LONG_LONG
+    template <typename A0>
+    struct use_terminal<karma::domain         // enables long_long(...)
+      , terminal_ex<tag::long_long, fusion::vector1<A0> >
+    > : mpl::true_ {};
+#endif
+
+    ///////////////////////////////////////////////////////////////////////////
+    template <>                               // enables *lazy* short_(...)
+    struct use_lazy_terminal<karma::domain, tag::short_, 1> 
+      : mpl::true_ {};
+
+    template <>                               // enables *lazy* int_(...)
+    struct use_lazy_terminal<karma::domain, tag::int_, 1> 
+      : mpl::true_ {};
+
+    template <>                               // enables *lazy* long_(...)
+    struct use_lazy_terminal<karma::domain, tag::long_, 1> 
+      : mpl::true_ {};
+
+#ifdef BOOST_HAS_LONG_LONG
+    template <>                               // enables *lazy* long_long(...)
+    struct use_lazy_terminal<karma::domain, tag::long_long, 1> 
+      : mpl::true_ {};
+#endif
+
+    ///////////////////////////////////////////////////////////////////////////
+    // enables any custom int_generator
+    template <typename T, unsigned Radix, bool force_sign>
+    struct use_terminal<karma::domain, tag::int_tag<T, Radix, force_sign> >
+      : mpl::true_ {};
+
+    // enables any custom int_generator(...)
+    template <typename T, unsigned Radix, bool force_sign, typename A0>
+    struct use_terminal<karma::domain
+      , terminal_ex<tag::int_tag<T, Radix, force_sign>, fusion::vector1<A0> >
+    > : mpl::true_ {};
+
+    // enables *lazy* custom int_generator
+    template <typename T, unsigned Radix, bool force_sign>
+    struct use_lazy_terminal<
+        karma::domain
+      , tag::int_tag<T, Radix, force_sign>
+      , 1 // arity
+    > : mpl::true_ {};
+
+}} 
+
+///////////////////////////////////////////////////////////////////////////////
 namespace boost { namespace spirit { namespace karma
 {
+    using spirit::short_;
+    using spirit::short__type;
+    using spirit::int_;
+    using spirit::int__type;
+    using spirit::long_;
+    using spirit::long__type;
+#ifdef BOOST_HAS_LONG_LONG
+    using spirit::long_long;
+    using spirit::long_long_type;
+#endif
+
     ///////////////////////////////////////////////////////////////////////////
     //  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.
+    //  conjunction with an Attribute.
     ///////////////////////////////////////////////////////////////////////////
-    template <typename T, unsigned Radix, bool ForceSign, typename Tag>
-    struct int_generator<false, T, Radix, ForceSign, Tag>
+    template <
+        typename T, typename CharEncoding, typename Tag, unsigned Radix
+      , bool force_sign>
+    struct any_int_generator
+      : primitive_generator<any_int_generator<T, CharEncoding, Tag, Radix
+          , force_sign> >
     {
-        template <typename Component, typename Context, typename Unused>
+        template <typename Context, typename Unused>
         struct attribute
         {
             typedef T type;
         };
 
-        // check template parameter 'Radix' for validity
+        // check template Attribute 'Radix' for validity
         BOOST_MPL_ASSERT_MSG(
             Radix == 2 || Radix == 8 || Radix == 10 || Radix == 16,
             not_supported_radix, ());
@@ -46,37 +172,35 @@
         BOOST_MPL_ASSERT_MSG(std::numeric_limits<T>::is_signed,
             signed_unsigned_mismatch, ());
 
-        // int has a parameter attached
-        template <typename Component, typename OutputIterator,
-            typename Context, typename Delimiter, typename Parameter>
+        // int has a Attribute attached
+        template <typename OutputIterator, typename Context, typename Delimiter
+          , typename Attribute>
         static bool
-        generate(Component const& /*component*/, OutputIterator& sink,
-            Context& /*ctx*/, Delimiter const& d, Parameter const& param)
+        generate(OutputIterator& sink, Context&, Delimiter const& d
+          , Attribute const& attr)
         {
-            sign_inserter<ForceSign>::call(sink, detail::is_zero(param),
-                detail::is_negative(param));
-            bool result = int_inserter<Radix, Tag>::call(sink,
-                detail::absolute_value(param));
-            karma::delimit(sink, d);           // always do post-delimiting
-            return result;
+            return 
+                sign_inserter<force_sign>::call(sink
+                  , detail::is_zero(attr), detail::is_negative(attr)) &&
+                int_inserter<Radix, CharEncoding, Tag>::call(sink
+                  , detail::absolute_value(attr)) &&
+                karma::delimit_out(sink, d);      // always do post-delimiting
         }
 
-        // this int has no parameter attached, it needs to have been
+        // this int has no Attribute attached, it needs to have been
         // initialized from a direct literal
-        template <typename Component, typename OutputIterator,
-            typename Context, typename Delimiter>
+        template <typename OutputIterator, typename Context, typename Delimiter>
         static bool
-        generate(Component const&, OutputIterator&, Context&, Delimiter const&,
-            unused_type)
+        generate(OutputIterator&, Context&, Delimiter const&, unused_type)
         {
             BOOST_MPL_ASSERT_MSG(false, int__not_usable_without_attribute, ());
             return false;
         }
 
-        template <typename Component, typename Context>
-        static std::string what(Component const& component, Context const& ctx)
+        template <typename Context>
+        static info what(Context const& ctx)
         {
-            return "integer";
+            return info("integer");
         }
     };
 
@@ -84,16 +208,25 @@
     //  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>
+    template <
+        typename T, typename CharEncoding, typename Tag, unsigned Radix
+      , bool force_sign, bool no_attribute>
+    struct literal_int_generator
+      : primitive_generator<literal_int_generator<T, CharEncoding, Tag, Radix
+          , force_sign, no_attribute> >
     {
-        template <typename Component, typename Context, typename Unused>
+        template <typename Context, typename Unused>
         struct attribute
         {
-            typedef unused_type type;
+            typedef typename mpl::if_c<
+                no_attribute, unused_type, T>::type
+            type;
         };
 
-        // check template parameter 'Radix' for validity
+        literal_int_generator(typename add_const<T>::type n)
+          : n_(n) {}
+
+        // check template Attribute 'Radix' for validity
         BOOST_MPL_ASSERT_MSG(
             Radix == 2 || Radix == 8 || Radix == 10 || Radix == 16,
             not_supported_radix, ());
@@ -101,140 +234,137 @@
         BOOST_MPL_ASSERT_MSG(std::numeric_limits<T>::is_signed,
             signed_unsigned_mismatch, ());
 
-        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*/)
-        {
-            T n = fusion::at_c<0>(component.elements);
-            sign_inserter<ForceSign>::call(sink, detail::is_zero(n),
-                detail::is_negative(n));
-            bool result = int_inserter<Radix, Tag>::call(sink,
-                detail::absolute_value(n));
-            karma::delimit(sink, d);           // always do post-delimiting
-            return result;
+        template <typename OutputIterator, typename Context, typename Delimiter
+          , typename Attribute>
+        bool generate(OutputIterator& sink, Context&, Delimiter const& d
+          , Attribute const&) const
+        {
+            return 
+                sign_inserter<force_sign>::call(sink
+                  , detail::is_zero(n_), detail::is_negative(n_)) &&
+                int_inserter<Radix, CharEncoding, Tag>::call(sink
+                  , detail::absolute_value(n_)) &&
+                karma::delimit_out(sink, d);      // always do post-delimiting
         }
 
-        template <typename Component, typename Context>
-        static std::string what(Component const& component, Context const& ctx)
+        template <typename Context>
+        static info what(Context const& ctx)
         {
-            return "integer";
+            return info("integer");
         }
-    };
 
-}}}
+        T n_;
+    };
 
-namespace boost { namespace spirit { namespace traits
-{
     ///////////////////////////////////////////////////////////////////////////
-    // lower_case int_generator generator
+    // Generator generators: make_xxx function (objects)
     ///////////////////////////////////////////////////////////////////////////
-    template <typename Domain, typename Elements, typename Modifier,
-      typename T, unsigned Radix, bool ForceSign, typename Tag>
-    struct make_modified_component<
-        Domain, karma::int_generator<false, T, Radix, ForceSign, Tag>, Elements, Modifier,
-        typename enable_if<
-            is_member_of_modifier<Modifier, spirit::char_class::lower_case_base_tag>
-        >::type
-    >
-    {
-        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 karma::int_generator<false, T, Radix, ForceSign, key_tag> int_type;
-        typedef component<karma::domain, int_type, fusion::nil> type;
+    template <typename T, typename Modifiers, unsigned Radix = 10
+      , bool force_sign = false>
+    struct make_int
+    {
+        static bool const lower = 
+            has_modifier<Modifiers, tag::char_code_base<tag::lower> >::value;
+        static bool const upper = 
+            has_modifier<Modifiers, tag::char_code_base<tag::upper> >::value;
+
+        typedef any_int_generator<
+            T
+          , typename spirit::detail::get_encoding<
+                Modifiers, unused_type, lower || upper>::type
+          , typename detail::get_casetag<Modifiers, lower || upper>::type
+          , Radix
+          , force_sign
+        > result_type;
 
-        static type
-        call(Elements const&)
+        result_type operator()(unused_type, unused_type) const
         {
-            return type(fusion::nil());
+            return result_type();
         }
     };
 
-    template <typename Domain, typename Elements, typename Modifier,
-      typename T, unsigned Radix, bool ForceSign, typename Tag>
-    struct make_modified_component<
-        Domain, karma::int_generator<true, T, Radix, ForceSign, Tag>, Elements, Modifier,
-        typename enable_if<
-            is_member_of_modifier<Modifier, spirit::char_class::lower_case_base_tag>
-        >::type
-    >
-    {
-        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 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;
+    ///////////////////////////////////////////////////////////////////////////
+    template <typename Modifiers>
+    struct make_primitive<tag::short_, Modifiers> 
+      : make_int<short, Modifiers> {};
+
+    template <typename Modifiers>
+    struct make_primitive<tag::int_, Modifiers> 
+      : make_int<int, Modifiers> {};
+
+    template <typename Modifiers>
+    struct make_primitive<tag::long_, Modifiers> 
+      : make_int<long, Modifiers> {};
+
+#ifdef BOOST_HAS_LONG_LONG
+    template <typename Modifiers>
+    struct make_primitive<tag::long_long, Modifiers> 
+      : make_int<boost::long_long_type, Modifiers> {};
+#endif
 
-        static type
-        call(Elements const& elements)
-        {
-            return type(elements);
-        }
-    };
+    template <typename T, unsigned Radix, bool force_sign, typename Modifiers>
+    struct make_primitive<tag::int_tag<T, Radix, force_sign>, Modifiers>
+      : make_int<T, Modifiers, Radix, force_sign> {};
 
     ///////////////////////////////////////////////////////////////////////////
-    // upper_case int_generator generator
-    ///////////////////////////////////////////////////////////////////////////
-    template <typename Domain, typename Elements, typename Modifier,
-      typename T, unsigned Radix, bool ForceSign, typename Tag>
-    struct make_modified_component<
-        Domain, karma::int_generator<false, T, Radix, ForceSign, Tag>, Elements, Modifier,
-        typename enable_if<
-            is_member_of_modifier<Modifier, spirit::char_class::upper_case_base_tag>
-        >::type
-    >
-    {
-        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 karma::int_generator<false, T, Radix, ForceSign, key_tag> int_type;
-        typedef component<karma::domain, int_type, fusion::nil> type;
+    template <typename T, typename Modifiers, unsigned Radix = 10
+      , bool force_sign = false>
+    struct make_int_direct
+    {
+        static bool const lower = 
+            has_modifier<Modifiers, tag::char_code_base<tag::lower> >::value;
+        static bool const upper = 
+            has_modifier<Modifiers, tag::char_code_base<tag::upper> >::value;
+
+        static bool const no_attr =
+            !has_modifier<Modifiers, tag::lazy_eval>::value;
+
+        typedef literal_int_generator<
+            T
+          , typename spirit::detail::get_encoding<
+                Modifiers, unused_type, lower || upper>::type
+          , typename detail::get_casetag<Modifiers, lower || upper>::type
+          , Radix
+          , force_sign
+          , no_attr
+        > result_type;
 
-        static type
-        call(Elements const&)
+        template <typename Terminal>
+        result_type operator()(Terminal const& term, unused_type) const
         {
-            return type(fusion::nil());
+            return result_type(fusion::at_c<0>(term.args));
         }
     };
 
-    template <typename Domain, typename Elements, typename Modifier,
-      typename T, unsigned Radix, bool ForceSign, typename Tag>
-    struct make_modified_component<
-        Domain, karma::int_generator<true, T, Radix, ForceSign, Tag>, Elements, Modifier,
-        typename enable_if<
-            is_member_of_modifier<Modifier, spirit::char_class::upper_case_base_tag>
-        >::type
-    >
-    {
-        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 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;
+    template <typename Modifiers, typename A0>
+    struct make_primitive<
+        terminal_ex<tag::short_, fusion::vector1<A0> >, Modifiers>
+      : make_int_direct<short, Modifiers> {};
+
+    template <typename Modifiers, typename A0>
+    struct make_primitive<
+        terminal_ex<tag::int_, fusion::vector1<A0> >, Modifiers>
+      : make_int_direct<int, Modifiers> {};
+
+    template <typename Modifiers, typename A0>
+    struct make_primitive<
+        terminal_ex<tag::long_, fusion::vector1<A0> >, Modifiers>
+      : make_int_direct<long, Modifiers> {};
+
+#ifdef BOOST_HAS_LONG_LONG
+    template <typename Modifiers, typename A0>
+    struct make_primitive<
+        terminal_ex<tag::long_long, fusion::vector1<A0> >, Modifiers>
+      : make_int_direct<boost::long_long_type, Modifiers> {};
+#endif
 
-        static type
-        call(Elements const& elements)
-        {
-            return type(elements);
-        }
-    };
+    template <typename T, unsigned Radix, bool force_sign, typename A0
+      , typename Modifiers>
+    struct make_primitive<
+        terminal_ex<tag::int_tag<T, Radix, force_sign>, fusion::vector1<A0> >
+          , Modifiers>
+      : make_int_direct<T, Modifiers, Radix, force_sign> {};
 
-}}}   // namespace boost::spirit::traits
+}}}
 
 #endif
Deleted: trunk/boost/spirit/home/karma/numeric/meta_grammar.hpp
==============================================================================
--- trunk/boost/spirit/home/karma/numeric/meta_grammar.hpp	2009-04-26 10:42:24 EDT (Sun, 26 Apr 2009)
+++ (empty file)
@@ -1,452 +0,0 @@
-//  Copyright (c) 2001-2009 Hartmut Kaiser
-//  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_KARMA_META_GRAMMAR_FEB_23_2007_0505PM)
-#define BOOST_SPIRIT_KARMA_META_GRAMMAR_FEB_23_2007_0505PM
-
-#if defined(_MSC_VER) && (_MSC_VER >= 1020)
-#pragma once      // MS compatible compilers support #pragma once
-#endif
-
-#include <boost/spirit/home/karma/domain.hpp>
-#include <boost/spirit/home/karma/numeric/numeric_fwd.hpp>
-#include <boost/spirit/home/support/placeholders.hpp>
-#include <boost/spirit/home/support/meta_grammar.hpp>
-#include <boost/utility/enable_if.hpp>
-#include <boost/mpl/identity.hpp>
-#include <boost/mpl/bool.hpp>
-
-namespace boost { namespace spirit { namespace karma
-{
-    template <typename Expr, typename Enable>
-    struct is_valid_expr;
-
-    template <typename Expr, typename Enable>
-    struct expr_transform;
-
-    ///////////////////////////////////////////////////////////////////////////
-    // numeric tags
-    ///////////////////////////////////////////////////////////////////////////
-    template <typename T, unsigned Radix, bool ForceSign>
-    struct int_tag
-    {};
-
-    template <typename T, unsigned Radix, bool ForceSign>
-    struct uint_tag
-    {};
-
-    template <typename T, typename RealPolicies>
-    struct real_tag 
-    {
-        RealPolicies policies;
-    };
-
-    ///////////////////////////////////////////////////////////////////////////
-    // numeric specs
-    ///////////////////////////////////////////////////////////////////////////
-    template <typename T, unsigned Radix, bool ForceSign>
-    struct int_spec
-      : proto::terminal<int_tag<T, Radix, ForceSign> >::type
-    {};
-
-    template <typename T, unsigned Radix, bool ForceSign>
-    struct uint_spec
-      : proto::terminal<uint_tag<T, Radix, ForceSign> >::type 
-    {};
-
-    ///////////////////////////////////////////////////////////////////////////
-    template <typename T, typename RealPolicies>
-    struct real_spec
-      : proto::terminal<real_tag<T, RealPolicies> >::type 
-    {
-    private:
-        typedef typename 
-            proto::terminal<real_tag<T, RealPolicies> >::type
-        base_type;
-
-        base_type make_tag(RealPolicies const& p) const
-        {
-            base_type xpr = {{p}};
-            return xpr;
-        }
-
-    public:
-        real_spec(RealPolicies const& p = RealPolicies())
-          : base_type(make_tag(p))
-        {}
-    };
-
-    ///////////////////////////////////////////////////////////////////////////
-    namespace detail
-    {
-        template <typename RealPolicies>
-        struct real_policy
-        {
-            template <typename Tag>
-            static RealPolicies get(Tag) { return RealPolicies(); }
-
-            template <typename T>
-            static RealPolicies const& get(real_tag<T, RealPolicies> const& p) 
-            { return p.policies; }
-        };
-    }
-    
-}}}   // namespace boost::spirit::karma
-
-namespace boost { namespace spirit 
-{
-    ///////////////////////////////////////////////////////////////////////////
-    //  test if a tag is an int tag (the basic specializations are defined in
-    //  the file support/placeholders.hpp)
-    ///////////////////////////////////////////////////////////////////////////
-    template <typename T, unsigned Radix, bool ForceSign>
-    struct is_int_tag<karma::int_tag<T, Radix, ForceSign>, karma::domain> : 
-        mpl::true_ {};
-
-    template <typename T, unsigned Radix, bool ForceSign>
-    struct is_int_tag<karma::uint_tag<T, Radix, ForceSign>, karma::domain> : 
-        mpl::true_ {};
-
-    ///////////////////////////////////////////////////////////////////////////
-    //  test if a tag is a real tag (the basic specializations are defined in
-    //  the file support/placeholders.hpp)
-    ///////////////////////////////////////////////////////////////////////////
-    template <typename T, typename RealPolicies>
-    struct is_real_tag<karma::real_tag<T, RealPolicies>, karma::domain> : 
-        mpl::true_ {};
-
-}}  // namespace boost::spirit
-
-namespace boost { namespace spirit { namespace karma
-{
-    ///////////////////////////////////////////////////////////////////////////
-    // get the director of an int tag
-    ///////////////////////////////////////////////////////////////////////////
-    template <typename T, bool IsLiteral>
-    struct extract_int_director;
-
-    template <bool IsLiteral>
-    struct extract_int_director<tag::bin, IsLiteral>    
-    {
-        typedef uint_generator<IsLiteral, unsigned, 2, false> type;
-    };
-
-    template <bool IsLiteral>
-    struct extract_int_director<tag::oct, IsLiteral>    
-    {
-        typedef uint_generator<IsLiteral, unsigned, 8, false> type;
-    };
-        
-    template <bool IsLiteral>
-    struct extract_int_director<tag::hex, IsLiteral>    
-    {
-        typedef uint_generator<IsLiteral, unsigned, 16, false> type;
-    };
-        
-    template <bool IsLiteral>
-    struct extract_int_director<tag::ushort, IsLiteral>    
-    {
-        typedef uint_generator<IsLiteral, unsigned short, 10, false> type;
-    };
-        
-    template <bool IsLiteral>
-    struct extract_int_director<tag::ulong, IsLiteral>    
-    {
-        typedef uint_generator<IsLiteral, unsigned long, 10, false> type;
-    };
-        
-    template <bool IsLiteral>
-    struct extract_int_director<tag::uint, IsLiteral>    
-    {
-        typedef uint_generator<IsLiteral, unsigned int, 10, false> type;
-    };
-    
-    template <bool IsLiteral>
-    struct extract_int_director<tag::short_, IsLiteral>    
-    {
-        typedef int_generator<IsLiteral, short, 10, false> type;
-    };
-
-    template <bool IsLiteral>
-    struct extract_int_director<tag::long_, IsLiteral>    
-    {
-        typedef int_generator<IsLiteral, long, 10, false> type;
-    };
-
-    template <bool IsLiteral>
-    struct extract_int_director<tag::int_, IsLiteral>    
-    {
-        typedef int_generator<IsLiteral, int, 10, false> type;
-    };
-
-#ifdef BOOST_HAS_LONG_LONG
-    template <bool IsLiteral>
-    struct extract_int_director<tag::ulong_long, IsLiteral>    
-    {
-        typedef uint_generator<IsLiteral, boost::ulong_long_type, 10, false> type;
-    };
-        
-    template <bool IsLiteral>
-    struct extract_int_director<tag::long_long, IsLiteral>    
-    {
-        typedef int_generator<IsLiteral, boost::long_long_type, 10, false> type;
-    };
-#endif
-
-    template <typename T, unsigned Radix, bool ForceSign, bool IsLiteral>
-    struct extract_int_director<int_tag<T, Radix, ForceSign>, IsLiteral>
-    {
-        typedef int_generator<IsLiteral, T, Radix, ForceSign> type;
-    };
-
-    template <typename T, unsigned Radix, bool ForceSign, bool IsLiteral>
-    struct extract_int_director<uint_tag<T, Radix, ForceSign>, IsLiteral>
-    {
-        typedef uint_generator<IsLiteral, T, Radix, ForceSign> type;
-    };
-
-    template <typename T, typename Unused>
-    struct extract_int_director_lit
-      : extract_int_director<T, true> {};
-    
-    template <typename T>
-    struct extract_int_director_plain
-      : extract_int_director<T, false> {};
-
-    ///////////////////////////////////////////////////////////////////////////
-    // get the director of a floating point literal type
-    ///////////////////////////////////////////////////////////////////////////
-    template <typename Tag>
-    struct extract_literal_real_director;
-
-    template <>
-    struct extract_literal_real_director<float>    
-    {
-        typedef 
-            real_generator<true, float, real_generator_policies<float> > 
-        type;
-    };
-
-    template <>
-    struct extract_literal_real_director<double>    
-    {
-        typedef 
-            real_generator<true, double, real_generator_policies<double> > 
-        type;
-    };
-
-    template <>
-    struct extract_literal_real_director<long double>    
-    {
-        typedef 
-            real_generator<
-                true, long double, real_generator_policies<long double> 
-            > 
-        type;
-    };
-
-    ///////////////////////////////////////////////////////////////////////////
-    // get the director of a floating point tag
-    ///////////////////////////////////////////////////////////////////////////
-    template <typename Tag, bool IsLiteral>
-    struct extract_real_director;
-    
-    template <bool IsLiteral>
-    struct extract_real_director<tag::float_, IsLiteral>    
-    {
-        typedef 
-            real_generator<IsLiteral, float, real_generator_policies<float> > 
-        type;
-    };
-
-    template <bool IsLiteral>
-    struct extract_real_director<tag::double_, IsLiteral>    
-    {
-        typedef 
-            real_generator<IsLiteral, double, real_generator_policies<double> > 
-        type;
-    };
-
-    template <bool IsLiteral>
-    struct extract_real_director<tag::long_double, IsLiteral>    
-    {
-        typedef 
-            real_generator<
-                IsLiteral, long double, real_generator_policies<long double> 
-            > 
-        type;
-    };
-
-    template <typename T, typename RealPolicies, bool IsLiteral>
-    struct extract_real_director<real_tag<T, RealPolicies>, IsLiteral>
-    {
-        typedef real_generator<IsLiteral, T, RealPolicies> type;
-    };
-
-    ///////////////////////////////////////////////////////////////////////////
-    template <typename Tag, typename Unused>
-    struct extract_real_director_lit
-      : extract_real_director<Tag, true> {};
-    
-    template <typename Tag>
-    struct extract_real_director_plain
-      : extract_real_director<Tag, false> {};
-
-    ///////////////////////////////////////////////////////////////////////////
-    // get the director of an integer literal type
-    ///////////////////////////////////////////////////////////////////////////
-    template <typename T>
-    struct extract_literal_int_director;
-
-    template <>
-    struct extract_literal_int_director<short>    
-    {
-        typedef int_generator<true, short, 10, false> type;
-    };
-
-    template <>
-    struct extract_literal_int_director<unsigned short>    
-    {
-        typedef uint_generator<true, unsigned short, 10, false> type;
-    };
-        
-    template <>
-    struct extract_literal_int_director<int>
-    {
-        typedef int_generator<true, int, 10, false> type;
-    };
-        
-    template <>
-    struct extract_literal_int_director<unsigned int>    
-    {
-        typedef uint_generator<true, unsigned int, 10, false> type;
-    };
-        
-    template <>
-    struct extract_literal_int_director<long>
-    {
-        typedef int_generator<true, long, 10, false> type;
-    };
-        
-    template <>
-    struct extract_literal_int_director<unsigned long>    
-    {
-        typedef uint_generator<true, unsigned long, 10, false> type;
-    };
-    
-#ifdef BOOST_HAS_LONG_LONG
-    template <>
-    struct extract_literal_int_director<boost::ulong_long_type>    
-    {
-        typedef int_generator<true, boost::ulong_long_type, 10, false> type;
-    };
-
-    template <>
-    struct extract_literal_int_director<boost::long_long_type>    
-    {
-        typedef uint_generator<true, boost::long_long_type, 10, false> type;
-    };
-#endif
-
-    ///////////////////////////////////////////////////////////////////////////
-    // numeric parser meta-grammar
-    ///////////////////////////////////////////////////////////////////////////
-
-    // literals: 10, 10L, 10LL
-    struct int_literal_meta_grammar
-      : meta_grammar::compose_empty<
-            proto::if_<
-                is_int_lit_tag<proto::_child, karma::domain>()
-            >,
-            karma::domain,
-            mpl::identity<extract_literal_int_director<mpl::_> >
-        >
-    {};
-
-    // all the different integer's as int_, uint, bin, oct, dec, hex, etc.
-    // and the corresponding int_(10), uint(10), etc.
-    struct int_meta_grammar
-      : proto::or_<
-            meta_grammar::compose_empty<
-                proto::if_<
-                    is_int_tag<proto::_child, karma::domain>()
-                >,
-                karma::domain,
-                mpl::identity<extract_int_director_plain<mpl::_> >
-            >,
-            meta_grammar::compose_function1_eval<
-                proto::function<
-                    proto::if_<
-                        is_int_tag<proto::_child, karma::domain>()
-                    >, 
-                    int_literal_meta_grammar
-                >, 
-                karma::domain, 
-                mpl::identity<extract_int_director_lit<mpl::_, mpl::_> >
-            >
-        >
-    {};
-
-    // floating point literals: 1.0, 1.0f, 10.1e2 etc.
-    struct real_literal_meta_grammar
-      : meta_grammar::compose_empty<
-            proto::if_<
-                is_real_lit_tag<proto::_child, karma::domain>()
-            >,
-            karma::domain,
-            mpl::identity<extract_literal_real_director<mpl::_> >
-        >
-    {};
-    
-    struct real_meta_grammar
-      : proto::or_<
-            meta_grammar::compose_single<
-                proto::if_<
-                    is_real_tag<proto::_child, karma::domain>()
-                >,
-                karma::domain,
-                mpl::identity<extract_real_director_plain<mpl::_> >
-            >,
-            meta_grammar::compose_function1_full<
-                proto::function<
-                    proto::if_<
-                        is_real_tag<proto::_child, karma::domain>()
-                    >, 
-                    real_literal_meta_grammar
-                >, 
-                karma::domain, 
-                mpl::identity<extract_real_director_lit<mpl::_, mpl::_> >
-            >
-        >
-    {};
-    
-    ///////////////////////////////////////////////////////////////////////////
-    struct numeric_meta_grammar
-      : proto::or_<
-            int_meta_grammar,
-            real_meta_grammar
-        >
-    {};
-
-    ///////////////////////////////////////////////////////////////////////////
-    //  These specializations non-intrusively hooks into the RD meta-grammar.
-    //  (see qi/meta_grammar.hpp)
-    ///////////////////////////////////////////////////////////////////////////  
-    template <typename Expr>
-    struct is_valid_expr<Expr
-      , typename enable_if<proto::matches<Expr, numeric_meta_grammar> >::type>
-      : mpl::true_
-    {};
-
-    template <typename Expr>
-    struct expr_transform<Expr
-      , typename enable_if<proto::matches<Expr, numeric_meta_grammar> >::type>
-      : mpl::identity<numeric_meta_grammar>
-    {};
-    
-}}}
-
-#endif
Deleted: trunk/boost/spirit/home/karma/numeric/numeric_fwd.hpp
==============================================================================
--- trunk/boost/spirit/home/karma/numeric/numeric_fwd.hpp	2009-04-26 10:42:24 EDT (Sun, 26 Apr 2009)
+++ (empty file)
@@ -1,51 +0,0 @@
-//  Copyright (c) 2001-2009 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_NUMERIC_FWD_FEB_27_2007_1338PM)
-#define BOOST_SPIRIT_KARMA_NUMERIC_FWD_FEB_27_2007_1338PM
-
-#if defined(_MSC_VER) && (_MSC_VER >= 1020)
-#pragma once      // MS compatible compilers support #pragma once
-#endif
-
-namespace boost { namespace spirit { namespace karma
-{
-    ///////////////////////////////////////////////////////////////////////////
-    // forwards
-    ///////////////////////////////////////////////////////////////////////////
-    template <bool IsLiteral, typename T, unsigned Radix, bool ForceSign, 
-        typename Tag = unused_type>
-    struct int_generator;
-
-    template <bool IsLiteral, typename T, unsigned Radix, bool ForceSign, 
-        typename Tag = unused_type>
-    struct uint_generator;
-
-    ///////////////////////////////////////////////////////////////////////////
-    template <typename T = int, unsigned Radix = 10, bool ForceSign = false>
-    struct int_spec;
-    
-    template <typename T = unsigned int, unsigned Radix = 10, 
-        bool ForceSign = false>
-    struct uint_spec;
-    
-    ///////////////////////////////////////////////////////////////////////////
-    template <bool IsLiteral, typename T, typename RealPolicies,
-        typename Tag = unused_type>
-    struct real_generator;
-    
-    template <typename T>
-    struct real_generator_policies;
-
-    ///////////////////////////////////////////////////////////////////////////
-    template <typename T = double, 
-        typename RealPolicies = real_generator_policies<T> >
-    struct real_spec;
-    
-}}}   // namespace boost::spirit::karma
-
-#endif
-
-
Modified: trunk/boost/spirit/home/karma/numeric/real.hpp
==============================================================================
--- trunk/boost/spirit/home/karma/numeric/real.hpp	(original)
+++ trunk/boost/spirit/home/karma/numeric/real.hpp	2009-04-26 10:42:24 EDT (Sun, 26 Apr 2009)
@@ -10,238 +10,332 @@
 #pragma once      // MS compatible compilers support #pragma once
 #endif
 
+#include <boost/config/no_tr1/cmath.hpp>
+#include <boost/spirit/home/support/common_terminals.hpp>
+#include <boost/spirit/home/support/string_traits.hpp>
+#include <boost/spirit/home/support/info.hpp>
 #include <boost/spirit/home/support/char_class.hpp>
-#include <boost/spirit/home/support/modifier.hpp>
+#include <boost/spirit/home/support/detail/get_encoding.hpp>
+#include <boost/spirit/home/karma/meta_compiler.hpp>
+#include <boost/spirit/home/karma/char.hpp>
+#include <boost/spirit/home/karma/delimit_out.hpp>
+#include <boost/spirit/home/karma/auxiliary/lazy.hpp>
+#include <boost/spirit/home/karma/detail/get_casetag.hpp>
 #include <boost/spirit/home/karma/domain.hpp>
-#include <boost/spirit/home/karma/delimit.hpp>
 #include <boost/spirit/home/karma/numeric/real_policies.hpp>
-#include <boost/spirit/home/karma/char.hpp>
-#include <boost/spirit/home/karma/numeric/int.hpp>
 #include <boost/spirit/home/karma/numeric/detail/numeric_utils.hpp>
-#include <boost/config/no_tr1/cmath.hpp>
+#include <boost/fusion/include/at.hpp>
+#include <boost/fusion/include/value_at.hpp>
+#include <boost/fusion/include/vector.hpp>
 
-namespace boost { namespace spirit { namespace karma
+namespace boost { namespace spirit 
 {
-    namespace detail
+    namespace tag
+    {
+        template <typename T, typename Policies>
+        struct real_tag 
+        {
+            real_tag() {}
+            real_tag(Policies const& policies)
+              : policies_(policies) {}
+
+            Policies policies_;
+        };
+    }
+
+    namespace karma
     {
-        template <typename RealPolicies>
-        struct real_policy;
+        ///////////////////////////////////////////////////////////////////////
+        // This one is the class that the user can instantiate directly in 
+        // order to create a customized real generator
+        template <typename T, typename Policies = real_policies<T> >
+        struct real_generator
+          : spirit::terminal<tag::real_tag<T, Policies> > 
+        {
+            real_generator() {}
+            real_generator(Policies const& p)
+              : spirit::terminal<tag::real_tag<T, Policies> >(p) {}
+        };
     }
 
     ///////////////////////////////////////////////////////////////////////////
+    // Enablers
+    ///////////////////////////////////////////////////////////////////////////
+    template <>
+    struct use_terminal<karma::domain, tag::float_>       // enables float_
+      : mpl::true_ {};
+
+    template <>
+    struct use_terminal<karma::domain, tag::double_>      // enables double_
+      : mpl::true_ {};
+
+    template <>
+    struct use_terminal<karma::domain, tag::long_double>  // enables long_double
+      : mpl::true_ {};
+
+    ///////////////////////////////////////////////////////////////////////////
+    template <typename A0>
+    struct use_terminal<karma::domain                   // enables float_(...)
+      , terminal_ex<tag::float_, fusion::vector1<A0> >
+    > : mpl::true_ {};
+
+    template <typename A0>
+    struct use_terminal<karma::domain                   // enables double_(...)
+      , terminal_ex<tag::double_, fusion::vector1<A0> >
+    > : mpl::true_ {};
+
+    template <typename A0>
+    struct use_terminal<karma::domain                   // enables long_double(...)
+      , terminal_ex<tag::long_double, fusion::vector1<A0> >
+    > : mpl::true_ {};
+
+    // lazy float_(...), double_(...), long_double(...)
+    template <>
+    struct use_lazy_terminal<karma::domain, tag::float_, 1> 
+      : mpl::true_ {};
+
+    template <>
+    struct use_lazy_terminal<karma::domain, tag::double_, 1> 
+      : mpl::true_ {};
+
+    template <>
+    struct use_lazy_terminal<karma::domain, tag::long_double, 1> 
+      : mpl::true_ {};
+
+    ///////////////////////////////////////////////////////////////////////////
+    // enables custom real generator
+    template <typename T, typename Policy>
+    struct use_terminal<karma::domain, tag::real_tag<T, Policy> >
+      : mpl::true_ {};
+
+    template <typename T, typename Policy, typename A0>
+    struct use_terminal<karma::domain
+      , terminal_ex<tag::real_tag<T, Policy>, fusion::vector1<A0> >
+    > : mpl::true_ {};
+
+    // enables *lazy* custom real generator
+    template <typename T, typename Policy>
+    struct use_lazy_terminal<
+        karma::domain
+      , tag::real_tag<T, Policy>
+      , 1 // arity
+    > : mpl::true_ {};
+
+}}
+
+///////////////////////////////////////////////////////////////////////////////
+namespace boost { namespace spirit { namespace karma
+{
+    using spirit::float_;
+    using spirit::float__type;
+    using spirit::double_;
+    using spirit::double__type;
+    using spirit::long_double;
+    using spirit::long_double_type;
+
+    ///////////////////////////////////////////////////////////////////////////
     //  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.
+    //  conjunction with an attribute.
     ///////////////////////////////////////////////////////////////////////////
-    template <typename T, typename RealPolicies, typename Tag>
-    struct real_generator<false, T, RealPolicies, Tag>
+    template <
+        typename T, typename Policies, typename CharEncoding, typename Tag>
+    struct any_real_generator
+      : primitive_generator<any_real_generator<T, Policies, CharEncoding, Tag> >
     {
-        template <typename Component, typename Context, typename Unused>
+        template <typename Context, typename Unused>
         struct attribute
         {
             typedef T type;
         };
 
-        // double_/float_/etc. has a parameter attached
-        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)
-        {
-            RealPolicies const& p = 
-                detail::real_policy<RealPolicies>::get(spirit::subject(component));
-
-            bool result = real_inserter<T, RealPolicies, Tag>::
-                call(sink, param, p);
+        any_real_generator(Policies const& policies = Policies())
+          : p_(policies) {}
 
-            karma::delimit(sink, d);           // always do post-delimiting
-            return result;
+        // double_/float_/etc. has an attached attribute
+        template <typename OutputIterator, typename Context, typename Delimiter
+          , typename Attribute>
+        bool generate(OutputIterator& sink, Context&, Delimiter const& d
+          , Attribute const& attr) const
+        {
+            typedef real_inserter<T, Policies, CharEncoding, Tag> inserter_type;
+            return inserter_type::call(sink, attr, p_) &&
+                   karma::delimit_out(sink, d);    // always do post-delimiting
         }
 
-        // this double_/float_/etc. has no parameter attached, it needs to have
+        // this double_/float_/etc. has no attribute attached, it needs to have
         // been initialized from a direct literal
-        template <typename Component, typename OutputIterator,
-            typename Context, typename Delimiter>
-        static bool
-        generate(Component const&, OutputIterator&, Context&, Delimiter const&,
-            unused_type)
+        template <typename OutputIterator, typename Context, typename Delimiter>
+        static bool generate(OutputIterator&, Context&, Delimiter const&
+          , unused_type) 
         {
-            BOOST_MPL_ASSERT_MSG(false, real_not_usable_without_attribute,
-                (Component, Context));
+            BOOST_MPL_ASSERT_MSG(false, real_not_usable_without_attribute, ());
             return false;
         }
 
-        template <typename Component, typename Context>
-        static std::string what(Component const& /*component*/, Context const& /*ctx*/)
+        template <typename Context>
+        static info what(Context const& ctx)
         {
-            return "real number";
+            return info("real");
         }
+
+        Policies p_;
     };
 
     ///////////////////////////////////////////////////////////////////////////
     //  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>
+    template <
+        typename T, typename Policies, typename CharEncoding, typename Tag
+      , bool no_attribute>
+    struct literal_real_generator
+      : primitive_generator<literal_real_generator<T, Policies, CharEncoding
+          , Tag, no_attribute> >
     {
-        template <typename Component, typename Context, typename Unused>
+        template <typename Context, typename Unused>
         struct attribute
         {
-            typedef unused_type type;
+            typedef typename mpl::if_c<
+                no_attribute, unused_type, T>::type
+            type;
         };
 
-        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*/)
-        {
-            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
-            return result;
+        literal_real_generator(typename add_const<T>::type n
+              , Policies const& policies = Policies())
+          : n_(n), p_(policies) {}
+
+        template <typename OutputIterator, typename Context, typename Delimiter
+          , typename Attribute>
+        bool generate(OutputIterator& sink, Context&, Delimiter const& d
+          , Attribute const&) const
+        {
+            typedef real_inserter<T, Policies, CharEncoding, Tag> inserter_type;
+            return inserter_type::call(sink, n_, p_) &&
+                   karma::delimit_out(sink, d);    // always do post-delimiting
         }
 
-        template <typename Component, typename Context>
-        static std::string what(Component const& /*component*/, Context const& /*ctx*/)
+        template <typename Context>
+        static info what(Context const& ctx)
         {
-            return "real number";
+            return info("real");
         }
+
+        T n_;
+        Policies p_;
     };
 
-}}}
+    ///////////////////////////////////////////////////////////////////////////
+    namespace detail
+    {
+        // extract policies if this is a real_tag
+        template <typename Policies>
+        struct get_policies
+        {
+            template <typename Tag>
+            static Policies call(Tag) { return Policies(); }
+
+            template <typename T>
+            static Policies const& call(tag::real_tag<T, Policies> const& p) 
+            { return p.policies_; }
+        };
+    }
 
-namespace boost { namespace spirit { namespace traits
-{
     ///////////////////////////////////////////////////////////////////////////
-    // lower_case real generator
+    // Generator generators: make_xxx function (objects)
     ///////////////////////////////////////////////////////////////////////////
-    template <typename Domain, typename Elements, typename Modifier,
-      typename T, typename RealPolicies, typename Tag>
-    struct make_modified_component<
-        Domain, karma::real_generator<false, T, RealPolicies, Tag>, Elements, Modifier,
-        typename enable_if<
-            is_member_of_modifier<Modifier, spirit::char_class::lower_case_base_tag>
-        >::type
-    >
-    {
-        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 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;
+    template <
+        typename T, typename Modifiers, typename Policies = real_policies<T> >
+    struct make_real
+    {
+        static bool const lower = 
+            has_modifier<Modifiers, tag::char_code_base<tag::lower> >::value;
+        static bool const upper = 
+            has_modifier<Modifiers, tag::char_code_base<tag::upper> >::value;
+
+        typedef any_real_generator<
+            T, Policies
+          , typename spirit::detail::get_encoding<
+                Modifiers, unused_type, lower || upper>::type
+          , typename detail::get_casetag<Modifiers, lower || upper>::type
+        > result_type;
 
-        static type
-        call(Elements const& elements)
+        template <typename Terminal>
+        result_type operator()(Terminal const& term, unused_type) const
         {
-            return type(elements);
+            using karma::detail::get_policies;
+            return result_type(get_policies<Policies>::call(term));
         }
     };
 
-    template <typename Domain, typename Elements, typename Modifier,
-      typename T, typename RealPolicies, typename Tag>
-    struct make_modified_component<
-        Domain, karma::real_generator<true, T, RealPolicies, Tag>, Elements, Modifier,
-        typename enable_if<
-            is_member_of_modifier<Modifier, spirit::char_class::lower_case_base_tag>
-        >::type
-    >
-    {
-        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 typename
-            fusion::result_of::value_at_c<Elements, 0>::type
-        real_policy_type;
-        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)
-        {
-            return type(elements);
-        }
-    };
+    template <typename Modifiers>
+    struct make_primitive<tag::float_, Modifiers> 
+      : make_real<float, Modifiers> {};
+
+    template <typename Modifiers>
+    struct make_primitive<tag::double_, Modifiers> 
+      : make_real<double, Modifiers> {};
+
+    template <typename Modifiers>
+    struct make_primitive<tag::long_double, Modifiers> 
+      : make_real<long double, Modifiers> {};
 
     ///////////////////////////////////////////////////////////////////////////
-    // lower_case real generator
-    ///////////////////////////////////////////////////////////////////////////
-    template <typename Domain, typename Elements, typename Modifier,
-      typename T, typename RealPolicies, typename Tag>
-    struct make_modified_component<
-        Domain, karma::real_generator<false, T, RealPolicies, Tag>, Elements, Modifier,
-        typename enable_if<
-            is_member_of_modifier<Modifier, spirit::char_class::upper_case_base_tag>
-        >::type
-    >
-    {
-        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 typename
-            fusion::result_of::value_at_c<Elements, 0>::type
-        real_policy_type;
-        typedef fusion::vector<real_policy_type> vector_type;
+    template <typename T, typename Policy, typename Modifiers>
+    struct make_primitive<tag::real_tag<T, Policy>, Modifiers> 
+      : make_real<T, Modifiers, Policy> {};
 
-        typedef karma::real_generator<false, T, RealPolicies, key_tag> real_type;
-        typedef component<karma::domain, real_type, vector_type> type;
+    ///////////////////////////////////////////////////////////////////////////
+    template <
+        typename T, typename Modifiers, typename Policies = real_policies<T> >
+    struct make_real_direct
+    {
+        static bool const lower = 
+            has_modifier<Modifiers, tag::char_code_base<tag::lower> >::value;
+        static bool const upper = 
+            has_modifier<Modifiers, tag::char_code_base<tag::upper> >::value;
+
+        static bool const no_attr =
+            !has_modifier<Modifiers, tag::lazy_eval>::value;
+
+        typedef literal_real_generator<
+            T, Policies
+          , typename spirit::detail::get_encoding<
+                Modifiers, unused_type, lower || upper>::type
+          , typename detail::get_casetag<Modifiers, lower || upper>::type
+          , no_attr
+        > result_type;
 
-        static type
-        call(Elements const& elements)
+        template <typename Terminal>
+        result_type operator()(Terminal const& term, unused_type) const
         {
-            return type(elements);
+            return result_type(fusion::at_c<0>(term.args)
+              , karma::detail::get_policies<Policies>::call(term.term));
         }
     };
 
-    template <typename Domain, typename Elements, typename Modifier,
-      typename T, typename RealPolicies, typename Tag>
-    struct make_modified_component<
-        Domain, karma::real_generator<true, T, RealPolicies, Tag>, Elements, Modifier,
-        typename enable_if<
-            is_member_of_modifier<Modifier, spirit::char_class::upper_case_base_tag>
-        >::type
-    >
-    {
-        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 typename
-            fusion::result_of::value_at_c<Elements, 0>::type
-        real_policy_type;
-        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;
+    template <typename Modifiers, typename A0>
+    struct make_primitive<
+        terminal_ex<tag::float_, fusion::vector1<A0> >, Modifiers>
+      : make_real_direct<float, Modifiers> {};
+
+    template <typename Modifiers, typename A0>
+    struct make_primitive<
+        terminal_ex<tag::double_, fusion::vector1<A0> >, Modifiers>
+      : make_real_direct<double, Modifiers> {};
+
+    template <typename Modifiers, typename A0>
+    struct make_primitive<
+        terminal_ex<tag::long_double, fusion::vector1<A0> >, Modifiers>
+      : make_real_direct<long double, Modifiers> {};
 
-        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)
-        {
-            return type(elements);
-        }
-    };
+    ///////////////////////////////////////////////////////////////////////////
+    template <typename T, typename Policy, typename A0, typename Modifiers>
+    struct make_primitive<
+        terminal_ex<tag::real_tag<T, Policy>, fusion::vector1<A0> >
+          , Modifiers>
+      : make_real_direct<T, Modifiers, Policy> {};
 
-}}}   // namespace boost::spirit::traits
+}}}
 
 #endif // defined(BOOST_SPIRIT_KARMA_REAL_FEB_26_2007_0512PM)
Modified: trunk/boost/spirit/home/karma/numeric/real_policies.hpp
==============================================================================
--- trunk/boost/spirit/home/karma/numeric/real_policies.hpp	(original)
+++ trunk/boost/spirit/home/karma/numeric/real_policies.hpp	2009-04-26 10:42:24 EDT (Sun, 26 Apr 2009)
@@ -10,63 +10,81 @@
 #pragma once      // MS compatible compilers support #pragma once
 #endif
 
+#include <boost/config/no_tr1/cmath.hpp>
+#include <boost/math/special_functions/fpclassify.hpp>
+
 #include <boost/spirit/home/support/char_class.hpp>
+#include <boost/spirit/home/support/detail/scoped_enum_emulation.hpp>
 #include <boost/spirit/home/karma/generate.hpp>
 #include <boost/spirit/home/karma/char.hpp>
 #include <boost/spirit/home/karma/numeric/int.hpp>
-#include <boost/config/no_tr1/cmath.hpp>
-#include <boost/spirit/home/support/detail/math/fpclassify.hpp>
 
 namespace boost { namespace spirit { namespace karma 
 {
     ///////////////////////////////////////////////////////////////////////////
     //
-    //  real_generator_policies, if you need special handling of your floating
+    //  real_policies, if you need special handling of your floating
     //  point numbers, just overload this policy class and use it as a template
-    //  parameter to the karma::real_spec floating point specifier:
+    //  parameter to the karma::real_generator floating point specifier:
     //
     //      template <typename T>
-    //      struct scientific_policy : karma::real_generator_policies<T>
+    //      struct scientific_policy : karma::real_policies<T>
     //      {
     //          //  we want the numbers always to be in scientific format
-    //          static int floatfield(T n) { return scientific; }
+    //          static int floatfield(T n) { return fmtflags::scientific; }
     //      };
     //
     //      typedef 
-    //          karma::real_spec<double, scientific_policy<double> > 
+    //          karma::real_generator<double, scientific_policy<double> > 
     //      science_type;
     //
     //      karma::generate(sink, science_type(), 1.0); // will output: 1.0e00
     //
     ///////////////////////////////////////////////////////////////////////////
     template <typename T>
-    struct real_generator_policies
+    struct real_policies
     {
         ///////////////////////////////////////////////////////////////////////
+        // Expose the data type the generator is targeted to
+        ///////////////////////////////////////////////////////////////////////
+        typedef T value_type;
+
+        ///////////////////////////////////////////////////////////////////////
         //  Specifies, which representation type to use during output 
         //  generation.
         ///////////////////////////////////////////////////////////////////////
-        enum fmtflags 
+        BOOST_SCOPED_ENUM_START(fmtflags)
         {
             scientific = 0,   // Generate floating-point values in scientific 
                               // format (with an exponent field).
             fixed = 1         // Generate floating-point values in fixed-point 
                               // format (with no exponent field). 
         };
-        
+        BOOST_SCOPED_ENUM_END
+
         ///////////////////////////////////////////////////////////////////////
         //  The default behavior is to not to require generating a sign. If 
         //  'force_sign' is specified as true, then all generated numbers will 
         //  have a sign ('+' or '-', zeros will have a space instead of a sign)
         ///////////////////////////////////////////////////////////////////////
         static bool const force_sign = false;
-        
+
         ///////////////////////////////////////////////////////////////////////
-        //  The 'trailing_zeros' flag instructs the floating point generator to 
-        //  emit trailing zeros up to the required precision digits.
+        //  Return whether trailing zero digits have to be emitted in the 
+        //  fractional part of the output. If set, this flag instructs the 
+        //  floating point generator to emit trailing zeros up to the required 
+        //  precision digits (as returned by the precision() function).
+        // 
+        //      n     The floating point number to output. This can be used to 
+        //            adjust the required behavior depending on the value of 
+        //            this number.
         ///////////////////////////////////////////////////////////////////////
-        static bool const trailing_zeros = false;
-        
+        static bool trailing_zeros(T)
+        {
+            // the default behavior is not to generate trailing zeros
+            return false;
+        }
+
         ///////////////////////////////////////////////////////////////////////
         //  Decide, which representation type to use in the generated output.
         //
@@ -74,7 +92,7 @@
         //  between 0.001 and 100000 will be generated using the fixed format, 
         //  all others will be generated using the scientific representation.
         //
-        //  The trailing_zeros flag can be used to force the output of trailing 
+        //  The trailing_zeros_flag can be used to force the output of trailing 
         //  zeros in the fractional part up to the number of digits returned by 
         //  the precision() member function. The default is not to generate 
         //  the trailing zeros.
@@ -83,30 +101,16 @@
         //            adjust the formatting flags depending on the value of 
         //            this number.
         ///////////////////////////////////////////////////////////////////////
-        static int 
-        floatfield(T n)
+        static int floatfield(T n)
         {
             if (detail::is_zero(n))
-                return fixed;
+                return fmtflags::fixed;
 
             T abs_n = detail::absolute_value(n);
-            return (abs_n >= 1e5 || abs_n < 1e-3) ? scientific : fixed;
+            return (abs_n >= 1e5 || abs_n < 1e-3) 
+              ? fmtflags::scientific : fmtflags::fixed;
         }
-        
-        ///////////////////////////////////////////////////////////////////////
-        //  The 'fractional_precision' constant specifies the default number of 
-        //  digits to generate for the fractional part of a floating point 
-        //  number. This is used by this (default) policies implementation 
-        //  only. If you need another fractional precision you'll have to 
-        //  overload the precision function below.
-        //  
-        //  Note: The actual number of digits for a floating point number is 
-        //        determined by the precision() function below. This allows to
-        //        have different precisions depending on the value of the
-        //        floating point number.
-        ///////////////////////////////////////////////////////////////////////
-        static unsigned int const fractional_precision = 3;
-        
+
         ///////////////////////////////////////////////////////////////////////
         //  Return the maximum number of decimal digits to generate in the 
         //  fractional part of the output.
@@ -122,11 +126,10 @@
         //            function below. Moreover, this precision will be limited
         //            to the value of std::numeric_limits<T>::digits10 + 1
         ///////////////////////////////////////////////////////////////////////
-        static unsigned int
-        precision(T)
+        static unsigned precision(T)
         {
-            // generate max. 'fractional_precision' fractional digits
-            return fractional_precision;
+            // by default, generate max. 3 fractional digits
+            return 3;
         }
 
         ///////////////////////////////////////////////////////////////////////
@@ -138,14 +141,13 @@
         //      sign  The sign of the overall floating point number to convert.
         ///////////////////////////////////////////////////////////////////////
         template <bool ForceSign, typename OutputIterator>
-        static bool
-        integer_part (OutputIterator& sink, T n, bool sign)
+        static bool integer_part (OutputIterator& sink, T n, bool sign)
         {
             return sign_inserter<ForceSign>::call(
                         sink, detail::is_zero(n), sign) &&
                    int_inserter<10>::call(sink, n);
         }
-        
+
         ///////////////////////////////////////////////////////////////////////
         //  Generate the decimal point.
         //
@@ -165,12 +167,11 @@
         //            function below.
         ///////////////////////////////////////////////////////////////////////
         template <typename OutputIterator>
-        static bool
-        dot (OutputIterator& sink, T)
+        static bool dot (OutputIterator& sink, T)
         {
             return char_inserter<>::call(sink, '.');  // generate the dot by default 
         }
-        
+
         ///////////////////////////////////////////////////////////////////////
         //  Generate the fractional part of the number.
         //
@@ -199,8 +200,8 @@
         //
         ///////////////////////////////////////////////////////////////////////
         template <typename OutputIterator>
-        static bool
-        fraction_part (OutputIterator& sink, T n, unsigned precision_)
+        static bool fraction_part (OutputIterator& sink, T n
+          , unsigned precision_)
         {
             // allow for ADL to find the correct overload for floor and log10
             using namespace std;
@@ -208,7 +209,7 @@
             // The following is equivalent to:
             //    generate(sink, right_align(precision, '0')[ulong], n);
             // but it's spelled out to avoid inter-modular dependencies.
-            
+
             T digits = (detail::is_zero(n) ? 0 : floor(log10(n))) + 1;
             bool r = true;
             for (/**/; r && digits < precision_; digits = digits + 1)
@@ -229,18 +230,17 @@
         //  output possibly influenced by either the lower[...] or upper[...] 
         //  directives.
         ///////////////////////////////////////////////////////////////////////
-        template <typename Tag, typename OutputIterator>
-        static bool
-        exponent (OutputIterator& sink, T n)
+        template <typename CharEncoding, typename Tag, typename OutputIterator>
+        static bool exponent (OutputIterator& sink, long n)
         {
-            T abs_n = detail::absolute_value(n);
-            bool r = char_inserter<Tag>::call(sink, 'e') &&
+            long abs_n = detail::absolute_value(n);
+            bool r = char_inserter<CharEncoding, Tag>::call(sink, 'e') &&
                      sign_inserter<false>::call(
                           sink, detail::is_zero(n), detail::is_negative(n));
 
             // the C99 Standard requires at least two digits in the exponent
             if (r && abs_n < 10)
-                r = char_inserter<Tag>::call(sink, '0');
+                r = char_inserter<CharEncoding, Tag>::call(sink, '0');
             return r && int_inserter<10>::call(sink, abs_n);
         }
 
@@ -259,25 +259,27 @@
         //  Note: These functions get called only if fpclassify() returned 
         //        FP_INFINITY or FP_NAN.
         ///////////////////////////////////////////////////////////////////////
-        template <bool ForceSign, typename Tag, typename OutputIterator>
-        static bool 
-        nan (OutputIterator& sink, T n)
+        template <
+            bool ForceSign, typename CharEncoding, typename Tag
+          , typename OutputIterator>
+        static bool nan (OutputIterator& sink, T n)
         {
             return sign_inserter<ForceSign>::call(
                         sink, false, detail::is_negative(n)) &&
-                   string_inserter<Tag>::call(sink, "nan");
+                   string_inserter<CharEncoding, Tag>::call(sink, "nan");
         }
 
-        template <bool ForceSign, typename Tag, typename OutputIterator>
-        static bool 
-        inf (OutputIterator& sink, T n)
+        template <
+            bool ForceSign, typename CharEncoding, typename Tag
+          , typename OutputIterator>
+        static bool inf (OutputIterator& sink, T n)
         {
             return sign_inserter<ForceSign>::call(
                         sink, false, detail::is_negative(n)) &&
-                   string_inserter<Tag>::call(sink, "inf");
+                   string_inserter<CharEncoding, Tag>::call(sink, "inf");
         }
     };
-    
+
 }}}
 
 #endif // defined(BOOST_SPIRIT_KARMA_REAL_POLICIES_MAR_02_2007_0936AM)
Modified: trunk/boost/spirit/home/karma/numeric/uint.hpp
==============================================================================
--- trunk/boost/spirit/home/karma/numeric/uint.hpp	(original)
+++ trunk/boost/spirit/home/karma/numeric/uint.hpp	2009-04-26 10:42:24 EDT (Sun, 26 Apr 2009)
@@ -12,27 +12,200 @@
 
 #include <limits>
 
-#include <boost/spirit/home/support/modifier.hpp>
+#include <boost/spirit/home/support/common_terminals.hpp>
+#include <boost/spirit/home/support/string_traits.hpp>
+#include <boost/spirit/home/support/info.hpp>
+#include <boost/spirit/home/support/char_class.hpp>
+#include <boost/spirit/home/support/detail/get_encoding.hpp>
+#include <boost/spirit/home/karma/meta_compiler.hpp>
+#include <boost/spirit/home/karma/delimit_out.hpp>
+#include <boost/spirit/home/karma/auxiliary/lazy.hpp>
+#include <boost/spirit/home/karma/detail/get_casetag.hpp>
 #include <boost/spirit/home/karma/domain.hpp>
-#include <boost/spirit/home/karma/delimit.hpp>
-#include <boost/spirit/home/karma/numeric/numeric_fwd.hpp>
 #include <boost/spirit/home/karma/numeric/detail/numeric_utils.hpp>
 #include <boost/fusion/include/at.hpp>
 #include <boost/fusion/include/value_at.hpp>
-#include <boost/mpl/assert.hpp>
+#include <boost/fusion/include/vector.hpp>
 
+namespace boost { namespace spirit 
+{
+    namespace tag
+    {
+        template <typename T, unsigned Radix>
+        struct uint_tag {};
+    }
+
+    namespace karma
+    {
+        ///////////////////////////////////////////////////////////////////////
+        // This one is the class that the user can instantiate directly in 
+        // order to create a customized int generator
+        template <typename T, unsigned Radix = 10>
+        struct uint_generator
+          : spirit::terminal<tag::uint_tag<T, Radix> > 
+        {};
+    }
+
+    ///////////////////////////////////////////////////////////////////////////
+    // Enablers
+    ///////////////////////////////////////////////////////////////////////////
+    template <>
+    struct use_terminal<karma::domain, tag::ushort_>   // enables ushort_
+      : mpl::true_ {};
+
+    template <>
+    struct use_terminal<karma::domain, tag::uint_>     // enables uint_
+      : mpl::true_ {};
+
+    template <>
+    struct use_terminal<karma::domain, tag::ulong_>    // enables ulong_
+      : mpl::true_ {};
+
+    template <>
+    struct use_terminal<karma::domain, tag::bin>       // enables bin
+      : mpl::true_ {};
+
+    template <>
+    struct use_terminal<karma::domain, tag::oct>       // enables oct
+      : mpl::true_ {};
+
+    template <>
+    struct use_terminal<karma::domain, tag::hex>       // enables hex
+      : mpl::true_ {};
+
+#ifdef BOOST_HAS_LONG_LONG
+    template <>
+    struct use_terminal<karma::domain, tag::ulong_long> // enables ulong_long
+      : mpl::true_ {};
+#endif
+
+    ///////////////////////////////////////////////////////////////////////////
+    template <typename A0>
+    struct use_terminal<karma::domain         // enables ushort_(...)
+      , terminal_ex<tag::ushort_, fusion::vector1<A0> >
+    > : mpl::true_ {};
+
+    template <typename A0>
+    struct use_terminal<karma::domain         // enables uint_(...)
+      , terminal_ex<tag::uint_, fusion::vector1<A0> >
+    > : mpl::true_ {};
+
+    template <typename A0>
+    struct use_terminal<karma::domain         // enables ulong_(...)
+      , terminal_ex<tag::ulong_, fusion::vector1<A0> >
+    > : mpl::true_ {};
+
+    template <typename A0>
+    struct use_terminal<karma::domain         // enables bin(...)
+      , terminal_ex<tag::bin, fusion::vector1<A0> >
+    > : mpl::true_ {};
+
+    template <typename A0>
+    struct use_terminal<karma::domain         // enables oct(...)
+      , terminal_ex<tag::oct, fusion::vector1<A0> >
+    > : mpl::true_ {};
+
+    template <typename A0>
+    struct use_terminal<karma::domain         // enables hex(...)
+      , terminal_ex<tag::hex, fusion::vector1<A0> >
+    > : mpl::true_ {};
+
+#ifdef BOOST_HAS_LONG_LONG
+    template <typename A0>
+    struct use_terminal<karma::domain         // enables ulong_long(...)
+      , terminal_ex<tag::ulong_long, fusion::vector1<A0> >
+    > : mpl::true_ {};
+#endif
+
+    ///////////////////////////////////////////////////////////////////////////
+    template <>                               // enables *lazy* ushort_(...)
+    struct use_lazy_terminal<karma::domain, tag::ushort_, 1> 
+      : mpl::true_ {};
+
+    template <>                               // enables *lazy* uint_(...)
+    struct use_lazy_terminal<karma::domain, tag::uint_, 1> 
+      : mpl::true_ {};
+
+    template <>                               // enables *lazy* ulong_(...)
+    struct use_lazy_terminal<karma::domain, tag::ulong_, 1> 
+      : mpl::true_ {};
+
+    template <>                               // enables *lazy* bin(...)
+    struct use_lazy_terminal<karma::domain, tag::bin, 1> 
+      : mpl::true_ {};
+
+    template <>                               // enables *lazy* oct(...)
+    struct use_lazy_terminal<karma::domain, tag::oct, 1> 
+      : mpl::true_ {};
+
+    template <>                               // enables *lazy* hex(...)
+    struct use_lazy_terminal<karma::domain, tag::hex, 1> 
+      : mpl::true_ {};
+
+#ifdef BOOST_HAS_LONG_LONG
+    template <>                               // enables *lazy* ulong_long(...)
+    struct use_lazy_terminal<karma::domain, tag::ulong_long, 1> 
+      : mpl::true_ {};
+#endif
+
+    ///////////////////////////////////////////////////////////////////////////
+    // enables any custom uint_generator
+    template <typename T, unsigned Radix>
+    struct use_terminal<karma::domain, tag::uint_tag<T, Radix> >
+      : mpl::true_ {};
+
+    // enables any custom uint_generator(...)
+    template <typename T, unsigned Radix, typename A0>
+    struct use_terminal<karma::domain
+      , terminal_ex<tag::uint_tag<T, Radix>, fusion::vector1<A0> >
+    > : mpl::true_ {};
+
+    // enables *lazy* custom uint_generator
+    template <typename T, unsigned Radix>
+    struct use_lazy_terminal<
+        karma::domain
+      , tag::uint_tag<T, Radix>
+      , 1 // arity
+    > : mpl::true_ {};
+
+}} 
+
+///////////////////////////////////////////////////////////////////////////////
 namespace boost { namespace spirit { namespace karma
 {
-    template <typename T, unsigned Radix, bool ForceSign, typename Tag>
-    struct uint_generator<false, T, Radix, ForceSign, Tag>
+    using spirit::ushort_;
+    using spirit::ushort__type;
+    using spirit::uint_;
+    using spirit::uint__type;
+    using spirit::ulong_;
+    using spirit::ulong__type;
+#ifdef BOOST_HAS_LONG_LONG
+    using spirit::ulong_long;
+    using spirit::ulong_long_type;
+#endif
+    using spirit::bin;
+    using spirit::bin_type;
+    using spirit::oct;
+    using spirit::oct_type;
+    using spirit::hex;
+    using spirit::hex_type;
+
+    ///////////////////////////////////////////////////////////////////////////
+    //  This specialization is used for unsigned int generators not having a 
+    //  direct initializer: uint_, ulong_ etc. These generators must be used in
+    //  conjunction with an Attribute.
+    ///////////////////////////////////////////////////////////////////////////
+    template <typename T, typename CharEncoding, typename Tag, unsigned Radix>
+    struct any_uint_generator
+      : primitive_generator<any_uint_generator<T, CharEncoding, Tag, Radix> >
     {
-        template <typename Component, typename Context, typename Unused>
+        template <typename Context, typename Unused>
         struct attribute
         {
             typedef T type;
         };
 
-        // check template parameter 'Radix' for validity
+        // check template Attribute 'Radix' for validity
         BOOST_MPL_ASSERT_MSG(
             Radix == 2 || Radix == 8 || Radix == 10 || Radix == 16,
             not_supported_radix, ());
@@ -40,47 +213,58 @@
         BOOST_MPL_ASSERT_MSG(!std::numeric_limits<T>::is_signed,
             signed_unsigned_mismatch, ());
 
-        // uint has a parameter attached
-        template <typename Component, typename OutputIterator,
-            typename Context, typename Delimiter, typename Parameter>
+        // int has a Attribute attached
+        template <typename OutputIterator, typename Context, typename Delimiter
+          , typename Attribute>
         static bool
-        generate(Component const& /*component*/, OutputIterator& sink,
-            Context& /*ctx*/, Delimiter const& d, Parameter const& param)
+        generate(OutputIterator& sink, Context&, Delimiter const& d
+          , Attribute const& attr)
         {
-            bool result = int_inserter<Radix, Tag>::call(sink, param);
-            karma::delimit(sink, d);           // always do post-delimiting
-            return result;
+            return 
+                int_inserter<Radix, CharEncoding, Tag>::call(sink, attr) &&
+                karma::delimit_out(sink, d);      // always do post-delimiting
         }
 
-        // this uint has no parameter attached, it needs to have been
+        // this int has no Attribute attached, it needs to have been
         // initialized from a direct literal
-        template <typename Component, typename OutputIterator,
-            typename Context, typename Delimiter>
+        template <typename OutputIterator, typename Context, typename Delimiter>
         static bool
-        generate(Component const&, OutputIterator&, Context&, Delimiter const&,
-            unused_type)
+        generate(OutputIterator&, Context&, Delimiter const&, unused_type)
         {
-            BOOST_MPL_ASSERT_MSG(false, uint_not_usable_without_attribute, ());
+            BOOST_MPL_ASSERT_MSG(false, uint__not_usable_without_attribute, ());
             return false;
         }
 
-        template <typename Component, typename Context>
-        static std::string what(Component const& component, Context const& ctx)
+        template <typename Context>
+        static info what(Context const& ctx)
         {
-            return "unsigned integer";
+            return info("unsigned-integer");
         }
     };
 
-    template <typename T, unsigned Radix, bool ForceSign, typename Tag>
-    struct uint_generator<true, T, Radix, ForceSign, Tag>
+    ///////////////////////////////////////////////////////////////////////////
+    //  This specialization is used for unsigned int generators having a direct
+    //  initializer: uint_(10), ulong_(20) etc.
+    ///////////////////////////////////////////////////////////////////////////
+    template <
+        typename T, typename CharEncoding, typename Tag, unsigned Radix
+      , bool no_attribute>
+    struct literal_uint_generator
+      : primitive_generator<literal_uint_generator<T, CharEncoding, Tag, Radix
+          , no_attribute> >
     {
-        template <typename Component, typename Context, typename Unused>
+        template <typename Context, typename Unused>
         struct attribute
         {
-            typedef unused_type type;
+            typedef typename mpl::if_c<
+                no_attribute, unused_type, T>::type
+            type;
         };
 
-        // check template parameter 'Radix' for validity
+        literal_uint_generator(typename add_const<T>::type n)
+          : n_(n) {}
+
+        // check template Attribute 'Radix' for validity
         BOOST_MPL_ASSERT_MSG(
             Radix == 2 || Radix == 8 || Radix == 10 || Radix == 16,
             not_supported_radix, ());
@@ -88,137 +272,156 @@
         BOOST_MPL_ASSERT_MSG(!std::numeric_limits<T>::is_signed,
             signed_unsigned_mismatch, ());
 
-        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*/)
-        {
-            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
-            return result;
+        template <typename OutputIterator, typename Context, typename Delimiter
+          , typename Attribute>
+        bool generate(OutputIterator& sink, Context&, Delimiter const& d
+          , Attribute const&) const
+        {
+            return 
+                int_inserter<Radix, CharEncoding, Tag>::call(sink, n_) &&
+                karma::delimit_out(sink, d);      // always do post-delimiting
         }
 
-        template <typename Component, typename Context>
-        static std::string what(Component const& component, Context const& ctx)
+        template <typename Context>
+        static info what(Context const& ctx)
         {
-            return "unsigned integer";
+            return info("unsigned-integer");
         }
-    };
 
-}}}
+        T n_;
+    };
 
-namespace boost { namespace spirit { namespace traits
-{
     ///////////////////////////////////////////////////////////////////////////
-    // lower_case int_ generator
+    // Generator generators: make_xxx function (objects)
     ///////////////////////////////////////////////////////////////////////////
-    template <typename Domain, typename Elements, typename Modifier,
-      typename T, unsigned Radix, bool ForceSign, typename Tag>
-    struct make_modified_component<
-        Domain, karma::uint_generator<false, T, Radix, ForceSign, Tag>, Elements, Modifier,
-        typename enable_if<
-            is_member_of_modifier<Modifier, spirit::char_class::lower_case_base_tag>
-        >::type
-    >
-    {
-        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 karma::uint_generator<false, T, Radix, ForceSign, key_tag> int_type;
-        typedef component<karma::domain, int_type, fusion::nil> type;
+    template <typename T, typename Modifiers, unsigned Radix = 10>
+    struct make_uint
+    {
+        static bool const lower = 
+            has_modifier<Modifiers, tag::char_code_base<tag::lower> >::value;
+        static bool const upper = 
+            has_modifier<Modifiers, tag::char_code_base<tag::upper> >::value;
+
+        typedef any_uint_generator<
+            T
+          , typename spirit::detail::get_encoding<
+                Modifiers, unused_type, lower || upper>::type
+          , typename detail::get_casetag<Modifiers, lower || upper>::type
+          , Radix
+        > result_type;
 
-        static type
-        call(Elements const&)
+        result_type operator()(unused_type, unused_type) const
         {
-            return type(fusion::nil());
+            return result_type();
         }
     };
 
-    template <typename Domain, typename Elements, typename Modifier,
-      typename T, unsigned Radix, bool ForceSign, typename Tag>
-    struct make_modified_component<
-        Domain, karma::uint_generator<true, T, Radix, ForceSign, Tag>, Elements, Modifier,
-        typename enable_if<
-            is_member_of_modifier<Modifier, spirit::char_class::lower_case_base_tag>
-        >::type
-    >
-    {
-        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 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;
+    ///////////////////////////////////////////////////////////////////////////
+    template <typename Modifiers>
+    struct make_primitive<tag::ushort_, Modifiers> 
+      : make_uint<unsigned short, Modifiers> {};
+
+    template <typename Modifiers>
+    struct make_primitive<tag::uint_, Modifiers> 
+      : make_uint<unsigned int, Modifiers> {};
+
+    template <typename Modifiers>
+    struct make_primitive<tag::ulong_, Modifiers> 
+      : make_uint<unsigned long, Modifiers> {};
+
+    template <typename Modifiers>
+    struct make_primitive<tag::bin, Modifiers> 
+      : make_uint<unsigned, Modifiers, 2> {};
+
+    template <typename Modifiers>
+    struct make_primitive<tag::oct, Modifiers> 
+      : make_uint<unsigned, Modifiers, 8> {};
+
+    template <typename Modifiers>
+    struct make_primitive<tag::hex, Modifiers> 
+      : make_uint<unsigned, Modifiers, 16> {};
+
+#ifdef BOOST_HAS_LONG_LONG
+    template <typename Modifiers>
+    struct make_primitive<tag::ulong_long, Modifiers> 
+      : make_uint<boost::ulong_long_type, Modifiers> {};
+#endif
 
-        static type
-        call(Elements const& elements)
-        {
-            return type(elements);
-        }
-    };
+    template <typename T, unsigned Radix, typename Modifiers>
+    struct make_primitive<tag::uint_tag<T, Radix>, Modifiers>
+      : make_uint<T, Modifiers, Radix> {};
 
     ///////////////////////////////////////////////////////////////////////////
-    // upper_case int_ generator
-    ///////////////////////////////////////////////////////////////////////////
-    template <typename Domain, typename Elements, typename Modifier,
-      typename T, unsigned Radix, bool ForceSign, typename Tag>
-    struct make_modified_component<
-        Domain, karma::uint_generator<false, T, Radix, ForceSign, Tag>, Elements, Modifier,
-        typename enable_if<
-            is_member_of_modifier<Modifier, spirit::char_class::upper_case_base_tag>
-        >::type
-    >
-    {
-        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 karma::uint_generator<false, T, Radix, ForceSign, key_tag> int_type;
-        typedef component<karma::domain, int_type, fusion::nil> type;
+    template <typename T, typename Modifiers, unsigned Radix = 10>
+    struct make_uint_direct
+    {
+        static bool const lower = 
+            has_modifier<Modifiers, tag::char_code_base<tag::lower> >::value;
+        static bool const upper = 
+            has_modifier<Modifiers, tag::char_code_base<tag::upper> >::value;
+
+        static bool const no_attr =
+            !has_modifier<Modifiers, tag::lazy_eval>::value;
+
+        typedef literal_uint_generator<
+            T
+          , typename spirit::detail::get_encoding<
+                Modifiers, unused_type, lower || upper>::type
+          , typename detail::get_casetag<Modifiers, lower || upper>::type
+          , Radix
+          , no_attr
+        > result_type;
 
-        static type
-        call(Elements const&)
+        template <typename Terminal>
+        result_type operator()(Terminal const& term, unused_type) const
         {
-            return type(fusion::nil());
+            return result_type(fusion::at_c<0>(term.args));
         }
     };
 
-    template <typename Domain, typename Elements, typename Modifier,
-      typename T, unsigned Radix, bool ForceSign, typename Tag>
-    struct make_modified_component<
-        Domain, karma::uint_generator<true, T, Radix, ForceSign, Tag>, Elements, Modifier,
-        typename enable_if<
-            is_member_of_modifier<Modifier, spirit::char_class::upper_case_base_tag>
-        >::type
-    >
-    {
-        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 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;
+    template <typename Modifiers, typename A0>
+    struct make_primitive<
+        terminal_ex<tag::ushort_, fusion::vector1<A0> >, Modifiers>
+      : make_uint_direct<unsigned short, Modifiers> {};
+
+    template <typename Modifiers, typename A0>
+    struct make_primitive<
+        terminal_ex<tag::uint_, fusion::vector1<A0> >, Modifiers>
+      : make_uint_direct<unsigned int, Modifiers> {};
+
+    template <typename Modifiers, typename A0>
+    struct make_primitive<
+        terminal_ex<tag::ulong_, fusion::vector1<A0> >, Modifiers>
+      : make_uint_direct<unsigned long, Modifiers> {};
+
+    template <typename Modifiers, typename A0>
+    struct make_primitive<
+        terminal_ex<tag::bin, fusion::vector1<A0> >, Modifiers>
+      : make_uint_direct<unsigned, Modifiers, 2> {};
+
+    template <typename Modifiers, typename A0>
+    struct make_primitive<
+        terminal_ex<tag::oct, fusion::vector1<A0> >, Modifiers>
+      : make_uint_direct<unsigned, Modifiers, 8> {};
+
+    template <typename Modifiers, typename A0>
+    struct make_primitive<
+        terminal_ex<tag::hex, fusion::vector1<A0> >, Modifiers>
+      : make_uint_direct<unsigned, Modifiers, 16> {};
+
+#ifdef BOOST_HAS_LONG_LONG
+    template <typename Modifiers, typename A0>
+    struct make_primitive<
+        terminal_ex<tag::ulong_long, fusion::vector1<A0> >, Modifiers>
+      : make_uint_direct<boost::ulong_long_type, Modifiers> {};
+#endif
 
-        static type
-        call(Elements const& elements)
-        {
-            return type(elements);
-        }
-    };
+    template <typename T, unsigned Radix, typename A0, typename Modifiers>
+    struct make_primitive<
+        terminal_ex<tag::uint_tag<T, Radix>, fusion::vector1<A0> >
+          , Modifiers>
+      : make_uint_direct<T, Modifiers, Radix> {};
 
-}}}   // namespace boost::spirit::traits
+}}}
 
 #endif
Modified: trunk/boost/spirit/home/karma/operator.hpp
==============================================================================
--- trunk/boost/spirit/home/karma/operator.hpp	(original)
+++ trunk/boost/spirit/home/karma/operator.hpp	2009-04-26 10:42:24 EDT (Sun, 26 Apr 2009)
@@ -11,11 +11,12 @@
 #endif
 
 #include <boost/spirit/home/karma/operator/sequence.hpp>
+#include <boost/spirit/home/karma/operator/and_predicate.hpp>
+#include <boost/spirit/home/karma/operator/not_predicate.hpp>
 #include <boost/spirit/home/karma/operator/alternative.hpp>
 #include <boost/spirit/home/karma/operator/kleene.hpp>
 #include <boost/spirit/home/karma/operator/plus.hpp>
 #include <boost/spirit/home/karma/operator/optional.hpp>
 #include <boost/spirit/home/karma/operator/list.hpp>
-#include <boost/spirit/home/karma/operator/meta_grammar.hpp>
 
 #endif
Modified: trunk/boost/spirit/home/karma/operator/alternative.hpp
==============================================================================
--- trunk/boost/spirit/home/karma/operator/alternative.hpp	(original)
+++ trunk/boost/spirit/home/karma/operator/alternative.hpp	2009-04-26 10:42:24 EDT (Sun, 26 Apr 2009)
@@ -1,5 +1,5 @@
 //  Copyright (c) 2001-2009 Hartmut Kaiser
-//  Copyright (c) 2001-2007 Joel de Guzman
+//  Copyright (c) 2001-2009 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)
@@ -11,70 +11,92 @@
 #pragma once      // MS compatible compilers support #pragma once
 #endif
 
-#include <boost/spirit/home/karma/operator/detail/alternative.hpp>
-#include <boost/spirit/home/support/attribute_transform.hpp>
-#include <boost/spirit/home/support/as_variant.hpp>
-#include <boost/spirit/home/support/detail/what_function.hpp>
-#include <boost/spirit/home/support/algorithm/any.hpp>
+#include <boost/spirit/home/karma/detail/alternative_function.hpp>
+#include <boost/spirit/home/karma/domain.hpp>
+#include <boost/spirit/home/karma/generator.hpp>
+#include <boost/spirit/home/karma/meta_compiler.hpp>
+#include <boost/spirit/home/support/info.hpp>
 #include <boost/spirit/home/support/unused.hpp>
-#include <boost/fusion/include/for_each.hpp>
+#include <boost/spirit/home/support/detail/what_function.hpp>
+#include <boost/fusion/include/any.hpp>
 #include <boost/fusion/include/mpl.hpp>
-#include <boost/fusion/include/transform.hpp>
-#include <boost/variant.hpp>
-#include <boost/mpl/vector.hpp>
-#include <boost/mpl/end.hpp>
-#include <boost/mpl/insert_range.hpp>
-#include <boost/mpl/transform_view.hpp>
+#include <boost/fusion/include/for_each.hpp>
+
+namespace boost { namespace spirit
+{
+    ///////////////////////////////////////////////////////////////////////////
+    // Enablers
+    ///////////////////////////////////////////////////////////////////////////
+    template <>
+    struct use_operator<karma::domain, proto::tag::bitwise_or>  // enables |
+      : mpl::true_ {};
+
+    template <>
+    struct flatten_tree<karma::domain, proto::tag::bitwise_or>  // flattens |
+      : mpl::true_ {};
+
+}}
 
+///////////////////////////////////////////////////////////////////////////////
 namespace boost { namespace spirit { namespace karma
 {
-    struct alternative
+    template <typename Elements>
+    struct alternative : nary_generator<alternative<Elements> >
     {
-        template <typename T>
-        struct transform_child : mpl::identity<T> {};
-
-        template <typename All, typename Filtered>
-        struct build_container
+        template <typename Context, typename Unused = unused_type>
+        struct attribute
         {
-            // Ok, now make a variant over the attribute_sequence. It's
-            // a pity that make_variant_over does not support forward MPL
-            // sequences. We use our own conversion metaprogram (as_variant).
-            typedef typename
-                as_variant<Filtered>::type
-            type;
+            // Put all the element attributes in a tuple
+            typedef typename traits::build_attribute_sequence<
+                Elements, Context, mpl::identity
+            >::type all_attributes;
+
+            // Ok, now make a variant over the attribute sequence. Note that
+            // build_variant makes sure that 1) all attributes in the variant
+            // are unique 2) puts the unused attribute, if there is any, to
+            // the front and 3) collapses single element variants, variant<T>
+            // to T.
+            typedef typename traits::build_variant<all_attributes>::type type;
         };
 
-        template <typename Component, typename Context, typename Iterator>
-        struct attribute :
-            build_fusion_sequence<alternative, Component, Iterator, Context>
-        {
-        };
+        alternative(Elements const& elements)
+          : elements(elements) {}
 
-        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)
+        template <
+            typename OutputIterator, typename Context, typename Delimiter
+          , typename Attribute>
+        bool generate(OutputIterator& sink, Context& ctx
+          , Delimiter const& d, Attribute const& attr) const
         {
             typedef detail::alternative_generate_functor<
-                OutputIterator, Context, Delimiter, Parameter
+                OutputIterator, Context, Delimiter, Attribute
             > functor;
 
             // f return true if *any* of the parser succeeds
-            functor f (sink, ctx, d, param);
-            return fusion::any(component.elements, f);
+            functor f (sink, ctx, d, attr);
+            return fusion::any(elements, f);
         }
 
-        template <typename Component, typename Context>
-        static std::string what(Component const& component, Context const& ctx)
+        template <typename Context>
+        info what(Context& context) const
         {
-            std::string result = "alternatives[";
-            fusion::for_each(component.elements,
-                spirit::detail::what_function<Context>(result, ctx));
-            result += "]";
+            info result("alternative");
+            fusion::for_each(elements,
+                spirit::detail::what_function<Context>(result, context));
             return result;
         }
+
+        Elements elements;
     };
+
+    ///////////////////////////////////////////////////////////////////////////
+    // Generator generators: make_xxx function (objects)
+    ///////////////////////////////////////////////////////////////////////////
+    template <typename Elements, typename Modifiers>
+    struct make_composite<proto::tag::bitwise_or, Elements, Modifiers>
+      : make_nary_composite<Elements, alternative>
+    {};
+
 }}}
 
 #endif
Added: trunk/boost/spirit/home/karma/operator/and_predicate.hpp
==============================================================================
--- (empty file)
+++ trunk/boost/spirit/home/karma/operator/and_predicate.hpp	2009-04-26 10:42:24 EDT (Sun, 26 Apr 2009)
@@ -0,0 +1,78 @@
+//  Copyright (c) 2001-2009 Hartmut Kaiser
+//  Copyright (c) 2001-2009 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(SPIRIT_KARMA_AND_PREDICATE_MAR_22_2009_0412PM)
+#define SPIRIT_KARMA_AND_PREDICATE_MAR_22_2009_0412PM
+
+#if defined(_MSC_VER)
+#pragma once
+#endif
+
+#include <boost/spirit/home/karma/domain.hpp>
+#include <boost/spirit/home/karma/meta_compiler.hpp>
+#include <boost/spirit/home/karma/generator.hpp>
+#include <boost/spirit/home/karma/detail/output_iterator.hpp>
+#include <boost/spirit/home/support/attributes.hpp>
+#include <boost/spirit/home/support/info.hpp>
+
+namespace boost { namespace spirit
+{
+    ///////////////////////////////////////////////////////////////////////////
+    // Enablers
+    ///////////////////////////////////////////////////////////////////////////
+    template <>
+    struct use_operator<karma::domain, proto::tag::address_of> // enables &g
+      : mpl::true_ {};
+
+}}
+
+namespace boost { namespace spirit { namespace karma
+{
+    template <typename Subject>
+    struct and_predicate : unary_generator<and_predicate<Subject> >
+    {
+        typedef Subject subject_type;
+
+        template <typename Context, typename Iterator>
+        struct attribute
+        {
+            typedef unused_type type;
+        };
+
+        and_predicate(Subject const& subject)
+          : subject(subject) {}
+
+        template <
+            typename OutputIterator, typename Context, typename Delimiter
+          , typename Attribute>
+        bool generate(OutputIterator& sink, Context& ctx, Delimiter const& d
+          , Attribute const& attr) const
+        {
+            // inhibits (redirects) output, disable counting
+            detail::enable_buffering<OutputIterator> buffering(sink);
+            detail::disable_counting<OutputIterator> nocounting(sink);
+            return subject.generate(sink, ctx, d, attr);
+        }
+
+        template <typename Context>
+        info what(Context& context) const
+        {
+            return info("and-predicate", subject.what(context));
+        }
+
+        Subject subject;
+    };
+
+    ///////////////////////////////////////////////////////////////////////////
+    // Generator generators: make_xxx function (objects)
+    ///////////////////////////////////////////////////////////////////////////
+    template <typename Elements, typename Modifiers>
+    struct make_composite<proto::tag::address_of, Elements, Modifiers>
+      : make_unary_composite<Elements, and_predicate> {};
+
+}}}
+
+#endif
Deleted: trunk/boost/spirit/home/karma/operator/karma-alt.zip
==============================================================================
Binary file. No diff available.
Modified: trunk/boost/spirit/home/karma/operator/kleene.hpp
==============================================================================
--- trunk/boost/spirit/home/karma/operator/kleene.hpp	(original)
+++ trunk/boost/spirit/home/karma/operator/kleene.hpp	2009-04-26 10:42:24 EDT (Sun, 26 Apr 2009)
@@ -11,82 +11,89 @@
 #pragma once      // MS compatible compilers support #pragma once
 #endif
 
-#include <boost/spirit/home/support/component.hpp>
-#include <boost/spirit/home/support/detail/container.hpp>
+#include <boost/spirit/home/karma/domain.hpp>
+#include <boost/spirit/home/karma/generator.hpp>
+#include <boost/spirit/home/karma/meta_compiler.hpp>
+#include <boost/spirit/home/support/info.hpp>
 #include <boost/spirit/home/support/unused.hpp>
-#include <boost/spirit/home/support/attribute_transform.hpp>
+#include <boost/spirit/home/support/container.hpp>
 
-#include <vector>
+#include <boost/type_traits/add_const.hpp>
 
+namespace boost { namespace spirit
+{
+    ///////////////////////////////////////////////////////////////////////////
+    // Enablers
+    ///////////////////////////////////////////////////////////////////////////
+    template <>
+    struct use_operator<karma::domain, proto::tag::dereference> // enables *g
+      : mpl::true_ {};
+
+}}
+
+///////////////////////////////////////////////////////////////////////////////
 namespace boost { namespace spirit { namespace karma
 {
-    struct kleene
+    template <typename Subject>
+    struct kleene : unary_generator<kleene<Subject> >
     {
-        template <typename T>
-        struct build_attribute_container
-        {
-            typedef std::vector<T> type;
-        };
+        typedef Subject subject_type;
 
-        template <typename Component, typename Context, typename Iterator>
-        struct attribute :
-            build_container<kleene, Component, Iterator, Context>
+        template <typename Context, typename Unused>
+        struct attribute
         {
+            // Build a std::vector from the subject's attribute. Note
+            // that build_std_vector may return unused_type if the
+            // subject's attribute is an unused_type.
+            typedef typename
+                traits::build_std_vector<
+                    typename traits::attribute_of<Subject, Context>::type
+                >::type
+            type;
         };
 
-        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)
+        kleene(Subject const& subject)
+          : subject(subject) {}
+
+        template <
+            typename OutputIterator, typename Context, typename Delimiter
+          , typename Attribute>
+        bool generate(OutputIterator& sink, Context& ctx
+          , Delimiter const& d, Attribute const& attr) const
         {
-            typedef typename
-                result_of::subject<Component>::type::director
-            director;
-            typedef typename
-                container::result_of::iterator<Parameter const>::type
-            iterator_type;
+            typedef typename traits::result_of::iterator<
+                typename add_const<Attribute>::type
+            >::type iterator_type;
 
-            iterator_type it = container::begin(param);
-            iterator_type end = container::end(param);
+            iterator_type it = traits::begin(attr);
+            iterator_type end = traits::end(attr);
 
             // kleene fails only if the embedded parser fails
             bool result = true;
-            for (/**/; result && !container::compare(it, end);
-                 container::next(it))
+            for (/**/; result && !traits::compare(it, end); traits::next(it))
             {
-                result = director::generate(subject(component), sink, ctx, d,
-                    container::deref(it));
+                result = subject.generate(sink, ctx, d, traits::deref(it));
             }
             return result;
         }
 
-        // this kleene has no parameter attached
-//         template <typename Component, typename OutputIterator,
-//             typename Context, typename Delimiter>
-//         static bool
-//         generate(Component const&, OutputIterator&, Context&, Delimiter const&,
-//             unused_type)
-//         {
-//             BOOST_MPL_ASSERT_MSG(false, kleene_not_usable_without_attribute, ());
-//             return false;
-//         }
-
-        template <typename Component, typename Context>
-        static std::string what(Component const& component, Context const& ctx)
+        template <typename Context>
+        info what(Context& context) const
         {
-            std::string result = "kleene[";
-
-            typedef typename
-                spirit::result_of::subject<Component>::type::director
-            director;
-
-            result += director::what(spirit::subject(component), ctx);
-            result += "]";
-            return result;
+            return info("kleene", subject.what(context));
         }
+
+        Subject subject;
     };
 
+    ///////////////////////////////////////////////////////////////////////////
+    // Generator generators: make_xxx function (objects)
+    ///////////////////////////////////////////////////////////////////////////
+    template <typename Elements, typename Modifiers>
+    struct make_composite<proto::tag::dereference, Elements, Modifiers>
+      : make_unary_composite<Elements, kleene>
+    {};
+
 }}}
 
 #endif
Modified: trunk/boost/spirit/home/karma/operator/list.hpp
==============================================================================
--- trunk/boost/spirit/home/karma/operator/list.hpp	(original)
+++ trunk/boost/spirit/home/karma/operator/list.hpp	2009-04-26 10:42:24 EDT (Sun, 26 Apr 2009)
@@ -7,90 +7,96 @@
 #if !defined(SPIRIT_KARMA_LIST_MAY_01_2007_0229PM)
 #define SPIRIT_KARMA_LIST_MAY_01_2007_0229PM
 
-#include <boost/spirit/home/support/component.hpp>
-#include <boost/spirit/home/support/detail/container.hpp>
+#include <boost/spirit/home/karma/domain.hpp>
+#include <boost/spirit/home/karma/generator.hpp>
+#include <boost/spirit/home/karma/meta_compiler.hpp>
+#include <boost/spirit/home/support/info.hpp>
 #include <boost/spirit/home/support/unused.hpp>
-#include <boost/spirit/home/support/attribute_transform.hpp>
+#include <boost/spirit/home/support/container.hpp>
 
-#include <vector>
+namespace boost { namespace spirit
+{
+    ///////////////////////////////////////////////////////////////////////////
+    // Enablers
+    ///////////////////////////////////////////////////////////////////////////
+    template <>
+    struct use_operator<karma::domain, proto::tag::modulus> // enables g % d
+      : mpl::true_ {};
+
+}}
 
 ///////////////////////////////////////////////////////////////////////////////
 namespace boost { namespace spirit { namespace karma
 {
-    struct list
+    template <typename Left, typename Right>
+    struct list : binary_generator<list<Left, Right> >
     {
-        template <typename T>
-        struct build_attribute_container
-        {
-            typedef std::vector<T> type;
-        };
+        typedef Left left_type;
+        typedef Right right_type;
 
-        template <typename Component, typename Context, typename Iterator>
-        struct attribute :
-            build_container<list, Component, Iterator, Context>
-        {
-        };
-
-        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)
+        template <typename Context, typename Iterator>
+        struct attribute
         {
+            // Build a std::vector from the LHS's attribute. Note
+            // that build_std_vector may return unused_type if the
+            // subject's attribute is an unused_type.
             typedef typename
-                spirit::result_of::left<Component>::type::director
-            ldirector;
+                traits::build_std_vector<
+                    typename traits::
+                        attribute_of<Left, Context, Iterator>::type
+                >::type
+            type;
+        };
 
-            typedef typename
-                spirit::result_of::right<Component>::type::director
-            rdirector;
+        list(Left const& left, Right const& right)
+          : left(left), right(right) {}
 
-            typedef typename
-                container::result_of::iterator<Parameter const>::type
-            iterator_type;
+        template <
+            typename OutputIterator, typename Context, typename Delimiter
+          , typename Attribute>
+        bool generate(OutputIterator& sink, Context& ctx
+          , Delimiter const& d, Attribute const& attr) const
+        {
+            typedef typename traits::result_of::iterator<
+                typename add_const<Attribute>::type
+            >::type iterator_type;
 
-            iterator_type it = container::begin(param);
-            iterator_type end = container::end(param);
+            iterator_type it = traits::begin(attr);
+            iterator_type end = traits::end(attr);
 
-            bool result = !container::compare(it, end);
-            if (result && ldirector::generate(
-                  spirit::left(component), sink, ctx, d, container::deref(it)))
+            bool result = !traits::compare(it, end);
+            if (result && left.generate(sink, ctx, d, traits::deref(it)))
             {
-                for (container::next(it); result && !container::compare(it, end);
-                     container::next(it))
+                for (traits::next(it); result && !traits::compare(it, end);
+                     traits::next(it))
                 {
-                    result =
-                        rdirector::generate(
-                            spirit::right(component), sink, ctx, d, unused) &&
-                        ldirector::generate(
-                            spirit::left(component), sink, ctx, d, container::deref(it));
+                    result = right.generate(sink, ctx, d, unused) &&
+                             left.generate(sink, ctx, d, traits::deref(it));
                 }
                 return result;
             }
             return false;
         }
 
-        template <typename Component, typename Context>
-        static std::string what(Component const& component, Context const& ctx)
+        template <typename Context>
+        info what(Context& context) const
         {
-            std::string result = "list[";
-
-            typedef typename
-                spirit::result_of::left<Component>::type::director
-            ldirector;
-
-            typedef typename
-                spirit::result_of::right<Component>::type::director
-            rdirector;
-
-            result += ldirector::what(spirit::left(component), ctx);
-            result += ", ";
-            result += rdirector::what(spirit::right(component), ctx);
-            result += "]";
-            return result;
+            return info("list",
+                std::make_pair(left.what(context), right.what(context)));
         }
+
+        Left left;
+        Right right;
     };
 
+    ///////////////////////////////////////////////////////////////////////////
+    // Generator generators: make_xxx function (objects)
+    ///////////////////////////////////////////////////////////////////////////
+    template <typename Elements, typename Modifiers>
+    struct make_composite<proto::tag::modulus, Elements, Modifiers>
+      : make_binary_composite<Elements, list>
+    {};
+
 }}}
 
 #endif
Deleted: trunk/boost/spirit/home/karma/operator/meta_grammar.hpp
==============================================================================
--- trunk/boost/spirit/home/karma/operator/meta_grammar.hpp	2009-04-26 10:42:24 EDT (Sun, 26 Apr 2009)
+++ (empty file)
@@ -1,113 +0,0 @@
-//  Copyright (c) 2001-2009 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_META_GRAMMAR_FEB_28_2007_0346PM)
-#define BOOST_SPIRIT_KARMA_META_GRAMMAR_FEB_28_2007_0346PM
-
-#if defined(_MSC_VER) && (_MSC_VER >= 1020)
-#pragma once      // MS compatible compilers support #pragma once
-#endif
-
-#include <boost/spirit/home/karma/domain.hpp>
-#include <boost/spirit/home/support/meta_grammar.hpp>
-#include <boost/utility/enable_if.hpp>
-
-namespace boost { namespace spirit { namespace karma
-{
-    ///////////////////////////////////////////////////////////////////////////
-    // forwards
-    ///////////////////////////////////////////////////////////////////////////
-    struct sequence;
-    struct alternative;
-    struct kleene;
-    struct plus;
-    struct optional;
-    struct list;
-    
-    struct main_meta_grammar;
-
-    template <typename Expr, typename Enable>
-    struct is_valid_expr;
-
-    template <typename Expr, typename Enable>
-    struct expr_transform;
-
-    ///////////////////////////////////////////////////////////////////////////
-    // operator meta-grammars
-    ///////////////////////////////////////////////////////////////////////////
-    struct sequence_meta_grammar
-      : proto::or_<
-            meta_grammar::binary_rule_flat<
-                karma::domain, proto::tag::shift_left, sequence,
-                main_meta_grammar
-            >,
-            meta_grammar::binary_rule_flat<
-                karma::domain, proto::tag::plus, sequence,
-                main_meta_grammar
-            >
-        >
-    {
-    };
-
-    struct alternative_meta_grammar
-      : meta_grammar::binary_rule_flat<
-            karma::domain, proto::tag::bitwise_or, alternative,
-            main_meta_grammar
-        >
-    {
-    };
-
-    struct repeat_meta_grammar
-      : proto::or_<
-            meta_grammar::unary_rule<
-                karma::domain, proto::tag::dereference, kleene,
-                main_meta_grammar
-            >,
-            meta_grammar::unary_rule<
-                karma::domain, proto::tag::negate, optional,
-                main_meta_grammar
-            >,
-            meta_grammar::unary_rule<
-                karma::domain, proto::tag::unary_plus, plus,
-                main_meta_grammar
-            >,
-            meta_grammar::binary_rule<
-                karma::domain, proto::tag::modulus, list,
-                main_meta_grammar, main_meta_grammar
-            >
-        >
-    {
-    };
-
-    struct operator_meta_grammar
-      : proto::or_<
-            sequence_meta_grammar,
-            alternative_meta_grammar,
-            repeat_meta_grammar
-        >
-    {
-    };
-
-    ///////////////////////////////////////////////////////////////////////////
-    //  These specializations non-intrusively hooks into the Karma meta-grammar.
-    //  (see karma/meta_grammar.hpp)
-    ///////////////////////////////////////////////////////////////////////////
-    template <typename Expr>
-    struct is_valid_expr<Expr
-      , typename enable_if<proto::matches<Expr, operator_meta_grammar> >::type>
-      : mpl::true_
-    {
-    };
-
-    template <typename Expr>
-    struct expr_transform<Expr
-      , typename enable_if<proto::matches<Expr, operator_meta_grammar> >::type>
-      : mpl::identity<operator_meta_grammar>
-    {
-    };
-    
-}}}
-
-#endif
Added: trunk/boost/spirit/home/karma/operator/not_predicate.hpp
==============================================================================
--- (empty file)
+++ trunk/boost/spirit/home/karma/operator/not_predicate.hpp	2009-04-26 10:42:24 EDT (Sun, 26 Apr 2009)
@@ -0,0 +1,78 @@
+//  Copyright (c) 2001-2009 Hartmut Kaiser
+//  Copyright (c) 2001-2009 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(SPIRIT_KARMA_NOT_PREDICATE_MAR_21_2009_1132AM)
+#define SPIRIT_KARMA_NOT_PREDICATE_MAR_21_2009_1132AM
+
+#if defined(_MSC_VER)
+#pragma once
+#endif
+
+#include <boost/spirit/home/karma/domain.hpp>
+#include <boost/spirit/home/karma/meta_compiler.hpp>
+#include <boost/spirit/home/karma/generator.hpp>
+#include <boost/spirit/home/karma/detail/output_iterator.hpp>
+#include <boost/spirit/home/support/attributes.hpp>
+#include <boost/spirit/home/support/info.hpp>
+
+namespace boost { namespace spirit
+{
+    ///////////////////////////////////////////////////////////////////////////
+    // Enablers
+    ///////////////////////////////////////////////////////////////////////////
+    template <>
+    struct use_operator<karma::domain, proto::tag::logical_not> // enables !g
+      : mpl::true_ {};
+
+}}
+
+namespace boost { namespace spirit { namespace karma
+{
+    template <typename Subject>
+    struct not_predicate : unary_generator<not_predicate<Subject> >
+    {
+        typedef Subject subject_type;
+
+        template <typename Context, typename Iterator>
+        struct attribute
+        {
+            typedef unused_type type;
+        };
+
+        not_predicate(Subject const& subject)
+          : subject(subject) {}
+
+        template <
+            typename OutputIterator, typename Context, typename Delimiter
+          , typename Attribute>
+        bool generate(OutputIterator& sink, Context& ctx, Delimiter const& d
+          , Attribute const& attr) const
+        {
+            // inhibits (redirects) output, disable counting
+            detail::enable_buffering<OutputIterator> buffering(sink);
+            detail::disable_counting<OutputIterator> nocounting(sink);
+            return !subject.generate(sink, ctx, d, attr);
+        }
+
+        template <typename Context>
+        info what(Context& context) const
+        {
+            return info("not-predicate", subject.what(context));
+        }
+
+        Subject subject;
+    };
+
+    ///////////////////////////////////////////////////////////////////////////
+    // Generator generators: make_xxx function (objects)
+    ///////////////////////////////////////////////////////////////////////////
+    template <typename Elements, typename Modifiers>
+    struct make_composite<proto::tag::logical_not, Elements, Modifiers>
+      : make_unary_composite<Elements, not_predicate> {};
+
+}}}
+
+#endif
Modified: trunk/boost/spirit/home/karma/operator/optional.hpp
==============================================================================
--- trunk/boost/spirit/home/karma/operator/optional.hpp	(original)
+++ trunk/boost/spirit/home/karma/operator/optional.hpp	2009-04-26 10:42:24 EDT (Sun, 26 Apr 2009)
@@ -11,26 +11,39 @@
 #pragma once      // MS compatible compilers support #pragma once
 #endif
 
-#include <boost/spirit/home/support/component.hpp>
-#include <boost/spirit/home/support/attribute_of.hpp>
-#include <boost/spirit/home/support/attribute_transform.hpp>
+#include <boost/spirit/home/karma/domain.hpp>
+#include <boost/spirit/home/karma/generator.hpp>
+#include <boost/spirit/home/karma/meta_compiler.hpp>
+#include <boost/spirit/home/support/info.hpp>
 #include <boost/mpl/assert.hpp>
 #include <boost/optional.hpp>
 
+namespace boost { namespace spirit
+{
+    ///////////////////////////////////////////////////////////////////////////
+    // Enablers
+    ///////////////////////////////////////////////////////////////////////////
+    template <>
+    struct use_operator<karma::domain, proto::tag::negate> // enables -g
+      : mpl::true_ {};
+
+}}
+
+///////////////////////////////////////////////////////////////////////////////
 namespace boost { namespace spirit { namespace karma
 {
     namespace detail
     {
-        template <typename Parameter>
+        template <typename Attribute>
         inline bool
-        optional_is_valid(boost::optional<Parameter> const& opt)
+        optional_is_valid(boost::optional<Attribute> const& opt)
         {
             return opt;
         }
 
-        template <typename Parameter>
+        template <typename Attribute>
         inline bool
-        optional_is_valid(Parameter const& opt)
+        optional_is_valid(Attribute const& opt)
         {
             return true;
         }
@@ -41,16 +54,16 @@
             return true;
         }
 
-        template <typename Parameter>
-        inline Parameter const&
-        optional_get(boost::optional<Parameter> const& opt)
+        template <typename Attribute>
+        inline Attribute const&
+        optional_get(boost::optional<Attribute> const& opt)
         {
             return get(opt);
         }
 
-        template <typename Parameter>
-        inline Parameter const&
-        optional_get(Parameter const& opt)
+        template <typename Attribute>
+        inline Attribute const&
+        optional_get(Attribute const& opt)
         {
             return opt;
         }
@@ -62,53 +75,55 @@
         }
     }
 
-    struct optional
+    ///////////////////////////////////////////////////////////////////////////
+    template <typename Subject>
+    struct optional : unary_generator<optional<Subject> >
     {
-        template <typename T>
-        struct build_attribute_container
-        {
-            typedef boost::optional<T> type;
-        };
+        typedef Subject subject_type;
 
-        template <typename Component, typename Context, typename Iterator>
-        struct attribute :
-            build_container<optional, Component, Iterator, Context>
+        template <typename Context, typename Unused>
+        struct attribute
         {
+            // Build a boost::optional from the subject's attribute. Note
+            // that boost::optional may return unused_type if the
+            // subject's attribute is an unused_type.
+            typedef typename
+                traits::build_optional<
+                    typename traits::attribute_of<Subject, Context>::type
+                >::type
+            type;
         };
 
-        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)
-        {
-            typedef typename
-                result_of::subject<Component>::type::director
-            director;
+        optional(Subject const& subject)
+          : subject(subject) {}
 
-            if (detail::optional_is_valid(param))
-            {
-                director::generate(subject(component), sink, ctx, d,
-                    detail::optional_get(param));
-            }
+        template <
+            typename OutputIterator, typename Context, typename Delimiter
+          , typename Attribute>
+        bool generate(OutputIterator& sink, Context& ctx
+          , Delimiter const& d, Attribute const& attr) const
+        {
+            if (detail::optional_is_valid(attr))
+                subject.generate(sink, ctx, d, detail::optional_get(attr));
             return true;
         }
 
-        template <typename Component, typename Context>
-        static std::string what(Component const& component, Context const& ctx)
+        template <typename Context>
+        info what(Context& context) const
         {
-            std::string result = "optional[";
-
-            typedef typename
-                spirit::result_of::subject<Component>::type::director
-            director;
-
-            result += director::what(spirit::subject(component), ctx);
-            result += "]";
-            return result;
+            return info("optional", subject.what(context));
         }
+
+        Subject subject;
     };
 
+    ///////////////////////////////////////////////////////////////////////////
+    // Generator generators: make_xxx function (objects)
+    ///////////////////////////////////////////////////////////////////////////
+    template <typename Elements, typename Modifiers>
+    struct make_composite<proto::tag::negate, Elements, Modifiers>
+      : make_unary_composite<Elements, optional> {};
+
 }}}
 
 #endif
Modified: trunk/boost/spirit/home/karma/operator/plus.hpp
==============================================================================
--- trunk/boost/spirit/home/karma/operator/plus.hpp	(original)
+++ trunk/boost/spirit/home/karma/operator/plus.hpp	2009-04-26 10:42:24 EDT (Sun, 26 Apr 2009)
@@ -11,85 +11,93 @@
 #pragma once      // MS compatible compilers support #pragma once
 #endif
 
-#include <boost/spirit/home/support/component.hpp>
-#include <boost/spirit/home/support/detail/container.hpp>
+#include <boost/spirit/home/karma/domain.hpp>
+#include <boost/spirit/home/karma/generator.hpp>
+#include <boost/spirit/home/karma/meta_compiler.hpp>
+#include <boost/spirit/home/support/info.hpp>
 #include <boost/spirit/home/support/unused.hpp>
-#include <boost/spirit/home/support/attribute_transform.hpp>
-#include <boost/mpl/assert.hpp>
-#include <vector>
+#include <boost/spirit/home/support/container.hpp>
 
+#include <boost/type_traits/add_const.hpp>
+
+namespace boost { namespace spirit
+{
+    ///////////////////////////////////////////////////////////////////////////
+    // Enablers
+    ///////////////////////////////////////////////////////////////////////////
+    template <>
+    struct use_operator<karma::domain, proto::tag::unary_plus> // enables +g
+      : mpl::true_ {};
+
+}}
+
+///////////////////////////////////////////////////////////////////////////////
 namespace boost { namespace spirit { namespace karma
 {
-    struct plus
+    template <typename Subject>
+    struct plus : unary_generator<plus<Subject> >
     {
-        template <typename T>
-        struct build_attribute_container
-        {
-            typedef std::vector<T> type;
-        };
+        typedef Subject subject_type;
 
-        template <typename Component, typename Context, typename Iterator>
-        struct attribute :
-            build_container<plus, Component, Iterator, Context>
+        template <typename Context, typename Unused>
+        struct attribute
         {
+            // Build a std::vector from the subject's attribute. Note
+            // that build_std_vector may return unused_type if the
+            // subject's attribute is an unused_type.
+            typedef typename
+                traits::build_std_vector<
+                    typename traits::attribute_of<Subject, Context>::type
+                >::type
+            type;
         };
 
-        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)
+        plus(Subject const& subject)
+          : subject(subject) {}
+
+        template <
+            typename OutputIterator, typename Context, typename Delimiter
+          , typename Attribute>
+        bool generate(OutputIterator& sink, Context& ctx
+          , Delimiter const& d, Attribute const& attr) const
         {
-            typedef typename
-                spirit::result_of::subject<Component>::type::director
-            director;
-            typedef typename
-                container::result_of::iterator<Parameter const>::type
-            iterator_type;
+            typedef typename traits::result_of::iterator<
+                typename add_const<Attribute>::type
+            >::type iterator_type;
 
-            iterator_type it = container::begin(param);
-            iterator_type end = container::end(param);
+            iterator_type it = traits::begin(attr);
+            iterator_type end = traits::end(attr);
 
             // plus fails if the parameter is empty
-            if (it == end)
+            if (traits::compare(it, end))
                 return false;
 
             bool result = true;
-            for (/**/; result && !container::compare(it, end);
-                 container::next(it))
+            for (/**/; result && !traits::compare(it, end); traits::next(it))
             {
-                result = director::generate(spirit::subject(component), sink,
-                    ctx, d, container::deref(it));
+                result = subject.generate(sink, ctx, d, traits::deref(it));
             }
             return result;
         }
 
-        // this kleene has no parameter attached
-//         template <typename Component, typename OutputIterator,
-//             typename Context, typename Delimiter>
-//         static bool
-//         generate(Component const&, OutputIterator&, Context&, Delimiter const&,
-//             unused_type)
-//         {
-//             BOOST_MPL_ASSERT_MSG(false, plus_not_usable_without_attribute, ());
-//             return false;
-//         }
-
-        template <typename Component, typename Context>
-        static std::string what(Component const& component, Context const& ctx)
+        template <typename Context>
+        info what(Context& context) const
         {
-            std::string result = "plus[";
-
-            typedef typename
-                spirit::result_of::subject<Component>::type::director
-            director;
-
-            result += director::what(spirit::subject(component), ctx);
-            result += "]";
-            return result;
+            return info("plus", subject.what(context));
         }
+
+        Subject subject;
     };
 
+
+    ///////////////////////////////////////////////////////////////////////////
+    // Generator generators: make_xxx function (objects)
+    ///////////////////////////////////////////////////////////////////////////
+    template <typename Elements, typename Modifiers>
+    struct make_composite<proto::tag::unary_plus, Elements, Modifiers>
+      : make_unary_composite<Elements, plus>
+    {};
+
 }}}
 
 #endif
Modified: trunk/boost/spirit/home/karma/operator/sequence.hpp
==============================================================================
--- trunk/boost/spirit/home/karma/operator/sequence.hpp	(original)
+++ trunk/boost/spirit/home/karma/operator/sequence.hpp	2009-04-26 10:42:24 EDT (Sun, 26 Apr 2009)
@@ -1,5 +1,5 @@
 //  Copyright (c) 2001-2009 Hartmut Kaiser
-//  Copyright (c) 2001-2007 Joel de Guzman
+//  Copyright (c) 2001-2009 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)
@@ -12,78 +12,139 @@
 #endif
 
 #include <boost/spirit/home/karma/domain.hpp>
-#include <boost/spirit/home/karma/operator/detail/sequence.hpp>
-#include <boost/spirit/home/support/attribute_transform.hpp>
+#include <boost/spirit/home/karma/generator.hpp>
+#include <boost/spirit/home/karma/meta_compiler.hpp>
+#include <boost/spirit/home/karma/detail/fail_function.hpp>
+#include <boost/spirit/home/karma/detail/pass_container.hpp>
+#include <boost/spirit/home/support/info.hpp>
 #include <boost/spirit/home/support/detail/what_function.hpp>
+#include <boost/spirit/home/support/attributes.hpp>
 #include <boost/spirit/home/support/algorithm/any_if.hpp>
 #include <boost/spirit/home/support/unused.hpp>
+#include <boost/spirit/home/support/sequence_base_id.hpp>
 #include <boost/fusion/include/vector.hpp>
 #include <boost/fusion/include/as_vector.hpp>
-#include <boost/fusion/include/transform.hpp>
-#include <boost/fusion/include/filter_if.hpp>
 #include <boost/fusion/include/for_each.hpp>
 #include <boost/type_traits/is_same.hpp>
 #include <boost/mpl/not.hpp>
 
+namespace boost { namespace spirit
+{
+    ///////////////////////////////////////////////////////////////////////////
+    // Enablers
+    ///////////////////////////////////////////////////////////////////////////
+    template <>
+    struct use_operator<karma::domain, proto::tag::shift_left> // enables <<
+      : mpl::true_ {};
+
+    template <>
+    struct flatten_tree<karma::domain, proto::tag::shift_left> // flattens <<
+      : mpl::true_ {};
+
+}}
+
+///////////////////////////////////////////////////////////////////////////////
 namespace boost { namespace spirit { namespace karma
 {
-    struct sequence
+    template <typename Elements>
+    struct sequence : nary_generator<sequence<Elements> >
     {
-        template <typename T>
-        struct transform_child : mpl::identity<T> {};
+        sequence(Elements const& elements)
+          : elements(elements) {}
 
-        template <typename All, typename Filtered>
-        struct build_container
-        {
-            typedef
-                typename fusion::result_of::as_vector<Filtered>::type
-            type;
-        };
+        typedef Elements elements_type;
+        struct sequence_base_id;
 
-        template <typename Component, typename Context, typename Iterator>
-        struct attribute :
-            build_fusion_sequence<
-                sequence, Component, Iterator, Context, mpl::true_
-            >
+        template <typename Context, typename Unused>
+        struct attribute
         {
+            // Put all the element attributes in a tuple
+            typedef typename traits::build_attribute_sequence<
+                Elements, Context, mpl::identity>::type
+            all_attributes;
+
+            // Now, build a fusion vector over the attributes. Note
+            // that build_fusion_vector 1) removes all unused attributes
+            // and 2) may return unused_type if all elements have
+            // unused_type(s).
+            typedef typename
+                traits::build_fusion_vector<all_attributes>::type
+            type_;
+
+            // Finally, strip single element vectors into its
+            // naked form: vector1<T> --> T
+            typedef typename
+                traits::strip_single_element_vector<type_>::type
+            type;
         };
 
-        template <typename Context>
-        struct attribute_not_unused
+        // standard case. Attribute is a fusion tuple
+        template <
+            typename OutputIterator, typename Context, typename Delimiter
+          , typename Attribute>
+        bool generate_impl(OutputIterator& sink, Context& ctx
+          , Delimiter const& d, Attribute& attr_, mpl::false_) const
         {
-            template <typename Component>
-            struct apply
-              : spirit::traits::is_not_unused<typename
-                  traits::attribute_of<karma::domain, Component, Context>::type>
-            {};
-        };
+            typedef detail::fail_function<
+                OutputIterator, Context, Delimiter> fail_function;
+            typedef traits::attribute_not_unused<Context> predicate;
+
+            // wrap the attribute in a tuple if it is not a tuple
+            typename traits::wrap_if_not_tuple<Attribute>::type attr(attr_);
+
+            // return false if *any* of the generators fail
+            return !spirit::any_if(elements, attr, fail_function(sink, ctx, d)
+              , predicate());
+        }
 
-        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)
+        // Special case when Attribute is an stl container
+        template <
+            typename OutputIterator, typename Context, typename Delimiter
+          , typename Attribute>
+        bool generate_impl(OutputIterator& sink, Context& ctx
+          , Delimiter const& d, Attribute const& attr_, mpl::true_) const
         {
-            detail::sequence_generate<OutputIterator, Context, Delimiter>
-                f (sink, ctx, d);
+            // return false if *any* of the generators fail
+            typedef detail::fail_function<
+                OutputIterator, Context, Delimiter> fail_function;
 
-            typedef attribute_not_unused<Context> predicate;
+            return !fusion::any(elements, detail::make_pass_container(
+                fail_function(sink, ctx, d), attr_));
+        }
 
-            // f returns true if *any* of the generators fail
-            return !spirit::any_if(component.elements, param, f, predicate());
+        // main generate function. Dispatches to generate_impl depending
+        // on the Attribute type.
+        template <
+            typename OutputIterator, typename Context, typename Delimiter
+          , typename Attribute>
+        bool generate(OutputIterator& sink, Context& ctx, Delimiter const& d
+          , Attribute const& attr) const
+        {
+            return generate_impl(sink, ctx, d, attr
+                , traits::is_container<Attribute>());
         }
 
-        template <typename Component, typename Context>
-        static std::string what(Component const& component, Context const& ctx)
+        template <typename Context>
+        info what(Context& context) const
         {
-            std::string result = "sequence[";
-            fusion::for_each(component.elements,
-                spirit::detail::what_function<Context>(result, ctx));
-            result += "]";
+            info result("sequence");
+            fusion::for_each(elements,
+                spirit::detail::what_function<Context>(result, context));
             return result;
         }
+
+        Elements elements;
     };
 
-}}} // namespace boost::spirit::karma
+
+    ///////////////////////////////////////////////////////////////////////////
+    // Generator generators: make_xxx function (objects)
+    ///////////////////////////////////////////////////////////////////////////
+    template <typename Elements, typename Modifiers>
+    struct make_composite<proto::tag::shift_left, Elements, Modifiers>
+      : make_nary_composite<Elements, sequence>
+    {};
+
+}}} 
 
 #endif
Added: trunk/boost/spirit/home/karma/reference.hpp
==============================================================================
--- (empty file)
+++ trunk/boost/spirit/home/karma/reference.hpp	2009-04-26 10:42:24 EDT (Sun, 26 Apr 2009)
@@ -0,0 +1,74 @@
+//  Copyright (c) 2001-2009 Joel de Guzman
+//  Copyright (c) 2001-2009 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_REFERENCE_APR_17_2009_1057PM)
+#define BOOST_SPIRIT_KARMA_REFERENCE_APR_17_2009_1057PM
+
+#if defined(_MSC_VER)
+#pragma once
+#endif
+
+#include <boost/spirit/home/karma/meta_compiler.hpp>
+#include <boost/spirit/home/karma/generator.hpp>
+#include <boost/spirit/home/support/info.hpp>
+#include <boost/ref.hpp>
+
+namespace boost { namespace spirit { namespace karma
+{
+    ///////////////////////////////////////////////////////////////////////////
+    // reference is a generator that references another generator (its Subject)
+    ///////////////////////////////////////////////////////////////////////////
+    template <typename Subject>
+    struct reference : generator<reference<Subject> >
+    {
+        reference(Subject& subject)
+          : ref(subject) {}
+
+        template <typename Context, typename Unused>
+        struct attribute : Subject::template attribute<Context, Unused> {};
+
+        // Default overload, used whenever the attribute is not unused and not
+        // used from an aliased rule.
+        template <typename OutputIterator, typename Context
+          , typename Delimiter, typename Attribute>
+        bool generate(OutputIterator& sink, Context& context
+          , Delimiter const& delim, Attribute const& attr) const
+        {
+            return ref.get().generate(sink, context, delim, attr);
+        }
+
+        // This overload gets called from an aliased rule only, we take the 
+        // attribute from the context provided from the wrapper rule.
+        template <typename OutputIterator, typename Context
+          , typename Delimiter>
+        bool generate(OutputIterator& sink, Context& context
+          , Delimiter const& delim, unused_type) const
+        {
+            return ref.get().generate(sink, context, delim, context.attributes);
+        }
+
+        // This overload is used whenever no attribute is given and it is used
+        // not from an aliased rule.
+        template <typename OutputIterator, typename Delimiter>
+        bool generate(OutputIterator& sink, unused_type
+          , Delimiter const& delim, unused_type) const
+        {
+            return ref.get().generate(sink, unused, delim, unused);
+        }
+
+        template <typename Context>
+        info what(Context& context) const
+        {
+            // the reference is transparent (does not add any info)
+            return ref.get().what(context);
+        }
+
+        boost::reference_wrapper<Subject> ref;
+    };
+
+}}}
+
+#endif
Modified: trunk/boost/spirit/home/karma/stream.hpp
==============================================================================
--- trunk/boost/spirit/home/karma/stream.hpp	(original)
+++ trunk/boost/spirit/home/karma/stream.hpp	2009-04-26 10:42:24 EDT (Sun, 26 Apr 2009)
@@ -11,7 +11,7 @@
 #endif
 
 #include <boost/spirit/home/karma/stream/format_manip.hpp>
+#include <boost/spirit/home/karma/stream/format_manip_attr.hpp>
 #include <boost/spirit/home/karma/stream/stream.hpp>
-#include <boost/spirit/home/karma/stream/meta_grammar.hpp>
 
 #endif
Modified: trunk/boost/spirit/home/karma/stream/detail/format_manip.hpp
==============================================================================
--- trunk/boost/spirit/home/karma/stream/detail/format_manip.hpp	(original)
+++ trunk/boost/spirit/home/karma/stream/detail/format_manip.hpp	2009-04-26 10:42:24 EDT (Sun, 26 Apr 2009)
@@ -8,33 +8,52 @@
 
 #include <iterator>
 #include <string>
+#include <boost/spirit/home/karma/generate.hpp>
 #include <boost/spirit/home/karma/detail/ostream_iterator.hpp>
+#include <boost/mpl/bool.hpp>
 
 ///////////////////////////////////////////////////////////////////////////////
 namespace boost { namespace spirit { namespace karma { namespace detail
 {
     ///////////////////////////////////////////////////////////////////////////
-    template <
-        typename Expr, 
-        typename Parameter = unused_type, 
-        typename Delimiter = unused_type
-    >
+    template <typename Expr, typename CopyAttribute = mpl::false_
+      , typename Delimiter = unused_type, typename Attribute = unused_type>
     struct format_manip 
     {
-        format_manip(Expr const& xpr, Parameter const& p, Delimiter const& d) 
-          : expr(xpr), param(p), delim(d)
-        {}
+        format_manip(Expr const& xpr, Delimiter const& d, Attribute const& a) 
+          : expr(xpr), delim(d), pre(delimit_flag::dont_predelimit), attr(a) {}
+
+        format_manip(Expr const& xpr, Delimiter const& d
+            , BOOST_SCOPED_ENUM(delimit_flag) pre_delimit, Attribute const& a) 
+          : expr(xpr), delim(d), pre(pre_delimit), attr(a) {}
+
+        Expr const& expr;
+        Delimiter const& delim;
+        BOOST_SCOPED_ENUM(delimit_flag) const pre;
+        Attribute const& attr;
+    };
+
+    template <typename Expr, typename Delimiter, typename Attribute>
+    struct format_manip<Expr, mpl::true_, Delimiter, Attribute>
+    {
+        format_manip(Expr const& xpr, Delimiter const& d, Attribute const& a) 
+          : expr(xpr), delim(d), pre(delimit_flag::dont_predelimit), attr(a) {}
+
+        format_manip(Expr const& xpr, Delimiter const& d
+            , BOOST_SCOPED_ENUM(delimit_flag) pre_delimit, Attribute const& a) 
+          : expr(xpr), delim(d), pre(pre_delimit), attr(a) {}
 
         Expr const& expr;
-        Parameter const& param;
         Delimiter const& delim;
+        BOOST_SCOPED_ENUM(delimit_flag) const pre;
+        Attribute attr;
     };
 
     ///////////////////////////////////////////////////////////////////////////
-    template<typename Char, typename Traits, typename Expr> 
+    template<typename Char, typename Traits, typename Expr, typename Copy> 
     inline std::basic_ostream<Char, Traits> & 
-    operator<< (std::basic_ostream<Char, Traits> &os, 
-        format_manip<Expr> const& fm)
+    operator<< (std::basic_ostream<Char, Traits> &os
+      , format_manip<Expr, Copy> const& fm)
     {
         ostream_iterator<Char, Char, Traits> sink(os);
         if (!karma::generate (sink, fm.expr))
@@ -43,52 +62,51 @@
         }
         return os;
     }
-    
+
     ///////////////////////////////////////////////////////////////////////////
-    template<typename Char, typename Traits, typename Expr, typename Parameter> 
+    template<typename Char, typename Traits, typename Expr, typename Copy
+      , typename Attribute> 
     inline std::basic_ostream<Char, Traits> & 
-    operator<< (std::basic_ostream<Char, Traits> &os, 
-        format_manip<Expr, Parameter> const& fm)
+    operator<< (std::basic_ostream<Char, Traits> &os
+      , format_manip<Expr, Copy, unused_type, Attribute> const& fm)
     {
         ostream_iterator<Char, Char, Traits> sink(os);
-        if (!karma::generate(sink, fm.expr, fm.param))
+        if (!karma::generate(sink, fm.expr, fm.attr))
         {
             os.setstate(std::ios_base::failbit);
         }
         return os;
     }
-    
-    template<typename Char, typename Traits, typename Expr, typename Delimiter> 
+
+    template<typename Char, typename Traits, typename Expr, typename Copy
+      , typename Delimiter> 
     inline std::basic_ostream<Char, Traits> & 
-    operator<< (std::basic_ostream<Char, Traits> &os, 
-        format_manip<Expr, unused_type, Delimiter> const& fm)
+    operator<< (std::basic_ostream<Char, Traits> &os
+      , format_manip<Expr, Copy, Delimiter> const& fm)
     {
         ostream_iterator<Char, Char, Traits> sink(os);
-        if (!karma::generate_delimited(sink, fm.expr, fm.delim))
+        if (!karma::generate_delimited(sink, fm.expr, fm.delim, fm.pre))
         {
             os.setstate(std::ios_base::failbit);
         }
         return os;
     }
-    
+
     ///////////////////////////////////////////////////////////////////////////
-    template<
-        typename Char, typename Traits, 
-        typename Expr, typename Parameter, typename Delimiter
-    > 
+    template<typename Char, typename Traits, typename Expr, typename Copy
+      , typename Delimiter, typename Attribute> 
     inline std::basic_ostream<Char, Traits> & 
-    operator<< (
-        std::basic_ostream<Char, Traits> &os, 
-        format_manip<Expr, Parameter, Delimiter> const& fm)
+    operator<< (std::basic_ostream<Char, Traits> &os
+      , format_manip<Expr, Copy, Delimiter, Attribute> const& fm)
     {
         ostream_iterator<Char, Char, Traits> sink(os);
-        if (!karma::generate_delimited(sink, fm.expr, fm.param, fm.delim))
+        if (!karma::generate_delimited(sink, fm.expr, fm.delim, fm.pre, fm.attr))
         {
             os.setstate(std::ios_base::failbit);
         }
         return os;
     }
-    
+
 }}}}
 
 #endif
Deleted: trunk/boost/spirit/home/karma/stream/detail/iterator_ostream.hpp
==============================================================================
--- trunk/boost/spirit/home/karma/stream/detail/iterator_ostream.hpp	2009-04-26 10:42:24 EDT (Sun, 26 Apr 2009)
+++ (empty file)
@@ -1,42 +0,0 @@
-//  Copyright (c) 2001-2009 Hartmut Kaiser
-// 
-//  Distributed under the Boost Software License, Version 1.0. (See accompanying 
-//  file LICENSE_1_0.txt or copy at http://www.boist.org/LICENSE_1_0.txt)
-
-#if !defined(BOOST_SPIRIT_ITERATOR_OSTREAM_MAY_27_2007_0133PM)
-#define BOOST_SPIRIT_ITERATOR_OSTREAM_MAY_27_2007_0133PM
-
-#include <boost/iostreams/stream.hpp>
-
-///////////////////////////////////////////////////////////////////////////////
-namespace boost { namespace spirit { namespace karma { namespace detail
-{
-    ///////////////////////////////////////////////////////////////////////////
-    template <typename OutputIterator, typename Char>
-    struct iterator_sink
-    {
-        typedef boost::iostreams::sink_tag category;
-        typedef Char char_type;
-        
-        iterator_sink (OutputIterator& sink_)
-          : sink(sink_)
-        {}
-        
-        // Write up to n characters from the buffer s to the output sequence, 
-        // returning the number of characters written
-        std::streamsize write (Char const* s, std::streamsize n) 
-        {
-            std::streamsize bytes_written = 0;
-            while (n--) {
-                *sink = *s;
-                ++sink; ++s; ++bytes_written;
-            }
-            return bytes_written;
-        }
-        
-        OutputIterator& sink;
-    };
-
-}}}}
-
-#endif
Added: trunk/boost/spirit/home/karma/stream/detail/iterator_sink.hpp
==============================================================================
--- (empty file)
+++ trunk/boost/spirit/home/karma/stream/detail/iterator_sink.hpp	2009-04-26 10:42:24 EDT (Sun, 26 Apr 2009)
@@ -0,0 +1,47 @@
+//  Copyright (c) 2001-2009 Hartmut Kaiser
+// 
+//  Distributed under the Boost Software License, Version 1.0. (See accompanying 
+//  file LICENSE_1_0.txt or copy at http://www.boist.org/LICENSE_1_0.txt)
+
+#if !defined(BOOST_SPIRIT_ITERATOR_SINK_MAY_27_2007_0133PM)
+#define BOOST_SPIRIT_ITERATOR_SINK_MAY_27_2007_0133PM
+
+#include <boost/iostreams/stream.hpp>
+#include <boost/spirit/home/karma/detail/generate_to.hpp>
+
+///////////////////////////////////////////////////////////////////////////////
+namespace boost { namespace spirit { namespace karma { namespace detail
+{
+    ///////////////////////////////////////////////////////////////////////////
+    template <
+        typename OutputIterator, typename Char, typename CharEncoding
+      , typename Tag
+    >
+    struct iterator_sink
+    {
+        typedef boost::iostreams::sink_tag category;
+        typedef Char char_type;
+
+        iterator_sink (OutputIterator& sink_)
+          : sink(sink_)
+        {}
+
+        // Write up to n characters from the buffer s to the output sequence, 
+        // returning the number of characters written
+        std::streamsize write (Char const* s, std::streamsize n) 
+        {
+            std::streamsize bytes_written = 0;
+            while (n--) {
+                if (!generate_to(sink, *s, CharEncoding(), Tag()))
+                    break;
+                ++s; ++bytes_written;
+            }
+            return bytes_written;
+        }
+
+        OutputIterator& sink;
+    };
+
+}}}}
+
+#endif
Modified: trunk/boost/spirit/home/karma/stream/format_manip.hpp
==============================================================================
--- trunk/boost/spirit/home/karma/stream/format_manip.hpp	(original)
+++ trunk/boost/spirit/home/karma/stream/format_manip.hpp	2009-04-26 10:42:24 EDT (Sun, 26 Apr 2009)
@@ -7,12 +7,10 @@
 #define BOOST_SPIRIT_KARMA_FORMAT_MANIP_MAY_01_2007_1211PM
 
 #include <boost/spirit/home/karma/generate.hpp>
+#include <boost/spirit/home/karma/generator.hpp>
 #include <boost/spirit/home/support/unused.hpp>
 #include <boost/spirit/home/karma/stream/detail/format_manip.hpp>
 
-#include <boost/mpl/assert.hpp>
-#include <boost/utility/enable_if.hpp>
-
 ///////////////////////////////////////////////////////////////////////////////
 namespace boost { namespace spirit { namespace karma 
 {
@@ -21,92 +19,88 @@
     inline detail::format_manip<Expr> 
     format(Expr const& xpr)
     {
-        typedef spirit::traits::is_component<karma::domain, Expr> is_component;
-
-        // report invalid expression error as early as possible
-        BOOST_MPL_ASSERT_MSG(is_component::value,
-            xpr_is_not_convertible_to_a_generator, (Expr));
-
+        // Report invalid expression error as early as possible.
+        // If you got an error_invalid_expression error message here,
+        // then the expression (expr) is not a valid spirit karma expression.
+        BOOST_SPIRIT_ASSERT_MATCH(karma::domain, Expr)
         return karma::detail::format_manip<Expr>(xpr, unused, unused);
     }
 
-    template <typename Expr, typename Parameter>
-    inline detail::format_manip<Expr, Parameter> 
-    format(Expr const& xpr, Parameter const& p)
+    template <typename Expr, typename Attribute>
+    inline detail::format_manip<Expr, mpl::false_, unused_type, Attribute> 
+    format(Expr const& xpr, Attribute const& attr)
     {
-        typedef spirit::traits::is_component<karma::domain, Expr> is_component;
-
-        // report invalid expression error as early as possible
-        BOOST_MPL_ASSERT_MSG(is_component::value,
-            xpr_is_not_convertible_to_a_generator, (Expr, Parameter));
+        using karma::detail::format_manip;
 
-        return karma::detail::format_manip<Expr, Parameter>(xpr, p, unused);
+        // Report invalid expression error as early as possible.
+        // If you got an error_invalid_expression error message here,
+        // then the expression (expr) is not a valid spirit karma expression.
+        BOOST_SPIRIT_ASSERT_MATCH(karma::domain, Expr)
+        return format_manip<Expr, mpl::false_, unused_type, Attribute>(
+            xpr, unused, attr);
     }
 
     ///////////////////////////////////////////////////////////////////////////
     template <typename Expr, typename Delimiter>
-    inline detail::format_manip<Expr, unused_type, Delimiter> 
-    format_delimited(Expr const& xpr, Delimiter const& d)
+    inline detail::format_manip<Expr, mpl::false_, Delimiter> 
+    format_delimited(Expr const& xpr, Delimiter const& d
+      , BOOST_SCOPED_ENUM(delimit_flag) pre_delimit = delimit_flag::dont_predelimit)
     {
-        typedef
-            spirit::traits::is_component<karma::domain, Expr>
-        expr_is_component;
-        typedef
-            spirit::traits::is_component<karma::domain, Delimiter>
-        delimiter_is_component;
-
-        // report invalid expression errors as early as possible
-        BOOST_MPL_ASSERT_MSG(expr_is_component::value,
-            xpr_is_not_convertible_to_a_generator, (Expr, Delimiter));
-
-        BOOST_MPL_ASSERT_MSG(delimiter_is_component::value,
-            delimiter_is_not_convertible_to_a_generator, (Expr, Delimiter));
-
-        return karma::detail::format_manip<Expr, unused_type, Delimiter>(
-            xpr, unused, d);
-    }
-
-    template <typename Expr, typename Parameter, typename Delimiter>
-    inline detail::format_manip<Expr, Parameter, Delimiter> 
-    format_delimited(Expr const& xpr, Parameter const& p, Delimiter const& d)
-    {
-        typedef
-            spirit::traits::is_component<karma::domain, Expr>
-        expr_is_component;
-        typedef
-            spirit::traits::is_component<karma::domain, Delimiter>
-        delimiter_is_component;
-
-        // report invalid expression errors as early as possible
-        BOOST_MPL_ASSERT_MSG(expr_is_component::value,
-            xpr_is_not_convertible_to_a_generator, 
-            (Expr, Parameter, Delimiter));
-
-        BOOST_MPL_ASSERT_MSG(delimiter_is_component::value,
-            delimiter_is_not_convertible_to_a_generator, 
-            (Expr, Parameter, Delimiter));
+        using karma::detail::format_manip;
 
-        return karma::detail::format_manip<Expr, Parameter, Delimiter>(
-            xpr, p, d);
+        // Report invalid expression error as early as possible.
+        // If you got an error_invalid_expression error message here,
+        // then the expression (expr) is not a valid spirit karma expression.
+        BOOST_SPIRIT_ASSERT_MATCH(karma::domain, Expr)
+        BOOST_SPIRIT_ASSERT_MATCH(karma::domain, Delimiter)
+        return format_manip<Expr, mpl::false_, Delimiter>(
+            xpr, d, pre_delimit, unused);
+    }
+
+    template <typename Expr, typename Delimiter, typename Attribute>
+    inline detail::format_manip<Expr, mpl::false_, Delimiter, Attribute> 
+    format_delimited(Expr const& xpr, Delimiter const& d
+      , BOOST_SCOPED_ENUM(delimit_flag) pre_delimit, Attribute const& attr)
+    {
+        using karma::detail::format_manip;
+
+        // Report invalid expression error as early as possible.
+        // If you got an error_invalid_expression error message here,
+        // then the expression (expr) is not a valid spirit karma expression.
+        BOOST_SPIRIT_ASSERT_MATCH(karma::domain, Expr)
+        BOOST_SPIRIT_ASSERT_MATCH(karma::domain, Delimiter)
+        return format_manip<Expr, mpl::false_, Delimiter, Attribute>(
+            xpr, d, pre_delimit, attr);
+    }
+
+    template <typename Expr, typename Delimiter, typename Attribute>
+    inline detail::format_manip<Expr, mpl::false_, Delimiter, Attribute> 
+    format_delimited(Expr const& xpr, Delimiter const& d, Attribute const& attr)
+    {
+        using karma::detail::format_manip;
+
+        // Report invalid expression error as early as possible.
+        // If you got an error_invalid_expression error message here,
+        // then the expression (expr) is not a valid spirit karma expression.
+        BOOST_SPIRIT_ASSERT_MATCH(karma::domain, Expr)
+        BOOST_SPIRIT_ASSERT_MATCH(karma::domain, Delimiter)
+        return format_manip<Expr, mpl::false_, Delimiter, Attribute>(
+            xpr, d, delimit_flag::dont_predelimit, attr);
     }
 
     ///////////////////////////////////////////////////////////////////////////
-    template<typename Char, typename Traits, typename Expr> 
-    inline typename 
-        enable_if<
-            spirit::traits::is_component<karma::domain, Expr>,
-            std::basic_ostream<Char, Traits> & 
-        >::type
-    operator<< (std::basic_ostream<Char, Traits> &os, Expr const& xpr)
+    template<typename Char, typename Traits, typename Derived> 
+    inline std::basic_ostream<Char, Traits> & 
+    operator<< (std::basic_ostream<Char, Traits> &os, generator<Derived> const& g)
     {
         karma::detail::ostream_iterator<Char, Char, Traits> sink(os);
-        if (!karma::generate (sink, xpr))
+        if (!g.derived().generate(sink, unused, unused, unused))
         {
             os.setstate(std::ios_base::failbit);
         }
         return os;
     }
-    
+
 }}}
 
 #endif 
Added: trunk/boost/spirit/home/karma/stream/format_manip_attr.hpp
==============================================================================
--- (empty file)
+++ trunk/boost/spirit/home/karma/stream/format_manip_attr.hpp	2009-04-26 10:42:24 EDT (Sun, 26 Apr 2009)
@@ -0,0 +1,124 @@
+//  Copyright (c) 2001-2009 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_PP_IS_ITERATING)
+
+#if !defined(BOOST_SPIRIT_KARMA_FORMAT_MANIP_ATTR_APR_24_2009_0734AM)
+#define BOOST_SPIRIT_KARMA_FORMAT_MANIP_ATTR_APR_24_2009_0734AM
+
+#include <boost/spirit/home/karma/stream/detail/format_manip.hpp>
+
+#include <boost/fusion/include/vector.hpp>
+#include <boost/preprocessor/iterate.hpp>
+#include <boost/preprocessor/repetition/enum.hpp>
+#include <boost/preprocessor/repetition/enum_params.hpp>
+#include <boost/preprocessor/repetition/enum_binary_params.hpp>
+
+#define BOOST_PP_FILENAME_1                                                   \
+    <boost/spirit/home/karma/stream/format_manip_attr.hpp>
+#define BOOST_PP_ITERATION_LIMITS (2, SPIRIT_ARGUMENTS_LIMIT)
+#include BOOST_PP_ITERATE()
+
+#endif
+
+///////////////////////////////////////////////////////////////////////////////
+//
+//  Preprocessor vertical repetition code
+//
+///////////////////////////////////////////////////////////////////////////////
+#else // defined(BOOST_PP_IS_ITERATING)
+
+#define N BOOST_PP_ITERATION()
+#define BOOST_SPIRIT_KARMA_ATTRIBUTE_REFERENCE(z, n, A)                       \
+    BOOST_PP_CAT(A, n) const&
+
+///////////////////////////////////////////////////////////////////////////////
+namespace boost { namespace spirit { namespace karma 
+{
+    ///////////////////////////////////////////////////////////////////////////
+    template <typename Expr, BOOST_PP_ENUM_PARAMS(N, typename A)>
+    inline detail::format_manip<Expr, mpl::true_, unused_type
+      , fusion::vector<
+            BOOST_PP_ENUM(N, BOOST_SPIRIT_KARMA_ATTRIBUTE_REFERENCE, A)
+        > > 
+    format(Expr const& xpr, BOOST_PP_ENUM_BINARY_PARAMS(N, A, const& attr))
+    {
+        using karma::detail::format_manip;
+
+        // Report invalid expression error as early as possible.
+        // If you got an error_invalid_expression error message here,
+        // then the expression (expr) is not a valid spirit karma expression.
+        BOOST_SPIRIT_ASSERT_MATCH(karma::domain, Expr)
+
+        typedef fusion::vector<
+            BOOST_PP_ENUM(N, BOOST_SPIRIT_KARMA_ATTRIBUTE_REFERENCE, A)
+        > vector_type;
+
+        vector_type attr (BOOST_PP_ENUM_PARAMS(N, attr));
+        return format_manip<Expr, mpl::true_, unused_type, vector_type>(
+            xpr, unused, attr);
+    }
+
+    ///////////////////////////////////////////////////////////////////////////
+    template <typename Expr, typename Delimiter
+      , BOOST_PP_ENUM_PARAMS(N, typename A)>
+    inline detail::format_manip<Expr, mpl::true_, Delimiter
+      , fusion::vector<
+            BOOST_PP_ENUM(N, BOOST_SPIRIT_KARMA_ATTRIBUTE_REFERENCE, A)
+        > > 
+    format_delimited(Expr const& xpr, Delimiter const& d
+      , BOOST_SCOPED_ENUM(delimit_flag) pre_delimit
+      , BOOST_PP_ENUM_BINARY_PARAMS(N, A, const& attr))
+    {
+        using karma::detail::format_manip;
+
+        // Report invalid expression error as early as possible.
+        // If you got an error_invalid_expression error message here,
+        // then the expression (expr) is not a valid spirit karma expression.
+        BOOST_SPIRIT_ASSERT_MATCH(karma::domain, Expr)
+        BOOST_SPIRIT_ASSERT_MATCH(karma::domain, Delimiter)
+
+        typedef fusion::vector<
+            BOOST_PP_ENUM(N, BOOST_SPIRIT_KARMA_ATTRIBUTE_REFERENCE, A)
+        > vector_type;
+
+        vector_type attr (BOOST_PP_ENUM_PARAMS(N, attr));
+        return format_manip<Expr, mpl::true_, Delimiter, vector_type>(
+            xpr, d, pre_delimit, attr);
+    }
+
+    template <typename Expr, typename Delimiter
+      , BOOST_PP_ENUM_PARAMS(N, typename A)>
+    inline detail::format_manip<Expr, mpl::true_, Delimiter
+      , fusion::vector<
+            BOOST_PP_ENUM(N, BOOST_SPIRIT_KARMA_ATTRIBUTE_REFERENCE, A)
+        > > 
+    format_delimited(Expr const& xpr, Delimiter const& d
+      , BOOST_PP_ENUM_BINARY_PARAMS(N, A, const& attr))
+    {
+        using karma::detail::format_manip;
+
+        // Report invalid expression error as early as possible.
+        // If you got an error_invalid_expression error message here,
+        // then the expression (expr) is not a valid spirit karma expression.
+        BOOST_SPIRIT_ASSERT_MATCH(karma::domain, Expr)
+        BOOST_SPIRIT_ASSERT_MATCH(karma::domain, Delimiter)
+
+        typedef fusion::vector<
+            BOOST_PP_ENUM(N, BOOST_SPIRIT_KARMA_ATTRIBUTE_REFERENCE, A)
+        > vector_type;
+
+        vector_type attr (BOOST_PP_ENUM_PARAMS(N, attr));
+        return format_manip<Expr, mpl::true_, Delimiter, vector_type>(
+            xpr, d, delimit_flag::dont_predelimit, attr);
+    }
+
+}}}
+
+#undef BOOST_SPIRIT_KARMA_ATTRIBUTE_REFERENCE
+#undef N
+
+#endif 
+
Deleted: trunk/boost/spirit/home/karma/stream/meta_grammar.hpp
==============================================================================
--- trunk/boost/spirit/home/karma/stream/meta_grammar.hpp	2009-04-26 10:42:24 EDT (Sun, 26 Apr 2009)
+++ (empty file)
@@ -1,126 +0,0 @@
-//  Copyright (c) 2001-2009 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_META_GRAMMAR_MAY_01_2007_0313PM)
-#define BOOST_SPIRIT_KARMA_META_GRAMMAR_MAY_01_2007_0313PM
-
-#if defined(_MSC_VER) && (_MSC_VER >= 1020)
-#pragma once      // MS compatible compilers support #pragma once
-#endif
-
-#include <boost/spirit/home/karma/domain.hpp>
-#include <boost/spirit/home/support/meta_grammar.hpp>
-#include <boost/utility/enable_if.hpp>
-
-namespace boost { namespace spirit { namespace karma
-{
-    ///////////////////////////////////////////////////////////////////////////
-    // forwards
-    /////////////////////////////////////////////////////////////////////////// 
-    template <typename Char>
-    struct any_stream;
-    
-    template <typename Char>
-    struct stream_director;
-    
-    struct main_meta_grammar;
-
-    template <typename Expr, typename Enable>
-    struct is_valid_expr;
-
-    template <typename Expr, typename Enable>
-    struct expr_transform;
-
-    ///////////////////////////////////////////////////////////////////////////
-    // get the director for a stream
-    ///////////////////////////////////////////////////////////////////////////
-    template <typename Tag>
-    struct extract_any_stream_director;
-    
-    template <>
-    struct extract_any_stream_director<tag::stream>
-    {
-        typedef any_stream<char> type;
-    };
-
-    template <>
-    struct extract_any_stream_director<tag::wstream>
-    {
-        typedef any_stream<wchar_t> type;
-    };
-
-    ///////////////////////////////////////////////////////////////////////////
-    template <typename Tag, typename T>
-    struct extract_stream_director;
-    
-    template <typename T>
-    struct extract_stream_director<tag::stream, T>
-    {
-        typedef stream_director<char> type;
-    };
-
-    template <typename T>
-    struct extract_stream_director<tag::wstream, T>
-    {
-        typedef stream_director<wchar_t> type;
-    };
-
-    ///////////////////////////////////////////////////////////////////////////
-    // utility meta-grammar
-    ///////////////////////////////////////////////////////////////////////////
-    struct utility_meta_grammar 
-     :  proto::or_<
-            // stream, wstream
-            meta_grammar::compose_empty<
-                proto::if_<
-                    is_stream_tag<proto::_child, karma::domain>()
-                >,
-                karma::domain,
-                mpl::identity<extract_any_stream_director<mpl::_> >
-            >,
-            // stream(T), wstream(T)
-            meta_grammar::compose_function1_eval<
-                proto::function<
-                    proto::if_<
-                        is_stream_tag<proto::_child, karma::domain>()
-                    >,
-                    proto::_
-                >,
-                karma::domain,
-                mpl::identity<extract_stream_director<mpl::_, mpl::_> >
-            >
-        >
-    {
-    };
-
-    ///////////////////////////////////////////////////////////////////////////
-    //  These specializations non-intrusively hook into the Karma meta-grammar.
-    //  (see karma/meta_grammar.hpp)
-    ///////////////////////////////////////////////////////////////////////////
-    template <typename Expr>
-    struct is_valid_expr<
-            Expr,
-            typename enable_if<
-                proto::matches<Expr, utility_meta_grammar> 
-            >::type
-        >
-      : mpl::true_
-    {
-    };
-
-    template <typename Expr>
-    struct expr_transform<
-            Expr,
-            typename enable_if<
-                proto::matches<Expr, utility_meta_grammar> 
-            >::type
-        >
-      : mpl::identity<utility_meta_grammar>
-    {
-    };
-    
-}}}
-
-#endif
Modified: trunk/boost/spirit/home/karma/stream/stream.hpp
==============================================================================
--- trunk/boost/spirit/home/karma/stream/stream.hpp	(original)
+++ trunk/boost/spirit/home/karma/stream/stream.hpp	2009-04-26 10:42:24 EDT (Sun, 26 Apr 2009)
@@ -10,181 +10,295 @@
 #pragma once      // MS compatible compilers support #pragma once
 #endif
 
-#include <boost/spirit/home/karma/stream/detail/format_manip.hpp>
-#include <boost/spirit/home/karma/stream/detail/iterator_ostream.hpp>
+#include <boost/spirit/home/support/common_terminals.hpp>
+#include <boost/spirit/home/support/info.hpp>
+#include <boost/spirit/home/support/common_terminals.hpp>
 #include <boost/spirit/home/support/detail/hold_any.hpp>
+#include <boost/spirit/home/support/detail/get_encoding.hpp>
+#include <boost/spirit/home/karma/domain.hpp>
+#include <boost/spirit/home/karma/meta_compiler.hpp>
+#include <boost/spirit/home/karma/delimit_out.hpp>
+#include <boost/spirit/home/karma/auxiliary/lazy.hpp>
+#include <boost/spirit/home/karma/stream/detail/format_manip.hpp>
+#include <boost/spirit/home/karma/stream/detail/iterator_sink.hpp>
+#include <boost/spirit/home/karma/detail/get_casetag.hpp>
+#include <boost/fusion/include/at.hpp>
+#include <boost/fusion/include/vector.hpp>
+#include <boost/fusion/include/cons.hpp>
+#include <boost/utility/enable_if.hpp>
+#include <boost/type_traits/is_same.hpp>
 
 #include <iosfwd>
 
 ///////////////////////////////////////////////////////////////////////////////
 namespace boost { namespace spirit
 {
-    // overload the streaming operators for the unused_type
-    template <typename Char, typename Traits>
-    inline std::basic_ostream<Char, Traits>&
-    operator<< (std::basic_ostream<Char, Traits>& os, unused_type)
-    {
-        return os;
-    }
+    ///////////////////////////////////////////////////////////////////////////
+    // Enablers
+    ///////////////////////////////////////////////////////////////////////////
+    template <>
+    struct use_terminal<karma::domain, tag::stream>     // enables stream
+      : mpl::true_ {};
+
+    template <>
+    struct use_terminal<karma::domain, tag::wstream>    // enables wstream
+      : mpl::true_ {};
+
+    template <typename A0>
+    struct use_terminal<karma::domain                   // enables stream(...)
+      , terminal_ex<tag::stream, fusion::vector1<A0> >
+    > : mpl::true_ {};
+
+    template <typename A0>
+    struct use_terminal<karma::domain                   // enables wstream(...)
+      , terminal_ex<tag::wstream, fusion::vector1<A0> >
+    > : mpl::true_ {};
+
+    template <>                                         // enables stream(f)
+    struct use_lazy_terminal<
+        karma::domain
+      , tag::stream
+      , 1 /*arity*/
+    > : mpl::true_ {};
+
+    template <>                                         // enables wstream(f)
+    struct use_lazy_terminal<
+        karma::domain
+      , tag::wstream
+      , 1 /*arity*/
+    > : mpl::true_ {};
 
 }}
 
 ///////////////////////////////////////////////////////////////////////////////
 namespace boost { namespace spirit { namespace karma
 {
-    template <typename Char>
-    struct any_stream
+    using spirit::stream;
+    using spirit::wstream;
+
+    ///////////////////////////////////////////////////////////////////////////
+    template <typename Char, typename CharEncoding, typename Tag>
+    struct stream_generator
+      : primitive_generator<stream_generator<Char, CharEncoding, Tag> >
     {
-        template <typename Component, typename Context, typename Unused>
+        template <typename Context, typename Unused>
         struct attribute
         {
             typedef spirit::hold_any type;
         };
 
-        // 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,
-            typename Context, typename Delimiter, typename Parameter>
-        static bool
-        generate(Component const& component, OutputIterator& sink,
-            Context& /*ctx*/, Delimiter const& d, Parameter const& param)
+        // stream_generator has an attached attribute 
+        template <
+            typename OutputIterator, typename Context, typename Delimiter
+          , typename Attribute
+        >
+        static bool generate(OutputIterator& sink, Context&
+          , Delimiter const& d, Attribute const& attr)
         {
-            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
-                return true;
-            }
+            typedef karma::detail::iterator_sink<
+                OutputIterator, Char, CharEncoding, Tag
+            > sink_device;
+
+            // use existing operator<<()
+            boost::iostreams::stream<sink_device> ostr(sink);
+            ostr << attr << std::flush;
+
+            if (ostr.good()) 
+                return karma::delimit_out(sink, d);   // always do post-delimiting
             return false;
         }
 
         // 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 Context, typename Delimiter, typename Parameter
+            typename T, typename Traits, typename Context, typename Delimiter
+          , typename Attribute
         >
-        static bool
-        generate(Component const& component,
+        static bool generate(
             karma::detail::output_iterator<
                 karma::detail::ostream_iterator<T, Char, Traits>
-            >& sink, Context&, Delimiter const& d, Parameter const& param)
+            >& sink, Context&, Delimiter const& d, Attribute const& attr)
         {
             typedef karma::detail::output_iterator<
                 karma::detail::ostream_iterator<T, Char, Traits>
             > output_iterator;
-            typedef
-                karma::detail::iterator_sink<output_iterator, Char>
-            sink_device;
+            typedef karma::detail::iterator_sink<
+                output_iterator, Char, CharEncoding, Tag
+            > sink_device;
 
-            iostreams::stream<sink_device> ostr(sink);
+            // use existing operator<<()
+            boost::iostreams::stream<sink_device> ostr(sink);
             ostr.imbue(sink.get_ostream().getloc());
-            ostr << param << std::flush;        // use existing operator<<()
+            ostr << attr << std::flush;
 
-            if (ostr.good()) {
-                karma::delimit(sink, d);        // always do post-delimiting
-                return true;
-            }
+            if (ostr.good()) 
+                return karma::delimit_out(sink, d);  // always do post-delimiting
             return false;
         }
 
         // this any_stream has no parameter attached, it needs to have been
         // initialized from a value/variable
-        template <typename Component, typename OutputIterator,
-            typename Context, typename Delimiter>
+        template <typename OutputIterator, typename Context
+          , typename Delimiter>
         static bool
-        generate(Component const&, OutputIterator&, Context&, Delimiter const&,
-            unused_type)
+        generate(OutputIterator&, Context&, Delimiter const&, unused_type)
         {
             BOOST_MPL_ASSERT_MSG(false, stream__not_usable_without_attribute,
-              (Component, OutputIterator, Delimiter));
+                (OutputIterator, Delimiter));
             return false;
         }
 
-        template <typename Component, typename Context>
-        static std::string what(Component const& component, Context const& ctx)
+        template <typename Context>
+        info what(Context& /*context*/) const
         {
-            return "any-stream";
+            return info("stream");
         }
     };
 
-    ///////////////////////////////////////////////////////////////////////////
-    template <typename Char>
-    struct stream_director
+    
+    template <typename T, typename Char, typename CharEncoding, typename Tag>
+    struct any_stream_generator
+      : primitive_generator<any_stream_generator<T, Char, CharEncoding, Tag> >
     {
-        template <typename Component, typename Context, typename Unused>
+        template <typename Context, typename Unused>
         struct attribute
         {
-            typedef unused_type type;
+            typedef typename remove_const<T>::type type;
         };
 
-        // stream_director has a parameter attached
-        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&)
+        any_stream_generator(typename add_reference<T>::type t)
+          : t_(t)
+        {}
+
+        // any_stream_generator has an attached parameter
+
+        // this overload will be used in the normal case (not called from
+        // format_manip).
+        template <
+            typename OutputIterator, typename Context, typename Delimiter
+          , typename Attribute>
+        bool generate(OutputIterator& sink, Context&, Delimiter const& d
+          , Attribute const&)
         {
-            typedef
-                karma::detail::iterator_sink<OutputIterator, Char>
-            sink_device;
+            typedef karma::detail::iterator_sink<
+                OutputIterator, Char, CharEncoding, Tag
+            > sink_device;
 
-            // use existing operator<<()
-            iostreams::stream<sink_device> ostr(sink);
-            ostr << fusion::at_c<0>(component.elements) << std::flush;
+            boost::iostreams::stream<sink_device> ostr(sink);
+            ostr << t_ << std::flush;             // use existing operator<<()
 
-            if (ostr.good()) {
-                karma::delimit(sink, d);        // always do post-delimiting
-                return true;
-            }
+            if (ostr.good()) 
+                return karma::delimit_out(sink, d); // always do post-delimiting
             return false;
         }
 
         // 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 Context, typename Delimiter, typename Parameter
-        >
-        static bool
-        generate(Component const& component,
+            typename T1, typename Traits
+          , typename Context, typename Delimiter, typename Attribute>
+        bool generate(
             karma::detail::output_iterator<
-                karma::detail::ostream_iterator<T, Char, Traits>
-            >& sink, Context&, Delimiter const& d, Parameter const&)
+                karma::detail::ostream_iterator<T1, Char, Traits>
+            >& sink, Context&, Delimiter const& d, Attribute const&)
         {
             typedef karma::detail::output_iterator<
-                karma::detail::ostream_iterator<T, Char, Traits>
+                karma::detail::ostream_iterator<T1, Char, Traits>
             > output_iterator;
-            typedef
-                karma::detail::iterator_sink<output_iterator, Char>
-            sink_device;
+            typedef karma::detail::iterator_sink<
+                output_iterator, Char, CharEncoding, Tag
+            > sink_device;
 
-            // use existing operator<<()
-            iostreams::stream<sink_device> ostr(sink);
+            boost::iostreams::stream<sink_device> ostr(sink);
             ostr.imbue(sink.get_ostream().getloc());
-            ostr << fusion::at_c<0>(component.elements) << std::flush;
+            ostr << t_ << std::flush;             // use existing operator<<()
 
-            if (ostr.good()) {
-                karma::delimit(sink, d);        // always do post-delimiting
-                return true;
-            }
+            if (ostr.good()) 
+                return karma::delimit_out(sink, d); // always do post-delimiting
             return false;
         }
 
-        template <typename Component, typename Context>
-        static std::string what(Component const& component, Context const& ctx)
+        template <typename Context>
+        info what(Context& /*context*/) const
+        {
+            return info("any-stream");
+        }
+
+        T t_;
+    };
+
+    ///////////////////////////////////////////////////////////////////////////
+    // Parser generators: make_xxx function (objects)
+    ///////////////////////////////////////////////////////////////////////////
+    template <typename Char, typename Modifiers>
+    struct make_stream
+    {
+        static bool const lower =
+            has_modifier<Modifiers, tag::char_code_base<tag::lower> >::value;
+
+        static bool const upper =
+            has_modifier<Modifiers, tag::char_code_base<tag::upper> >::value;
+
+        typedef stream_generator<
+            Char
+          , typename spirit::detail::get_encoding<
+                Modifiers, unused_type, lower || upper>::type
+          , typename detail::get_casetag<Modifiers, lower || upper>::type
+        > result_type;
+
+        result_type operator()(unused_type, unused_type) const
+        {
+            return result_type();
+        }
+    };
+
+    // stream
+    template <typename Modifiers>
+    struct make_primitive<tag::stream, Modifiers> 
+      : make_stream<char, Modifiers> {};
+
+    // wstream
+    template <typename Modifiers>
+    struct make_primitive<tag::wstream, Modifiers> 
+      : make_stream<wchar_t, Modifiers> {};
+
+    ///////////////////////////////////////////////////////////////////////////
+    template <typename Char, typename A0, typename Modifiers>
+    struct make_any_stream
+    {
+        static bool const lower =
+            has_modifier<Modifiers, tag::char_code_base<tag::lower> >::value;
+
+        static bool const upper =
+            has_modifier<Modifiers, tag::char_code_base<tag::upper> >::value;
+
+        typedef typename add_const<A0>::type const_attribute;
+        typedef any_stream_generator<
+            const_attribute, Char
+          , typename spirit::detail::get_encoding<
+                Modifiers, unused_type, lower || upper>::type
+          , typename detail::get_casetag<Modifiers, lower || upper>::type
+        > result_type;
+
+        template <typename Terminal>
+        result_type operator()(Terminal const& term, unused_type) const
         {
-            return "stream";
+            return result_type(fusion::at_c<0>(term.args));
         }
     };
 
+    // stream(...)
+    template <typename Modifiers, typename A0>
+    struct make_primitive<
+            terminal_ex<tag::stream, fusion::vector1<A0> >, Modifiers>
+      : make_any_stream<char, A0, Modifiers> {};
+
+    // wstream(...)
+    template <typename Modifiers, typename A0>
+    struct make_primitive<
+            terminal_ex<tag::wstream, fusion::vector1<A0> >, Modifiers>
+      : make_any_stream<wchar_t, A0, Modifiers> {};
+
 }}}
 
 #endif
Modified: trunk/boost/spirit/home/karma/string.hpp
==============================================================================
--- trunk/boost/spirit/home/karma/string.hpp	(original)
+++ trunk/boost/spirit/home/karma/string.hpp	2009-04-26 10:42:24 EDT (Sun, 26 Apr 2009)
@@ -11,6 +11,5 @@
 #endif
 
 #include <boost/spirit/home/karma/string/lit.hpp>
-#include <boost/spirit/home/karma/string/meta_grammar.hpp>
 
 #endif
Modified: trunk/boost/spirit/home/karma/string/lit.hpp
==============================================================================
--- trunk/boost/spirit/home/karma/string/lit.hpp	(original)
+++ trunk/boost/spirit/home/karma/string/lit.hpp	2009-04-26 10:42:24 EDT (Sun, 26 Apr 2009)
@@ -10,301 +10,287 @@
 #pragma once      // MS compatible compilers support #pragma once
 #endif
 
+#include <boost/spirit/home/support/common_terminals.hpp>
+#include <boost/spirit/home/support/string_traits.hpp>
+#include <boost/spirit/home/support/info.hpp>
+#include <boost/spirit/home/support/char_class.hpp>
+#include <boost/spirit/home/support/detail/get_encoding.hpp>
 #include <boost/spirit/home/karma/domain.hpp>
-#include <boost/spirit/home/karma/delimit.hpp>
+#include <boost/spirit/home/karma/meta_compiler.hpp>
+#include <boost/spirit/home/karma/delimit_out.hpp>
+#include <boost/spirit/home/karma/auxiliary/lazy.hpp>
+#include <boost/spirit/home/karma/detail/get_casetag.hpp>
 #include <boost/spirit/home/karma/detail/string_generate.hpp>
-#include <boost/spirit/home/support/char_class.hpp>
-#include <boost/spirit/home/support/modifier.hpp>
 #include <boost/fusion/include/at.hpp>
-#include <boost/fusion/include/value_at.hpp>
 #include <boost/fusion/include/vector.hpp>
+#include <boost/fusion/include/cons.hpp>
+#include <boost/mpl/if.hpp>
+#include <boost/mpl/or.hpp>
+#include <boost/mpl/assert.hpp>
+#include <boost/mpl/bool.hpp>
 #include <string>
 
+///////////////////////////////////////////////////////////////////////////////
+namespace boost { namespace spirit
+{
+    ///////////////////////////////////////////////////////////////////////////
+    // Enablers
+    ///////////////////////////////////////////////////////////////////////////
+    template <typename CharEncoding>
+    struct use_terminal<karma::domain
+        , tag::char_code<tag::string, CharEncoding> >     // enables string
+      : mpl::true_ {};
+
+    template <typename T>
+    struct use_terminal<karma::domain, T
+      , typename enable_if<traits::is_string<T> >::type>  // enables string literals
+      : mpl::true_ {};
+
+    template <typename CharEncoding, typename A0>
+    struct use_terminal<karma::domain
+      , terminal_ex<
+            tag::char_code<tag::string, CharEncoding>     // enables string(str)
+          , fusion::vector1<A0> >
+    > : traits::is_string<A0> {};
+
+    template <typename CharEncoding>                      // enables string(f)
+    struct use_lazy_terminal<
+        karma::domain
+      , tag::char_code<tag::string, CharEncoding>
+      , 1 /*arity*/
+    > : mpl::true_ {};
+
+}} 
+
+///////////////////////////////////////////////////////////////////////////////
 namespace boost { namespace spirit { namespace karma
 {
     ///////////////////////////////////////////////////////////////////////////
     // generate literal strings from a given parameter
     ///////////////////////////////////////////////////////////////////////////
-    template <typename Char>
+    template <typename CharEncoding, typename Tag>
     struct any_string
+      : primitive_generator<any_string<CharEncoding, Tag> >
     {
-        template <typename Component, typename Context, typename Unused>
+        typedef typename CharEncoding::char_type char_type;
+        typedef CharEncoding char_encoding;
+
+        template <typename Context, typename Unused>
         struct attribute
         {
-            typedef std::basic_string<Char> type;
+            typedef std::basic_string<char_type> type;
         };
 
-        // lit has a parameter attached
-        template <typename Component, typename OutputIterator,
-            typename Context, typename Delimiter, typename Parameter>
+        // lit has an attached attribute
+        template <
+            typename OutputIterator, typename Context, 
+            typename Delimiter, typename Attribute
+        >
         static bool
-        generate(Component const& /*component*/, OutputIterator& sink,
-            Context& /*ctx*/, Delimiter const& d, Parameter const& param)
+        generate(OutputIterator& sink, Context& /*ctx*/, Delimiter const& d, 
+            Attribute const& attr)
         {
-            bool result = detail::string_generate(sink, param);
-            if (result)
-                karma::delimit(sink, d);           // always do post-delimiting
-            return result;
+            return 
+                karma::detail::string_generate(sink, attr, char_encoding(), Tag()) &&
+                karma::delimit_out(sink, d);      // always do post-delimiting
         }
 
-        // this lit has no parameter attached, it needs to have been
+        // this lit has no attribute attached, it needs to have been
         // initialized from a direct literal
-        template <typename Component, typename OutputIterator,
-            typename Context, typename Delimiter>
-        static bool
-        generate(Component const& component, OutputIterator& sink,
-            Context& /*ctx*/, Delimiter const& d, unused_type)
-        {
-            BOOST_MPL_ASSERT_MSG(false, lit_not_usable_without_attribute, ());
+        template <typename OutputIterator, typename Context, typename Delimiter>
+        static bool generate(OutputIterator&, Context&, Delimiter const&, 
+            unused_type const&)
+        {
+            // It is not possible (doesn't make sense) to use char_ without
+            // providing any attribute, as the generator doesn't 'know' what
+            // character to output. The following assertion fires if this
+            // situation is detected in your code.
+            BOOST_MPL_ASSERT_MSG(false, string_not_usable_without_attribute, ());
             return false;
         }
 
-        template <typename Component, typename Context>
-        static std::string what(Component const& component, Context const& ctx)
+        template <typename Context>
+        static info what(Context const& ctx)
         {
-            return "any-string";
+            return info("any-string");
         }
     };
 
     ///////////////////////////////////////////////////////////////////////////
     // generate literal strings
     ///////////////////////////////////////////////////////////////////////////
-    template <typename Char>
+    template <typename String, typename CharEncoding, typename Tag, bool no_attribute>
     struct literal_string
+      : primitive_generator<literal_string<String, CharEncoding, Tag, no_attribute> >
     {
-        template <typename Component, typename Context, typename Unused>
+        typedef CharEncoding char_encoding;
+        typedef typename
+            remove_const<typename traits::char_type_of<String>::type>::type
+        char_type;
+        typedef std::basic_string<char_type> string_type;
+
+        template <typename Context, typename Unused>
         struct attribute
         {
-            typedef unused_type type;
+            typedef typename mpl::if_c<
+                no_attribute, unused_type, string_type>::type
+            type;
         };
 
-        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*/)
-        {
-            bool result = detail::string_generate(sink,
-                fusion::at_c<0>(component.elements));
+        literal_string(typename add_reference<String>::type str)
+          : str_(str)
+        {}
 
-            karma::delimit(sink, d);           // always do post-delimiting
-            return result;
-        }
-
-        template <typename Component, typename Context>
-        static std::string what(Component const& component, Context const& ctx)
+        template <
+            typename OutputIterator, typename Context, 
+            typename Delimiter, typename Attribute
+        >
+        bool generate(OutputIterator& sink, Context& /*ctx*/
+          , Delimiter const& d, Attribute const&) const
         {
-            return std::string("\"")
-                + spirit::detail::to_narrow_string(
-                    fusion::at_c<0>(component.elements))
-                + std::string("\"")
-            ;
+            return 
+                detail::string_generate(sink, str_, char_encoding(), Tag()) && 
+                karma::delimit_out(sink, d);      // always do post-delimiting
         }
-    };
-
-    ///////////////////////////////////////////////////////////////////////////
-    // lazy string generation
-    ///////////////////////////////////////////////////////////////////////////
-    struct lazy_string
-    {
-        template <typename Component, typename Context, typename Unused>
-        struct attribute
-        {
-            typedef unused_type type;
-        };
 
-        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*/)
+        template <typename Context>
+        info what(Context const& ctx) const
         {
-            bool result = detail::string_generate(sink,
-                fusion::at_c<0>(component.elements)(unused, ctx));
-
-            karma::delimit(sink, d);           // always do post-delimiting
-            return result;
+            return info("literal-string", str_);
         }
 
-        template <typename Component, typename Context>
-        static std::string what(Component const& component, Context const& ctx)
-        {
-            return "string";
-        }
+        string_type str_;
     };
 
-    ///////////////////////////////////////////////////////////////////////////
-    // generate literal strings from a given parameter
-    ///////////////////////////////////////////////////////////////////////////
-    template <typename Char, typename Tag>
-    struct case_any_string
+    template <typename String, typename Tag, bool no_attribute>
+    struct literal_string<String, unused_type, Tag, no_attribute>
+      : primitive_generator<literal_string<String, unused_type, Tag, no_attribute> >
     {
-        template <typename Component, typename Context, typename Unused>
+        typedef typename
+            remove_const<typename traits::char_type_of<String>::type>::type
+        char_type;
+        typedef std::basic_string<char_type> string_type;
+
+        template <typename Context, typename Unused>
         struct attribute
         {
-            typedef std::basic_string<Char> type;
+            typedef typename mpl::if_c<
+                no_attribute, unused_type, string_type>::type
+            type;
         };
 
-        // case_any_string has a parameter attached
-        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)
-        {
-            bool result = detail::string_generate(sink, param, Tag());
-            karma::delimit(sink, d);           // always do post-delimiting
-            return result;
-        }
+        literal_string(typename add_reference<String>::type str)
+          : str_(str) {}
 
-        // this case_any_string has no parameter attached, it needs to have been
-        // initialized from a direct literal
-        template <typename Component, typename OutputIterator,
-            typename Context, typename Delimiter>
-        static bool
-        generate(Component const& component, OutputIterator& sink,
-            Context& /*ctx*/, Delimiter const& d, unused_type)
+        template <
+            typename OutputIterator, typename Context, 
+            typename Delimiter, typename Attribute
+        >
+        bool generate(OutputIterator& sink, Context& /*ctx*/
+          , Delimiter const& d, Attribute const& attr) const
         {
-            BOOST_MPL_ASSERT_MSG(false, lit_not_usable_without_attribute, ());
-            return false;
+            return 
+                detail::string_generate(sink, str_) && 
+                karma::delimit_out(sink, d);      // always do post-delimiting
         }
 
-
-        template <typename Component, typename Context>
-        static std::string what(Component const& component, Context const& ctx)
+        template <typename Context>
+        info what(Context const& ctx) const
         {
-            typedef typename Tag::char_set char_set;
-            typedef typename Tag::char_class char_class_;
-            return std::string("any-") +
-                spirit::char_class::what<char_set>::is(char_class_())
-                + "case-string";
+            return info("literal-string", str_);
         }
-    };
 
-}}}
+        string_type str_;
+    };
 
-namespace boost { namespace spirit { namespace traits
-{
     ///////////////////////////////////////////////////////////////////////////
-    // lower_case and upper_case literal_string generator
+    // Generator generators: make_xxx function (objects)
     ///////////////////////////////////////////////////////////////////////////
-    template <typename Domain, typename Elements, typename Modifier,
-        typename Char>
-    struct make_modified_component<
-        Domain, karma::literal_string<Char>, Elements, Modifier,
-        typename enable_if<
-            is_member_of_modifier<Modifier, spirit::char_class::lower_case_base_tag>
-        >::type
-    >
-    {
-        typedef std::basic_string<Char> string_type;
-        typedef fusion::vector<string_type> 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();
-                 it != end; ++it)
-            {
-                *it = char_set::tolower(*it);
-            }
+    // string
+    template <typename CharEncoding, typename Modifiers>
+    struct make_primitive<
+        tag::char_code<tag::string, CharEncoding>
+      , Modifiers>
+    {
+        static bool const lower = 
+            has_modifier<Modifiers, tag::char_code<tag::lower, CharEncoding> >::value;
+        static bool const upper = 
+            has_modifier<Modifiers, tag::char_code<tag::upper, CharEncoding> >::value;
+
+        typedef any_string<
+            typename spirit::detail::get_encoding<
+                Modifiers, CharEncoding, lower || upper>::type
+          , typename detail::get_casetag<Modifiers, lower || upper>::type
+        > result_type;
 
-            return type(vector_type(val));
+        result_type operator()(unused_type, unused_type) const
+        {
+            return result_type();
         }
     };
 
-    template <typename Domain, typename Elements, typename Modifier,
-        typename Char>
-    struct make_modified_component<
-        Domain, karma::literal_string<Char>, Elements, Modifier,
-        typename enable_if<
-            is_member_of_modifier<Modifier, spirit::char_class::upper_case_base_tag>
-        >::type
-    >
+    // string literal 
+    template <typename T, typename Modifiers>
+    struct make_primitive<T, Modifiers
+      , typename enable_if<traits::is_string<T> >::type>
     {
-        typedef std::basic_string<Char> string_type;
-        typedef fusion::vector<string_type> vector_type;
+        static bool const lower =
+            has_modifier<Modifiers, tag::char_code_base<tag::lower> >::value;
 
-        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();
-                 it != end; ++it)
-            {
-                *it = char_set::toupper(*it);
-            }
+        static bool const upper =
+            has_modifier<Modifiers, tag::char_code_base<tag::upper> >::value;
 
-            return type(vector_type(val));
-        }
-    };
+        static bool const no_attr =
+            !has_modifier<Modifiers, tag::lazy_eval>::value;
 
-    ///////////////////////////////////////////////////////////////////////////
-    // lower and upper case_any_string conversions
-    ///////////////////////////////////////////////////////////////////////////
-    template <typename Domain, typename Elements, typename Modifier,
-        typename Char>
-    struct make_modified_component<
-        Domain, karma::any_string<Char>, Elements, Modifier,
-        typename enable_if<
-            is_member_of_modifier<Modifier, spirit::char_class::lower_case_base_tag>
-        >::type
-    >
-    {
-        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;
+        typedef typename add_const<T>::type const_string;
+        typedef literal_string<
+            const_string
+          , typename spirit::detail::get_encoding<
+                Modifiers, unused_type, lower || upper>::type
+          , typename detail::get_casetag<Modifiers, lower || upper>::type
+          , no_attr
+        > result_type;
 
-        static type
-        call(Elements const&)
+        result_type operator()(
+            typename add_reference<const_string>::type str, unused_type) const
         {
-            return type(fusion::nil());
+            return result_type(str);
         }
     };
 
-    template <typename Domain, typename Elements, typename Modifier,
-        typename Char>
-    struct make_modified_component<
-        Domain, karma::any_string<Char>, Elements, Modifier,
-        typename enable_if<
-            is_member_of_modifier<Modifier, spirit::char_class::upper_case_base_tag>
-        >::type
-    >
+    template <typename CharEncoding, typename Modifiers, typename A0>
+    struct make_primitive<
+        terminal_ex<
+            tag::char_code<tag::string, CharEncoding>
+          , fusion::vector1<A0> >
+      , Modifiers>
     {
-        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 bool const lower = 
+            has_modifier<Modifiers, tag::char_code<tag::lower, CharEncoding> >::value;
+        static bool const upper = 
+            has_modifier<Modifiers, tag::char_code<tag::upper, CharEncoding> >::value;
+
+        static bool const no_attr =
+            !has_modifier<Modifiers, tag::lazy_eval>::value;
+
+        typedef typename add_const<A0>::type const_string;
+        typedef literal_string<
+            const_string
+          , typename spirit::detail::get_encoding<
+                Modifiers, unused_type, lower || upper>::type
+          , typename detail::get_casetag<Modifiers, lower || upper>::type
+          , no_attr
+        > result_type;
 
-        static type
-        call(Elements const&)
+        template <typename Terminal>
+        result_type operator()(Terminal const& term, unused_type) const
         {
-            return type(fusion::nil());
+            return result_type(fusion::at_c<0>(term.args));
         }
     };
 
-}}}
+}}}   // namespace boost::spirit::karma
 
 #endif
Deleted: trunk/boost/spirit/home/karma/string/meta_grammar.hpp
==============================================================================
--- trunk/boost/spirit/home/karma/string/meta_grammar.hpp	2009-04-26 10:42:24 EDT (Sun, 26 Apr 2009)
+++ (empty file)
@@ -1,236 +0,0 @@
-//  Copyright (c) 2001-2009 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_META_GRAMMAR_FEB_22_2007_0532PM)
-#define BOOST_SPIRIT_KARMA_META_GRAMMAR_FEB_22_2007_0532PM
-
-#if defined(_MSC_VER) && (_MSC_VER >= 1020)
-#pragma once      // MS compatible compilers support #pragma once
-#endif
-
-#include <boost/spirit/home/karma/domain.hpp>
-#include <boost/spirit/home/support/placeholders.hpp>
-#include <boost/spirit/home/support/meta_grammar.hpp>
-#include <boost/utility/enable_if.hpp>
-#include <boost/mpl/bool.hpp>
-#include <boost/type_traits/remove_const.hpp>
-#include <boost/type_traits/is_convertible.hpp>
-#include <string>
-
-namespace boost { namespace spirit { namespace karma
-{
-    ///////////////////////////////////////////////////////////////////////////
-    // forwards
-    ///////////////////////////////////////////////////////////////////////////
-    template <typename Char>
-    struct any_string;
-
-    template <typename Char>
-    struct literal_string;
-
-    struct lazy_string;
-
-    struct string_meta_grammar;
-
-    template <typename Expr, typename Enable>
-    struct is_valid_expr;
-
-    template <typename Expr, typename Enable>
-    struct expr_transform;
-
-    ///////////////////////////////////////////////////////////////////////////
-    //
-    ///////////////////////////////////////////////////////////////////////////
-    template <typename T>
-    struct extract_char;
-
-    template <typename Char, typename Traits, typename Alloc>
-    struct extract_char<std::basic_string<Char, Traits, Alloc> >
-    {
-        typedef Char type;
-    };
-
-    template <typename Char, int N>
-    struct extract_char<Char[N]>
-    {
-        typedef typename remove_const<Char>::type type;
-    };
-
-    template <typename Char, int N>
-    struct extract_char<Char(&)[N]>
-    {
-        typedef typename remove_const<Char>::type type;
-    };
-
-    template <typename Char>
-    struct extract_char<Char*>
-    {
-        typedef typename remove_const<Char>::type type;
-    };
-
-    ///////////////////////////////////////////////////////////////////////////
-    // get the director of a string literal type
-    ///////////////////////////////////////////////////////////////////////////
-    template <typename Tag, typename T>
-    struct extract_lit_director_lit;
-
-    template <typename T>
-    struct extract_lit_director_lit<tag::lit, T>
-    {
-        typedef typename extract_char<T>::type char_type;
-        typedef literal_string<char_type> type;
-    };
-
-    template <typename T>
-    struct extract_lit_director_lit<tag::wlit, T>
-    {
-        typedef typename extract_char<T>::type char_type;
-        typedef literal_string<char_type> type;
-    };
-
-    ///////////////////////////////////////////////////////////////////////////
-    template <typename Tag>
-    struct extract_lit_director_plain;
-
-    template <>
-    struct extract_lit_director_plain<tag::lit>
-    {
-        typedef any_string<char> type;
-    };
-
-    template <>
-    struct extract_lit_director_plain<tag::wlit>
-    {
-        typedef any_string<wchar_t> type;
-    };
-
-    ///////////////////////////////////////////////////////////////////////////
-    // string generator meta-grammar
-    ///////////////////////////////////////////////////////////////////////////
-
-    // literal strings: "hello"
-    struct string_literal_meta_grammar
-      : proto::or_<
-            meta_grammar::terminal_rule<
-                karma::domain, char const*, literal_string<char>
-            >,
-            meta_grammar::terminal_rule<
-                karma::domain, wchar_t const*, literal_string<wchar_t>
-            >,
-            meta_grammar::terminal_rule<
-                karma::domain, char*, literal_string<char>
-            >,
-            meta_grammar::terminal_rule<
-                karma::domain, wchar_t*, literal_string<wchar_t>
-            >
-        >
-    {
-    };
-
-    // literal strings: "hello"
-    struct basic_string_literal_meta_grammar
-      : proto::or_<
-            proto::terminal<char const*>,
-            proto::terminal<wchar_t const*>
-        >
-    {
-    };
-
-    // std::string(s)
-    struct std_string_meta_grammar
-      : proto::or_<
-            meta_grammar::terminal_rule<
-                karma::domain,
-                std::basic_string<char, proto::_, proto::_>,
-                literal_string<char>
-            >,
-            meta_grammar::terminal_rule<
-                karma::domain,
-                std::basic_string<wchar_t, proto::_, proto::_>,
-                literal_string<wchar_t>
-            >
-        >
-    {
-    };
-
-    // std::string(s)
-    struct basic_std_string_meta_grammar
-      : proto::or_<
-            proto::terminal<std::basic_string<char, proto::_, proto::_> >,
-            proto::terminal<std::basic_string<wchar_t, proto::_, proto::_> >
-        >
-    {
-    };
-
-    namespace detail
-    {
-        // we use this test to detect if the argument to lit is a callable
-        // function or not. Only types convertible to int or function/
-        // function objects are allowed. Therefore, if T is not convertible
-        // to an int, then we have a function/function object.
-        template <typename T>
-        struct is_not_convertible_to_int
-          : mpl::not_<is_convertible<T, int> >
-        {
-        };
-    }
-
-    // this is the string literal meta grammar
-    // literal strings: lit, lit("hello")
-    struct string_meta_grammar
-      : proto::or_<
-            string_literal_meta_grammar,
-            std_string_meta_grammar,
-            meta_grammar::compose_empty<
-                proto::if_<
-                    is_lit_tag<proto::_child, karma::domain>()
-                >,
-                karma::domain,
-                mpl::identity<extract_lit_director_plain<mpl::_> >
-            >,
-            meta_grammar::compose_function1_eval<
-                proto::function<
-                    proto::if_<
-                        is_lit_tag<proto::_child, karma::domain>()
-                    >,
-                    proto::or_<
-                        basic_string_literal_meta_grammar,
-                        basic_std_string_meta_grammar
-                    >
-                >,
-                karma::domain,
-                mpl::identity<extract_lit_director_lit<mpl::_, mpl::_> >
-            >,
-            meta_grammar::function1_rule<
-                karma::domain, tag::lit, lazy_string,
-                proto::if_<
-                    detail::is_not_convertible_to_int<proto::_child>()
-                >
-            >
-        >
-    {
-    };
-
-    ///////////////////////////////////////////////////////////////////////////
-    //  These specializations non-intrusively hooks into the Karma meta-grammar.
-    //  (see karma/meta_grammar.hpp)
-    ///////////////////////////////////////////////////////////////////////////
-    template <typename Expr>
-    struct is_valid_expr<Expr,
-        typename enable_if<proto::matches<Expr, string_meta_grammar> >::type>
-      : mpl::true_
-    {
-    };
-
-    template <typename Expr>
-    struct expr_transform<Expr,
-        typename enable_if<proto::matches<Expr, string_meta_grammar> >::type>
-      : mpl::identity<string_meta_grammar>
-    {
-    };
-
-}}}
-
-#endif
Modified: trunk/boost/spirit/home/karma/what.hpp
==============================================================================
--- trunk/boost/spirit/home/karma/what.hpp	(original)
+++ trunk/boost/spirit/home/karma/what.hpp	2009-04-26 10:42:24 EDT (Sun, 26 Apr 2009)
@@ -6,30 +6,23 @@
 #if !defined(BOOST_SPIRIT_WHAT_MAY_04_2007_0116PM)
 #define BOOST_SPIRIT_WHAT_MAY_04_2007_0116PM
 
-#include <boost/spirit/home/karma/meta_grammar.hpp>
 #include <boost/mpl/assert.hpp>
-#include <string>
+#include <boost/spirit/home/support/info.hpp>
+#include <boost/spirit/home/karma/meta_compiler.hpp>
 
 namespace boost { namespace spirit { namespace karma
 {
     template <typename Expr>
-    inline std::string what(Expr const& xpr)
+    inline info what(Expr const& xpr)
     {
-        typedef spirit::traits::is_component<karma::domain, Expr> is_component;
-
-        // report invalid expression error as early as possible
-        BOOST_MPL_ASSERT_MSG(
-            is_component::value,
-            xpr_is_not_convertible_to_a_generator, ());
-
-        typedef typename 
-            spirit::result_of::as_component<karma::domain, Expr>::type 
-        component;
-        typedef typename component::director director;
-
-        component c = spirit::as_component(karma::domain(), xpr);
-        return director::what(c, unused);
+        // Report invalid expression error as early as possible.
+        // If you got an error_invalid_expression
+        // error message here, then the expression (expr) is not a
+        // valid spirit karma expression.
+        BOOST_SPIRIT_ASSERT_MATCH(karma::domain, Expr)
+        return compile<karma::domain>(xpr).what(unused);
     }
+
 }}}
 
 #endif
Modified: trunk/boost/spirit/home/lex.hpp
==============================================================================
--- trunk/boost/spirit/home/lex.hpp	(original)
+++ trunk/boost/spirit/home/lex.hpp	2009-04-26 10:42:24 EDT (Sun, 26 Apr 2009)
@@ -11,8 +11,7 @@
 #endif
 
 #include <boost/spirit/home/lex/lexer.hpp>
-#include <boost/spirit/home/lex/domain.hpp>
-#include <boost/spirit/home/lex/meta_grammar.hpp>
+#include <boost/spirit/home/lex/qi.hpp>
 #include <boost/spirit/home/lex/tokenize_and_parse.hpp>
 
 #endif
Modified: trunk/boost/spirit/home/lex/domain.hpp
==============================================================================
--- trunk/boost/spirit/home/lex/domain.hpp	(original)
+++ trunk/boost/spirit/home/lex/domain.hpp	2009-04-26 10:42:24 EDT (Sun, 26 Apr 2009)
@@ -11,11 +11,21 @@
 #pragma once      // MS compatible compilers support #pragma once
 #endif
 
+#include <boost/spirit/home/support/unused.hpp>
+#include <boost/spirit/home/support/meta_compiler.hpp>
+#include <boost/spirit/home/support/info.hpp>
+
 namespace boost { namespace spirit { namespace lex
 {
-    struct domain 
-    {};
-    
+    // lex's domain
+    struct domain {};
+
+    // bring in some of spirit parts into spirit::lex
+    using spirit::unused;
+    using spirit::unused_type;
+    using spirit::compile;
+    using spirit::info;
+
 }}}
 
 #endif
Modified: trunk/boost/spirit/home/lex/lexer.hpp
==============================================================================
--- trunk/boost/spirit/home/lex/lexer.hpp	(original)
+++ trunk/boost/spirit/home/lex/lexer.hpp	2009-04-26 10:42:24 EDT (Sun, 26 Apr 2009)
@@ -10,21 +10,13 @@
 #pragma once      // MS compatible compilers support #pragma once
 #endif
 
-#include <boost/spirit/home/lex/lexer/terminal_holder.hpp>
-#include <boost/spirit/home/lex/lexer/terminal_director.hpp>
+#include <boost/spirit/home/lex/lexer/terminals.hpp>
 #include <boost/spirit/home/lex/lexer/token_def.hpp>
 #include <boost/spirit/home/lex/lexer/token_set.hpp>
 #include <boost/spirit/home/lex/lexer/char_token_def.hpp>
 #include <boost/spirit/home/lex/lexer/string_token_def.hpp>
 #include <boost/spirit/home/lex/lexer/sequence.hpp>
 #include <boost/spirit/home/lex/lexer/action.hpp>
-#include <boost/spirit/home/lex/lexer/lexer_actions.hpp>
 #include <boost/spirit/home/lex/lexer/lexer.hpp>
-#include <boost/spirit/home/lex/lexer/meta_grammar.hpp>
-
-#include <boost/spirit/home/lex/qi/state/state_switcher.hpp>
-#include <boost/spirit/home/lex/qi/state/in_state.hpp>
-#include <boost/spirit/home/lex/qi/utility/plain_token.hpp>
-#include <boost/spirit/home/lex/qi/meta_grammar.hpp>
 
 #endif
Modified: trunk/boost/spirit/home/lex/lexer/action.hpp
==============================================================================
--- trunk/boost/spirit/home/lex/lexer/action.hpp	(original)
+++ trunk/boost/spirit/home/lex/lexer/action.hpp	2009-04-26 10:42:24 EDT (Sun, 26 Apr 2009)
@@ -10,86 +10,74 @@
 #pragma once      // MS compatible compilers support #pragma once
 #endif
 
-#include <boost/spirit/home/lex/set_state.hpp>
+#include <boost/spirit/home/lex/meta_compiler.hpp>
+#include <boost/spirit/home/lex/lexer_type.hpp>
+#include <boost/mpl/if.hpp>
+#include <boost/type_traits/remove_const.hpp>
+#include <boost/type_traits/is_same.hpp>
 
 ///////////////////////////////////////////////////////////////////////////////
 namespace boost { namespace spirit { namespace lex
 {
     ///////////////////////////////////////////////////////////////////////////
-    namespace detail
+    template <typename Subject, typename Action>
+    struct action : unary_lexer<action<Subject, Action> >
     {
-        ///////////////////////////////////////////////////////////////////////
-        template <typename Char>
-        struct set_state_functor
-        {
-            set_state_functor (Char const* new_state_)
-              : new_state(new_state_)
-            {
-            }
-            
-            template <typename Range, typename LexerContext>
-            void operator()(Range const&, std::size_t, bool&, 
-                LexerContext& ctx) const
-            {
-                ctx.set_state_name(new_state);
-            }
-            
-            Char const* new_state;
-        };
-        
-        ///////////////////////////////////////////////////////////////////////
-        template <typename Char>
-        set_state_functor<Char> 
-        make_set_state(Char const* new_state)
-        {
-            return set_state_functor<Char>(new_state);
-        }
+        action(Subject const& subject, Action f)
+          : subject(subject), f(f) {}
 
-        template <typename Char, typename Traits, typename Alloc>
-        set_state_functor<Char> 
-        make_set_state(std::basic_string<Char, Traits, Alloc> const& new_state)
-        {
-            return set_state_functor<Char>(new_state.c_str());
-        }
-
-        ///////////////////////////////////////////////////////////////////////
-        template <typename LexerDef, typename F>
-        inline void add_action_helper(LexerDef& lexdef, std::size_t id, F act)
-        {
-            lexdef.add_action(id, act);
-        }
-        
         template <typename LexerDef, typename String>
-        inline void add_action_helper(LexerDef& lexdef, std::size_t id, 
-            spirit::tag::set_state_tag<String> t)
+        void collect(LexerDef& lexdef, String const& state) const
         {
-            lexdef.add_action(id, make_set_state(t.name));
+            // first collect the token definition information for the token_def 
+            // this action is attached to
+            subject.collect(lexdef, state);
+
+            // retrieve the id of the associated token_def and register the 
+            // given semantic action with the lexer instance
+            lexdef.add_action(subject.id(), f);
         }
-    }
-    
+
+        Subject subject;
+        Action f;
+    };
+
+}}}
+
+///////////////////////////////////////////////////////////////////////////////
+namespace boost { namespace spirit
+{
     ///////////////////////////////////////////////////////////////////////////
-    struct action
+    // Karma action meta-compiler
+    template <>
+    struct make_component<lex::domain, tag::action>
     {
-        template <typename Component, typename LexerDef, typename String>
-        static void 
-        collect(Component const& component, LexerDef& lexdef, 
-            String const& state)
+        template <typename Sig>
+        struct result;
+
+        template <typename This, typename Elements, typename Modifiers>
+        struct result<This(Elements, Modifiers)>
         {
             typedef typename
-                result_of::left<Component>::type::director
-            director;
-            
-            // first collect the token definition information for the token_def 
-            // this action is attached to
-            director::collect(spirit::left(component), lexdef, state);
+                remove_const<typename Elements::car_type>::type
+            subject_type;
 
-            // retrieve the id of the associated token_def and register the 
-            // given semantic action with the lexer instance
-            std::size_t id = director::id(spirit::left(component));
-            detail::add_action_helper(lexdef, id, spirit::right(component));
+            typedef typename
+                remove_const<typename Elements::cdr_type::car_type>::type
+            action_type;
+
+            typedef lex::action<subject_type, action_type> type;
+        };
+
+        template <typename Elements>
+        typename result<make_component(Elements, unused_type)>::type
+        operator()(Elements const& elements, unused_type) const
+        {
+            typename result<make_component(Elements, unused_type)>::type
+                result(elements.car, elements.cdr.car);
+            return result;
         }
     };
-    
-}}} // namespace boost::spirit::lex
+}}
 
 #endif
Modified: trunk/boost/spirit/home/lex/lexer/char_token_def.hpp
==============================================================================
--- trunk/boost/spirit/home/lex/lexer/char_token_def.hpp	(original)
+++ trunk/boost/spirit/home/lex/lexer/char_token_def.hpp	2009-04-26 10:42:24 EDT (Sun, 26 Apr 2009)
@@ -10,7 +10,42 @@
 #pragma once      // MS compatible compilers support #pragma once
 #endif
 
-#include <boost/spirit/home/support/component.hpp>
+#include <boost/spirit/home/support/common_terminals.hpp>
+#include <boost/spirit/home/support/string_traits.hpp>
+#include <boost/spirit/home/lex/domain.hpp>
+#include <boost/spirit/home/lex/lexer_type.hpp>
+#include <boost/spirit/home/lex/meta_compiler.hpp>
+
+namespace boost { namespace spirit
+{
+    ///////////////////////////////////////////////////////////////////////////
+    // Enablers
+    ///////////////////////////////////////////////////////////////////////////
+    template <>
+    struct use_terminal<lex::domain, char>               // enables 'x'
+      : mpl::true_ {};
+
+    template <>
+    struct use_terminal<lex::domain, char[2]>            // enables "x"
+      : mpl::true_ {};
+
+    template <>
+    struct use_terminal<lex::domain, wchar_t>            // enables wchar_t
+      : mpl::true_ {};
+
+    template <>
+    struct use_terminal<lex::domain, wchar_t[2]>         // enables L"x"
+      : mpl::true_ {};
+
+    template <typename CharEncoding, typename A0>
+    struct use_terminal<lex::domain
+      , terminal_ex<
+            tag::char_code<tag::char_, CharEncoding>     // enables char_('x'), char_("x")
+          , fusion::vector1<A0>
+        >
+    > : mpl::true_ {};
+
+}}
 
 namespace boost { namespace spirit { namespace lex
 { 
@@ -20,21 +55,102 @@
     //      represents a single character token definition
     //
     ///////////////////////////////////////////////////////////////////////////
+    template <typename CharEncoding>
     struct char_token_def
+      : primitive_lexer<char_token_def<CharEncoding> >
     {
-        template <typename Component, typename LexerDef, typename String>
-        static void 
-        collect(Component const& component, LexerDef& lexdef, 
-            String const& state)
+        typedef typename CharEncoding::char_type char_type;
+
+        char_token_def(char_type ch) : ch (ch) {}
+
+        template <typename LexerDef, typename String>
+        void collect(LexerDef& lexdef, String const& state) const
         {
-            typedef typename result_of::subject<Component>::type char_type;
-            
-            char_type c = subject(component);
-            lexdef.add_token (state.c_str(), lex::detail::escape(c), 
-                static_cast<std::size_t>(c));
+            lexdef.add_token (state.c_str(), ch, 
+                static_cast<std::size_t>(ch));
         }
+
+        char_type ch;
     };
-                
+
+    ///////////////////////////////////////////////////////////////////////////
+    // Lexer generators: make_xxx function (objects)
+    ///////////////////////////////////////////////////////////////////////////
+    namespace detail
+    {
+        template <typename CharEncoding>
+        struct basic_literal
+        {
+            typedef char_token_def<CharEncoding> result_type;
+
+            template <typename Char>
+            result_type operator()(Char ch, unused_type) const
+            {
+                return result_type(ch);
+            }
+
+            template <typename Char>
+            result_type operator()(Char const* str, unused_type) const
+            {
+                return result_type(str[0]);
+            }
+        };
+    }
+
+    // literals: 'x', "x"
+    template <typename Modifiers>
+    struct make_primitive<char, Modifiers>
+      : detail::basic_literal<char_encoding::standard> {};
+
+    template <typename Modifiers>
+    struct make_primitive<char const(&)[2], Modifiers>
+      : detail::basic_literal<char_encoding::standard> {};
+
+    // literals: L'x', L"x"
+    template <typename Modifiers>
+    struct make_primitive<wchar_t, Modifiers>
+      : detail::basic_literal<char_encoding::standard_wide> {};
+
+    template <typename Modifiers>
+    struct make_primitive<wchar_t const(&)[2], Modifiers>
+      : detail::basic_literal<char_encoding::standard_wide> {};
+
+    // handle char_('x')
+    template <typename CharEncoding, typename Modifiers, typename A0>
+    struct make_primitive<
+        terminal_ex<
+            tag::char_code<tag::char_, CharEncoding>
+          , fusion::vector1<A0>
+        >
+      , Modifiers>
+    {
+        typedef char_token_def<CharEncoding> result_type;
+
+        template <typename Terminal>
+        result_type operator()(Terminal const& term, unused_type) const
+        {
+            return result_type(fusion::at_c<0>(term.args));
+        }
+    };
+
+    // handle char_("x")
+    template <typename CharEncoding, typename Modifiers, typename Char>
+    struct make_primitive<
+        terminal_ex<
+            tag::char_code<tag::char_, CharEncoding>
+          , fusion::vector1<Char(&)[2]>   // single char strings
+        >
+      , Modifiers>
+    {
+        typedef char_token_def<CharEncoding> result_type;
+
+        template <typename Terminal>
+        result_type operator()(Terminal const& term, unused_type) const
+        {
+            return result_type(fusion::at_c<0>(term.args)[0]);
+        }
+    };
+
 }}}  // namespace boost::spirit::lex
 
 #endif 
Modified: trunk/boost/spirit/home/lex/lexer/lexer.hpp
==============================================================================
--- trunk/boost/spirit/home/lex/lexer/lexer.hpp	(original)
+++ trunk/boost/spirit/home/lex/lexer/lexer.hpp	2009-04-26 10:42:24 EDT (Sun, 26 Apr 2009)
@@ -10,75 +10,78 @@
 #pragma once      // MS compatible compilers support #pragma once
 #endif
 
-#include <boost/spirit/home/support/safe_bool.hpp>
-#include <boost/spirit/home/lex/lexer/lexer_fwd.hpp>
-#include <boost/spirit/home/lex/lexer/terminal_holder.hpp>
+#include <boost/spirit/home/support/info.hpp>
+#include <boost/spirit/home/support/detail/scoped_enum_emulation.hpp>
+#include <boost/spirit/home/qi/skip_over.hpp>
+#include <boost/spirit/home/qi/parser.hpp>
+#include <boost/spirit/home/qi/detail/assign_to.hpp>
+#include <boost/spirit/home/lex/reference.hpp>
+#include <boost/spirit/home/lex/meta_compiler.hpp>
+#include <boost/spirit/home/lex/lexer_type.hpp>
 #include <boost/spirit/home/lex/lexer/token_def.hpp>
+#include <boost/assert.hpp>
 #include <boost/noncopyable.hpp>
 #include <boost/detail/iterator.hpp>
 #include <boost/fusion/include/vector.hpp>
-#include <boost/assert.hpp>
 #include <boost/mpl/assert.hpp>
-#include <string>
 #include <boost/range/iterator_range.hpp>
+#include <string>
 
 namespace boost { namespace spirit { namespace lex
 {
+    ///////////////////////////////////////////////////////////////////////////
     namespace detail
     {
         ///////////////////////////////////////////////////////////////////////
         template <typename LexerDef>
         struct lexer_def_
-          : public proto::extends<
-                typename make_terminal_holder<
-                    lexer_def_<LexerDef> const*, lexer_def_<LexerDef>
-                >::type,
-                lexer_def_<LexerDef>
-            >
+          : proto::extends<
+                typename proto::terminal<
+                   lex::reference<lexer_def_<LexerDef> const> 
+                >::type
+              , lexer_def_<LexerDef> >
+          , qi::parser<lexer_def_<LexerDef> >
+          , lex::lexer_type<lexer_def_<LexerDef> >
+          , noncopyable
         {
         private:
             // avoid warnings about using 'this' in constructor
-            lexer_def_& this_() { return *this; }    
-
-            // initialize proto base class
-            typedef 
-                terminal_holder<lexer_def_ const*, lexer_def_> 
-            terminal_holder_;
-            typedef typename proto::terminal<terminal_holder_>::type tag;
-            typedef proto::extends<tag, lexer_def_> base_type;
+            lexer_def_& this_() { return *this; }
 
+            typedef typename LexerDef::char_type char_type;
+            typedef typename LexerDef::string_type string_type;
             typedef typename LexerDef::id_type id_type;
-            
-            tag make_tag() const
+
+            typedef lex::reference<lexer_def_ const> reference_;
+            typedef typename proto::terminal<reference_>::type terminal_type;
+            typedef proto::extends<terminal_type, lexer_def_> proto_base_type;
+
+            reference_ alias() const
             {
-                tag xpr = {{ this }};
-                return xpr;
+                return reference_(*this);
             }
-            
-            typedef typename LexerDef::char_type char_type;
-            typedef typename LexerDef::string_type string_type;
 
         public:
-            // Qi interface: metafunction calculating parser return type
-            template <typename Component, typename Context, typename Iterator>
+            // Qi interface: metafunction calculating parser attribute type
+            template <typename Context, typename Iterator>
             struct attribute
             {
                 //  the return value of a token set contains the matched token 
                 //  id, and the corresponding pair of iterators
                 typedef typename Iterator::base_iterator_type iterator_type;
                 typedef 
-                    fusion::vector<id_type, iterator_range<iterator_type> > 
+                    fusion::vector2<id_type, iterator_range<iterator_type> > 
                 type;
             };
-                
-        private:
+
             // Qi interface: parse functionality
-            template <typename Iterator, typename Context, typename Skipper, 
-                typename Attribute>
-            bool parse(Iterator& first, Iterator const& last, 
-                Context& context, Skipper const& skipper, Attribute& attr) const
+            template <typename Iterator, typename Context
+              , typename Skipper, typename Attribute>
+            bool parse(Iterator& first, Iterator const& last
+              , Context& /*context*/, Skipper const& skipper
+              , Attribute& attr) const
             {
-                qi::skip(first, last, skipper);   // always do a pre-skip
+                qi::skip_over(first, last, skipper);   // always do a pre-skip
 
                 if (first != last) {
                     typedef typename 
@@ -95,46 +98,57 @@
                 }
                 return false;
             }
-            friend struct terminal_director;
 
-            static std::string what()
+            // Qi interface: 'what' functionality
+            template <typename Context>
+            info what(Context& /*context*/) const
             {
-                return "lexer";
+                return info("lexer");
             }
 
+        private:
             // allow to use the lexer.self.add("regex1", id1)("regex2", id2);
             // syntax
             struct adder
             {
                 adder(lexer_def_& def_) 
-                : def(def_)
-                {}
+                  : def(def_) {}
 
-                adder const&
-                operator()(char_type c, id_type token_id = 0) const
+                // Add a token definition based on a single character as given
+                // by the first parameter, the second parameter allows to 
+                // specify the token id to use for the new token. If no token
+                // id is given the character code is used.
+                adder const& operator()(char_type c
+                  , id_type token_id = id_type()) const
                 {
-                    if (0 == token_id)
+                    if (id_type() == token_id)
                         token_id = static_cast<id_type>(c);
-                    def.def.add_token (def.state.c_str(), lex::detail::escape(c), 
-                        token_id);
+                    def.def.add_token (def.state.c_str(), c, token_id);
                     return *this;
                 }
-                adder const&
-                operator()(string_type const& s, id_type token_id = id_type()) const
+
+                // Add a token definition based on a character sequence as 
+                // given by the first parameter, the second parameter allows to 
+                // specify the token id to use for the new token. If no token
+                // id is given this function will generate a unique id to be 
+                // used as the token's id.
+                adder const& operator()(string_type const& s
+                  , id_type token_id = id_type()) const
                 {
-                    if (0 == token_id)
+                    if (id_type() == token_id)
                         token_id = next_id<id_type>::get();
                     def.def.add_token (def.state.c_str(), s, token_id);
                     return *this;
                 }
+
                 template <typename Attribute>
-                adder const&
-                operator()(token_def<Attribute, char_type, id_type>& tokdef, 
-                    id_type token_id = id_type()) const
+                adder const& operator()(
+                    token_def<Attribute, char_type, id_type>& tokdef
+                  , id_type token_id = id_type()) const
                 {
                     // make sure we have a token id
-                    if (0 == token_id) {
-                        if (0 == tokdef.id()) {
+                    if (id_type() == token_id) {
+                        if (id_type() == tokdef.id()) {
                             token_id = next_id<id_type>::get();
                             tokdef.id(token_id);
                         }
@@ -143,18 +157,19 @@
                         }
                     }
                     else { 
-                    // the following assertion makes sure, that the token_def
+                    // the following assertion makes sure that the token_def
                     // instance has not been assigned a different id earlier
-                        BOOST_ASSERT(0 == tokdef.id() || token_id == tokdef.id());
+                        BOOST_ASSERT(id_type() == tokdef.id() 
+                                  || token_id == tokdef.id());
                         tokdef.id(token_id);
                     }
-                    
+
                     def.define(tokdef);
                     return *this;
                 }
+
                 template <typename TokenSet>
-                adder const&
-                operator()(token_set<TokenSet>& tokset) const
+                adder const& operator()(token_set<TokenSet>& tokset) const
                 {
                     def.define(tokset);
                     return *this;
@@ -163,17 +178,16 @@
                 lexer_def_& def;
             };
             friend struct adder;
-            
+
             // allow to use lexer.self.add_pattern("pattern1", "regex1")(...);
             // syntax
             struct pattern_adder
             {
                 pattern_adder(lexer_def_& def_) 
-                : def(def_)
-                {}
+                  : def(def_) {}
 
-                pattern_adder const&
-                operator()(string_type const& p, string_type const& s) const
+                pattern_adder const& operator()(string_type const& p
+                  , string_type const& s) const
                 {
                     def.def.add_pattern (def.state.c_str(), p, s);
                     return *this;
@@ -182,26 +196,19 @@
                 lexer_def_& def;
             };
             friend struct pattern_adder;
-            
+
         public:
             ///////////////////////////////////////////////////////////////////
             template <typename Expr>
-            void define(Expr const& xpr)
+            void define(Expr const& expr)
             {
-                typedef typename
-                    result_of::as_component<lex::domain, Expr>::type
-                component;
-                typedef typename component::director director;
-                
-                component c = spirit::as_component(lex::domain(), xpr);
-                director::collect(c, def, state);
+                compile<lex::domain>(expr).collect(def, state);
             }
 
             lexer_def_(LexerDef& def_, string_type const& state_)
-              : base_type(make_tag()), add(this_()), add_pattern(this_()),
-                def(def_), state(state_)
-            {
-            }
+              : proto_base_type(terminal_type::make(alias()))
+              , add(this_()), add_pattern(this_()), def(def_), state(state_)
+            {}
 
             // allow to switch states
             lexer_def_ operator()(char_type const* state) const
@@ -212,19 +219,16 @@
             {
                 return lexer_def_(def, state);
             }
-            
+
             // allow to assign a token definition expression
             template <typename Expr>
             lexer_def_& operator= (Expr const& xpr)
             {
-                typedef 
-                    spirit::traits::is_component<lex::domain, Expr> 
-                is_component;
-
-                // report invalid expression error as early as possible
-                BOOST_MPL_ASSERT_MSG(
-                    is_component::value,
-                    xpr_is_not_convertible_to_a_token_definition, ());
+                // Report invalid expression error as early as possible.
+                // If you got an error_invalid_expression error message here,
+                // then the expression (expr) is not a valid spirit lex 
+                // expression.
+                BOOST_SPIRIT_ASSERT_MATCH(lex::domain, Expr)
 
                 def.clear(state.c_str());
                 define(xpr);
@@ -233,42 +237,36 @@
 
             adder add;
             pattern_adder add_pattern;
-            
+
         private:
             LexerDef& def;
             string_type state;
         };
-    
+
         // allow to assign a token definition expression
         template <typename LexerDef, typename Expr>
         inline lexer_def_<LexerDef>&
         operator+= (lexer_def_<LexerDef>& lexdef, Expr& xpr)
         {
-            typedef 
-                spirit::traits::is_component<lex::domain, Expr> 
-            is_component;
-
-            // report invalid expression error as early as possible
-            BOOST_MPL_ASSERT_MSG(
-                is_component::value,
-                xpr_is_not_convertible_to_a_token_definition, ());
+            // Report invalid expression error as early as possible.
+            // If you got an error_invalid_expression error message here,
+            // then the expression (expr) is not a valid spirit lex 
+            // expression.
+            BOOST_SPIRIT_ASSERT_MATCH(lex::domain, Expr)
 
             lexdef.define(xpr);
             return lexdef;
         }
-        
+
         template <typename LexerDef, typename Expr>
         inline lexer_def_<LexerDef>& 
         operator+= (lexer_def_<LexerDef>& lexdef, Expr const& xpr)
         {
-            typedef 
-                spirit::traits::is_component<lex::domain, Expr> 
-            is_component;
-
-            // report invalid expression error as early as possible
-            BOOST_MPL_ASSERT_MSG(
-                is_component::value,
-                xpr_is_not_convertible_to_a_token_definition, ());
+            // Report invalid expression error as early as possible.
+            // If you got an error_invalid_expression error message here,
+            // then the expression (expr) is not a valid spirit lex 
+            // expression.
+            BOOST_SPIRIT_ASSERT_MATCH(lex::domain, Expr)
 
             lexdef.define(xpr);
             return lexdef;
@@ -276,96 +274,52 @@
     }
 
     ///////////////////////////////////////////////////////////////////////////
-    //  This represents a lexer definition (helper for token and token set 
-    //  definitions
+    //  The match_flags flags are used to influence different matching 
+    //  modes of the lexer
+    BOOST_SCOPED_ENUM_START(match_flags) 
+    {
+        match_default = 0,          // no flags
+        match_not_dot_newline = 1,  // the regex '.' doesn't match newlines
+        match_icase = 2             // all matching operations are case insensitive
+    };
+    BOOST_SCOPED_ENUM_END
+
+    ///////////////////////////////////////////////////////////////////////////
+    //  This represents a lexer object
     ///////////////////////////////////////////////////////////////////////////
     template <typename Lexer>
-    class lexer_def : private noncopyable, public Lexer
+    class lexer : public Lexer
     {
     private:
-        typedef lexer_def self_type;
-        
         // avoid warnings about using 'this' in constructor
-        lexer_def& this_() { return *this; }    
+        lexer& this_() { return *this; }
 
-    public:        
+    public:
         typedef Lexer lexer_type;
         typedef typename Lexer::id_type id_type;
-        typedef detail::lexer_def_<self_type> token_set;
         typedef typename Lexer::char_type char_type;
-        typedef std::basic_string<char_type> string_type;
-        
-        lexer_def() 
-          : self(this_(), Lexer::initial_state())  
-        {
-        }
+        typedef typename Lexer::iterator_type iterator_type;
+        typedef lexer base_type;
 
-        token_set self;  // allow for easy token definition
-        
-        // this is just a dummy implementation to allow to use lexer_def 
-        // directly, without having to derive a separate class
-        void def(token_set& /*self*/) {}
-    };
-    
-    ///////////////////////////////////////////////////////////////////////////
-    //  This represents a lexer object
-    ///////////////////////////////////////////////////////////////////////////
-    template <typename Definition>
-    class lexer : public safe_bool<lexer<Definition> >
-    {
-    public:
-        // operator_bool() is needed for the safe_bool base class
-        bool operator_bool() const { return token_def; }
-
-        typedef typename Definition::lexer_type lexer_type;
-        typedef typename Definition::char_type char_type;
-        typedef typename Definition::iterator_type iterator_type;
-        typedef typename Definition::id_type id_type;
+        typedef detail::lexer_def_<lexer> lexer_def;
+        typedef std::basic_string<char_type> string_type;
 
-        lexer(Definition& token_def_)
-          : token_def(token_def_) 
-        {
-            // call initialization routine supplied by the target lexer
-            token_def.def(token_def.self);
-        }
+        lexer(unsigned int flags = match_flags::match_default) 
+          : lexer_type(flags), self(this_(), lexer_type::initial_state()) {}
 
         // access iterator interface
         template <typename Iterator>
         iterator_type begin(Iterator& first, Iterator const& last) const
-            { return token_def.begin(first, last); }
-        iterator_type end() const { return token_def.end(); }
-    
+            { return this->lexer_type::begin(first, last); }
+        iterator_type end() const 
+            { return this->lexer_type::end(); }
+
         std::size_t map_state(char_type const* state)
-            { return token_def.add_state(state); }
-        
-        Definition& get_definition() { return token_def; }
-        Definition  const& get_definition() const { return token_def; }
-        
-    private:
-        Definition& token_def;
-    };
+            { return this->lexer_type::add_state(state); }
 
-    ///////////////////////////////////////////////////////////////////////////
-    //  Metafunction returning the iterator type of the lexer given the token 
-    //  definition type.
-    ///////////////////////////////////////////////////////////////////////////
-    template <typename Definition>
-    struct lexer_iterator
-    {
-        typedef typename lexer<Definition>::iterator_type type;
+        lexer_def self;  // allow for easy token definition
     };
 
-    ///////////////////////////////////////////////////////////////////////////
-    //  Generator function helping to construct a proper lexer object 
-    //  instance
-    ///////////////////////////////////////////////////////////////////////////
-    template <typename Definition>
-    inline lexer<Definition> 
-    make_lexer(Definition& def)
-    {
-        return lexer<Definition>(def);
-    }
-    
 }}}
 
 #endif
Deleted: trunk/boost/spirit/home/lex/lexer/lexer_actions.hpp
==============================================================================
--- trunk/boost/spirit/home/lex/lexer/lexer_actions.hpp	2009-04-26 10:42:24 EDT (Sun, 26 Apr 2009)
+++ (empty file)
@@ -1,47 +0,0 @@
-//  Copyright (c) 2001-2009 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_LEX_LEXER_ACTIONS_FEB_13_2008_1232PM)
-#define BOOST_SPIRIT_LEX_LEXER_ACTIONS_FEB_13_2008_1232PM
-
-#if defined(_MSC_VER) && (_MSC_VER >= 1020)
-#pragma once      // MS compatible compilers support #pragma once
-#endif
-
-#include <iosfwd>
-
-///////////////////////////////////////////////////////////////////////////////
-namespace boost { namespace spirit { namespace lex 
-{ 
-    ///////////////////////////////////////////////////////////////////////////
-    template <typename Char, typename Traits>
-    struct echo_input_functor
-    {
-        echo_input_functor (std::basic_ostream<Char, Traits>& os_)
-          : os(os_)
-        {
-        }
-        
-        template <typename Range, typename LexerContext>
-        void operator()(Range const& r, std::size_t, bool&, LexerContext&) const
-        {
-            os << r;
-        }
-        
-        std::basic_ostream<Char, Traits>& os;
-    };
-    
-    ///////////////////////////////////////////////////////////////////////////
-    template <typename Char, typename Traits>
-    inline echo_input_functor<Char, Traits> 
-    echo_input(std::basic_ostream<Char, Traits>& os)
-    {
-        return echo_input_functor<Char, Traits>(os);
-    }
-    
-///////////////////////////////////////////////////////////////////////////////
-}}}
-
-#endif
Deleted: trunk/boost/spirit/home/lex/lexer/lexer_fwd.hpp
==============================================================================
--- trunk/boost/spirit/home/lex/lexer/lexer_fwd.hpp	2009-04-26 10:42:24 EDT (Sun, 26 Apr 2009)
+++ (empty file)
@@ -1,45 +0,0 @@
-//  Copyright (c) 2001-2009 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_LEX_LEXER_FWD_MAR_22_2007_1137PM)
-#define BOOST_SPIRIT_LEX_LEXER_FWD_MAR_22_2007_1137PM
-
-#if defined(_MSC_VER) && (_MSC_VER >= 1020)
-#pragma once      // MS compatible compilers support #pragma once
-#endif
-
-#include <boost/spirit/home/support/unused.hpp>
-
-namespace boost { namespace spirit { namespace lex
-{
-    ///////////////////////////////////////////////////////////////////////////
-    //  This component represents a token definition
-    ///////////////////////////////////////////////////////////////////////////
-    template<typename Attribute = unused_type, typename Char = char, 
-        typename Idtype = std::size_t>
-    class token_def;
-
-    ///////////////////////////////////////////////////////////////////////////
-    //  token_set
-    ///////////////////////////////////////////////////////////////////////////
-    template <typename TokenSet>
-    class token_set;
-    
-    ///////////////////////////////////////////////////////////////////////////
-    //  This represents a lexer definition (helper for token and token set 
-    //  definitions)
-    ///////////////////////////////////////////////////////////////////////////
-    template <typename Lexer>
-    class lexer_def;
-    
-    ///////////////////////////////////////////////////////////////////////////
-    //  This represents a lexer object
-    ///////////////////////////////////////////////////////////////////////////
-    template <typename Definition>
-    class lexer;
-    
-}}}
-
-#endif
Added: trunk/boost/spirit/home/lex/lexer/lexertl/functor.hpp
==============================================================================
--- (empty file)
+++ trunk/boost/spirit/home/lex/lexer/lexertl/functor.hpp	2009-04-26 10:42:24 EDT (Sun, 26 Apr 2009)
@@ -0,0 +1,381 @@
+//  Copyright (c) 2001-2009 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_LEX_LEXER_FUNCTOR_NOV_18_2007_1112PM)
+#define BOOST_SPIRIT_LEX_LEXER_FUNCTOR_NOV_18_2007_1112PM
+
+#if defined(_MSC_VER) && (_MSC_VER >= 1020)
+#pragma once      // MS compatible compilers support #pragma once
+#endif
+
+#include <boost/mpl/bool.hpp>
+#include <boost/function.hpp>
+#include <boost/range/iterator_range.hpp>
+#include <boost/detail/iterator.hpp>
+#include <boost/detail/workaround.hpp>
+#include <map>
+#include <boost/spirit/home/support/detail/lexer/generator.hpp>
+#include <boost/spirit/home/support/detail/lexer/rules.hpp>
+#include <boost/spirit/home/support/detail/lexer/state_machine.hpp>
+#include <boost/spirit/home/lex/lexer/lexertl/iterator_tokenizer.hpp>
+#include <boost/spirit/home/lex/lexer/lexertl/wrap_action.hpp>
+
+#if 0 != __COMO_VERSION__ || !BOOST_WORKAROUND(BOOST_MSVC, <= 1310)
+#define BOOST_SPIRIT_STATIC_EOF 1
+#define BOOST_SPIRIT_EOF_PREFIX static
+#else
+#define BOOST_SPIRIT_EOF_PREFIX 
+#endif
+
+namespace boost { namespace spirit { namespace lex { namespace lexertl
+{ 
+    namespace detail
+    {
+        ///////////////////////////////////////////////////////////////////////
+        template <typename Iterator, typename HasActors, typename HasState>
+        struct Data;    // no default specialization
+
+        ///////////////////////////////////////////////////////////////////////
+        //  neither supports state, nor actors
+        template <typename Iterator>
+        struct Data<Iterator, mpl::false_, mpl::false_>
+        {
+            typedef std::size_t state_type;
+            typedef iterator_range<Iterator> iterpair_type;
+            typedef typename boost::detail::iterator_traits<Iterator>::value_type 
+                char_type;
+            typedef unused_type semantic_actions_type;
+            typedef detail::wrap_action<unused_type, iterpair_type, Data>
+                wrap_action_type;
+
+            // initialize the shared data 
+            template <typename IterData>
+            Data (IterData const& data_, Iterator& first_, Iterator const& last_)
+              : state_machine(data_.state_machine_)
+              , rules(data_.rules_)
+              , first(first_), last(last_) {}
+
+            std::size_t next(Iterator& end)
+            {
+                typedef basic_iterator_tokeniser<Iterator> tokenizer;
+                return tokenizer::next(state_machine, first, end, last);
+            }
+
+            // nothing to invoke, so this is empty
+            bool invoke_actions(std::size_t, Iterator const&) 
+            {
+                return true;    // always accept
+            }
+
+            std::size_t get_state() const { return 0; }
+            void set_state_name (char_type const* state) {}
+
+            boost::lexer::basic_state_machine<char_type> const& state_machine;
+            boost::lexer::basic_rules<char_type> const& rules;
+            Iterator& first;
+            Iterator last;
+        };
+
+        ///////////////////////////////////////////////////////////////////////
+        //  doesn't support actors
+        template <typename Iterator>
+        struct Data<Iterator, mpl::false_, mpl::true_>
+          : Data<Iterator, mpl::false_, mpl::false_>
+        {
+            typedef Data<Iterator, mpl::false_, mpl::false_> base_type;
+
+            typedef typename base_type::state_type state_type;
+            typedef typename base_type::char_type char_type;
+            typedef typename base_type::semantic_actions_type 
+                semantic_actions_type;
+
+            // initialize the shared data 
+            template <typename IterData>
+            Data (IterData const& data_, Iterator& first_, Iterator const& last_)
+              : base_type(data_, first_, last_), state(0) {}
+
+            std::size_t next(Iterator& end)
+            {
+                typedef basic_iterator_tokeniser<Iterator> tokenizer;
+                return tokenizer::next(this->state_machine, state, 
+                    this->first, end, this->last);
+            }
+
+            std::size_t& get_state() { return state; }
+
+            void set_state_name (char_type const* new_state) 
+            { 
+                std::size_t state_id = this->rules.state(new_state);
+
+                // if the following assertion fires you've probably been using 
+                // a lexer state name which was not defined in your token 
+                // definition
+                BOOST_ASSERT(state_id != boost::lexer::npos);
+
+                if (state_id != boost::lexer::npos)
+                    state = state_id;
+            }
+
+            std::size_t state;
+        };
+
+        ///////////////////////////////////////////////////////////////////////
+        //  does support actors, but may have no state
+        template <typename Iterator, typename HasState>
+        struct Data<Iterator, mpl::true_, HasState> 
+          : Data<Iterator, mpl::false_, HasState>
+        {
+            typedef Data<Iterator, mpl::false_, HasState> base_type;
+
+            typedef iterator_range<Iterator> iterpair_type;
+            typedef typename base_type::state_type state_type;
+            typedef typename base_type::char_type char_type;
+
+            typedef void functor_type(iterpair_type, std::size_t, bool&, Data&);
+            typedef boost::function<functor_type> functor_wrapper_type;
+            typedef std::multimap<std::size_t, functor_wrapper_type> 
+                semantic_actions_type;
+
+            typedef detail::wrap_action<functor_wrapper_type, iterpair_type, Data>
+                wrap_action_type;
+
+            template <typename IterData>
+            Data (IterData const& data_, Iterator& first_, Iterator const& last_)
+              : base_type(data_, first_, last_)
+              , actions(data_.actions_) {}
+
+            // invoke attached semantic actions, if defined
+            bool invoke_actions(std::size_t id, Iterator const& end)
+            {
+                if (actions.empty()) 
+                    return true;  // nothing to invoke, continue with 'match'
+
+                iterpair_type itp(this->first, end);
+                bool match = true;
+
+                typedef typename semantic_actions_type::const_iterator 
+                    iterator_type;
+
+                std::pair<iterator_type, iterator_type> p = actions.equal_range(id);
+                while (p.first != p.second)
+                {
+                    ((*p.first).second)(itp, id, match, *this);
+                    if (!match)
+                        return false;   // return a 'no-match'
+                    ++p.first;
+                }
+                return true;    // normal execution
+            }
+
+            semantic_actions_type const& actions;
+        };
+    }
+
+    ///////////////////////////////////////////////////////////////////////////
+    //
+    //  functor is a template usable as the functor object for the 
+    //  multi_pass iterator allowing to wrap a lexertl based dfa into a 
+    //  iterator based interface.
+    //  
+    //    Iterator:   the type of the underlying iterator
+    //    Token:      the type of the tokens produced by this functor
+    //                this needs to expose a constructor with the following
+    //                prototype:
+    //
+    //                Token(std::size_t id, std::size_t state, 
+    //                      Iterator start, Iterator end)
+    //
+    //                where 'id' is the token id, state is the lexer state,
+    //                this token has been matched in, and 'first' and 'end'  
+    //                mark the start and the end of the token with respect 
+    //                to the underlying character stream.
+    //    SupportsActors:
+    //                this is expected to be a mpl::bool_, if mpl::true_ the
+    //                functor invokes functors which (optionally) have 
+    //                been attached to the token definitions.
+    //    SupportState:
+    //                this is expected to be a mpl::bool_, if mpl::true_ the
+    //                functor supports different lexer states, 
+    //                otherwise no lexer state is supported.
+    //
+    ///////////////////////////////////////////////////////////////////////////
+    template <typename Token
+      , typename Iterator = typename Token::iterator_type
+      , typename SupportsActors = mpl::false_
+      , typename SupportsState = typename Token::has_state>
+    class functor
+    {
+    public:
+        typedef typename 
+            boost::detail::iterator_traits<Iterator>::value_type 
+        char_type;
+
+    private:
+        // Needed by compilers not implementing the resolution to DR45. For
+        // reference, see
+        // http://www.open-std.org/JTC1/SC22/WG21/docs/cwg_defects.html#45.
+        template <typename Iterator_, typename HasActors, typename HasState> 
+        friend struct detail::Data;
+
+        // Helper template allowing to assign a value on exit
+        template <typename T>
+        struct assign_on_exit
+        {
+            assign_on_exit(T& dst_, T const& src_)
+              : dst(dst_), src(src_)
+            {}
+            ~assign_on_exit()
+            {
+                dst = src;
+            }
+
+            T& dst;
+            T const& src;
+        };
+
+    public:
+        functor()
+#if defined(__PGI)
+          : eof()
+#endif 
+        {}
+
+#if BOOST_WORKAROUND(BOOST_MSVC, <= 1310)
+        // somehow VC7.1 needs this (meaningless) assignment operator
+        functor& operator=(functor const& rhs)
+        {
+            return *this;
+        }
+#endif
+
+        ///////////////////////////////////////////////////////////////////////
+        // interface to the multi_pass_policies::split_functor_input policy
+        typedef Token result_type;
+        typedef functor unique;
+        typedef detail::Data<Iterator, SupportsActors, SupportsState> shared;
+
+        BOOST_SPIRIT_EOF_PREFIX result_type const eof;
+
+        ///////////////////////////////////////////////////////////////////////
+        typedef Iterator iterator_type;
+        typedef typename shared::semantic_actions_type semantic_actions_type;
+
+        // this is needed to wrap the semantic actions in a proper way
+        typedef typename shared::wrap_action_type wrap_action_type;
+
+        ///////////////////////////////////////////////////////////////////////
+        template <typename MultiPass>
+        static result_type& get_next(MultiPass& mp, result_type& result)
+        {
+            shared& data = mp.shared->ftor;
+            if (data.first == data.last) 
+#if defined(BOOST_SPIRIT_STATIC_EOF)
+                return result = eof;
+#else
+                return result = mp.ftor.eof;
+#endif
+
+            Iterator end = data.first;
+            std::size_t id = data.next(end);
+
+            if (boost::lexer::npos == id) {   // no match
+#if defined(BOOST_SPIRIT_LEXERTL_DEBUG)
+                std::string next;
+                Iterator it = data.first;
+                for (std::size_t i = 0; i < 10 && it != data.last; ++it, ++i)
+                    next += *it;
+
+                std::cerr << "Not matched, in state: " << data.state 
+                          << ", lookahead: >" << next << "<" << std::endl;
+#endif
+                result = result_type(0);
+            }
+            else if (0 == id) {         // EOF reached
+#if defined(BOOST_SPIRIT_STATIC_EOF)
+                result = eof;
+#else
+                result = mp.ftor.eof;
+#endif
+            }
+            else {
+#if defined(BOOST_SPIRIT_LEXERTL_DEBUG)
+                {
+                    std::string next;
+                    Iterator it = end;
+                    for (std::size_t i = 0; i < 10 && it != data.last; ++it, ++i)
+                        next += *it;
+
+                    std::cerr << "Matched: " << id << ", in state: " 
+                              << data.state << ", string: >" 
+                              << std::basic_string<char_type>(data.first, end) << "<"
+                              << ", lookahead: >" << next << "<" << std::endl;
+                }
+#endif
+                // invoke_actions might change state
+                std::size_t state = data.get_state();
+
+                // invoke attached semantic actions, if defined
+                if (!data.invoke_actions(id, end))
+                {
+                    // one of the semantic actions signaled no-match
+                    result = result_type(0); 
+                }
+                else 
+                {
+                    // return matched token, advancing 'data.first' past the 
+                    // matched sequence
+                    assign_on_exit<Iterator> on_exit(data.first, end);
+                    result = result_type(id, state, data.first, end);
+                }
+            }
+            return result;
+        }
+
+        // set_state are propagated up to the iterator interface, allowing to 
+        // manipulate the current lexer state through any of the exposed 
+        // iterators.
+        template <typename MultiPass>
+        static std::size_t set_state(MultiPass& mp, std::size_t state_) 
+        { 
+            std::size_t oldstate = mp.shared->ftor.state;
+            mp.shared->ftor.state = state_;
+
+#if defined(BOOST_SPIRIT_LEXERTL_DEBUG)
+            std::cerr << "Switching state from: " << oldstate 
+                      << " to: " << state_
+                      << std::endl;
+#endif
+            return oldstate; 
+        }
+
+        template <typename MultiPass>
+        static std::size_t 
+        map_state(MultiPass const& mp, char_type const* statename)  
+        { 
+            return mp.shared->ftor.rules.state(statename);
+        }
+
+        // we don't need this, but it must be there
+        template <typename MultiPass>
+        static void destroy(MultiPass const&) {}
+    };
+
+#if defined(BOOST_SPIRIT_STATIC_EOF)
+    ///////////////////////////////////////////////////////////////////////////
+    //  eof token
+    ///////////////////////////////////////////////////////////////////////////
+    template <typename Token, typename Iterator, typename SupportsActors
+      , typename SupportsState>
+    typename functor<Token, Iterator, SupportsActors, SupportsState>::result_type const
+        functor<Token, Iterator, SupportsActors, SupportsState>::eof = 
+            typename functor<Token, Iterator, SupportsActors, SupportsState>::result_type();
+#endif
+
+}}}}
+
+#undef BOOST_SPIRIT_EOF_PREFIX
+#undef BOOST_SPIRIT_STATIC_EOF
+
+#endif
Added: trunk/boost/spirit/home/lex/lexer/lexertl/generate_static.hpp
==============================================================================
--- (empty file)
+++ trunk/boost/spirit/home/lex/lexer/lexertl/generate_static.hpp	2009-04-26 10:42:24 EDT (Sun, 26 Apr 2009)
@@ -0,0 +1,560 @@
+//  Copyright (c) 2008 Ben Hanson
+//  Copyright (c) 2008-2009 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_LEX_LEXERTL_GENERATE_CPP_FEB_10_2008_0855PM)
+#define BOOST_SPIRIT_LEX_LEXERTL_GENERATE_CPP_FEB_10_2008_0855PM
+
+#if defined(_MSC_VER) && (_MSC_VER >= 1020)
+#pragma once      // MS compatible compilers support #pragma once
+#endif
+
+#include <boost/spirit/home/support/detail/lexer/char_traits.hpp>
+#include <boost/spirit/home/support/detail/lexer/consts.hpp>
+#include <boost/spirit/home/support/detail/lexer/size_t.hpp>
+#include <boost/spirit/home/support/detail/lexer/state_machine.hpp>
+#include <boost/algorithm/string.hpp>
+
+///////////////////////////////////////////////////////////////////////////////
+namespace boost { namespace spirit { namespace lex { namespace lexertl 
+{
+    namespace detail
+    { 
+    ///////////////////////////////////////////////////////////////////////////
+    // Generate a table of the names of the used lexer states, which is a bit 
+    // tricky, because the table stored with the rules is sorted based on the 
+    // names, but we need it sorted using the state ids.
+    template <typename Char>
+    inline bool 
+    generate_cpp_state_names (boost::lexer::basic_rules<Char> const& rules_
+      , std::ostream &os_, char const* name_suffix = "")
+    {
+        // we need to re-sort the state names in ascending order if the state 
+        // ids, filling possible gaps in between later
+        typedef typename 
+            boost::lexer::basic_rules<Char>::string_size_t_map::const_iterator
+        state_iterator;
+        typedef std::map<std::size_t, char const*> reverse_state_map_type;
+
+        reverse_state_map_type reverse_state_map;
+        state_iterator send = rules_.statemap().end();
+        for (state_iterator sit = rules_.statemap().begin(); sit != send; ++sit)
+        {
+            typedef typename reverse_state_map_type::value_type value_type;
+            reverse_state_map.insert(value_type((*sit).second, (*sit).first.c_str()));
+        }
+
+        os_ << "// this table defines the names of the lexer states\n";
+        os_ << "char const* const lexer_state_names" << name_suffix 
+            << "[" << rules_.statemap().size() << "] = \n{\n";
+
+        typedef typename reverse_state_map_type::iterator iterator;
+        iterator rend = reverse_state_map.end();
+        std::size_t last_id = 0;
+        for (iterator rit = reverse_state_map.begin(); rit != rend; ++rit)
+        {
+            for (/**/; last_id < (*rit).first; ++last_id)
+            {
+                os_ << "    0,  // \"<undefined state>\"\n";
+            }
+            os_ << "    \"" << (*rit).second << "\",\n";
+        }
+        os_ << "};\n\n";
+
+        return true;
+    }
+
+    ///////////////////////////////////////////////////////////////////////////
+    // Generate a tokenizer for the given state machine.
+    template <typename Char>
+    inline bool 
+    generate_cpp (boost::lexer::basic_state_machine<Char> const& sm_
+      , boost::lexer::basic_rules<Char> const& rules_
+      , std::ostream &os_, char const* name_suffix = ""
+      , bool skip_on_nomatch = true, bool optimize_parameters = true)
+    {
+        if (sm_.data()._lookup->empty())
+            return false;
+            
+        std::size_t const dfas_ = sm_.data()._dfa->size();
+        std::size_t const lookups_ = sm_.data()._lookup->front()->size();
+
+        os_ << "// Copyright (c) 2008-2009 Ben Hanson\n";
+        os_ << "// Copyright (c) 2008-2009 Hartmut Kaiser\n";
+        os_ << "//\n";
+        os_ << "// Distributed under the Boost Software License, "
+            "Version 1.0. (See accompanying\n";
+        os_ << "// file licence_1_0.txt or copy at "
+            "http://www.boost.org/LICENSE_1_0.txt)\n\n";
+        os_ << "// Auto-generated by boost::lexer, do not edit\n\n";
+
+        std::string guard(__DATE__ "_" __TIME__);
+        std::string::size_type p = guard.find_first_of(": ");
+        while (std::string::npos != p) 
+        {
+            guard.replace(p, 1, "_");
+            p = guard.find_first_of(": ", p);
+        }
+        boost::to_upper(guard);
+
+        os_ << "#if !defined(BOOST_SPIRIT_LEXER_NEXT_TOKEN_" << guard << ")\n";
+        os_ << "#define BOOST_SPIRIT_LEXER_NEXT_TOKEN_" << guard << "\n\n";
+
+        os_ << "#include <boost/detail/iterator.hpp>\n";
+        os_ << "#include <boost/spirit/home/support/detail/lexer/char_traits.hpp>\n\n";
+
+        os_ << "// the generated table of state names and the tokenizer have to be\n"
+               "// defined in the boost::spirit::lex::static namespace\n";
+        os_ << "namespace boost { namespace spirit { namespace lex { "
+            "namespace lexertl { namespace static_ {\n\n";
+
+        // generate the table containing state names 
+        if (!generate_cpp_state_names(rules_, os_, name_suffix))
+            return false;
+
+        os_ << "template<typename Iterator>\n";
+        os_ << "std::size_t next_token" << name_suffix  << " (";
+
+        if (dfas_ > 1 || !optimize_parameters)
+        {
+            os_ << "std::size_t &start_state_, ";
+        }
+
+        if (sm_.data()._seen_BOL_assertion || !optimize_parameters)
+        {
+            os_ << "Iterator const& start_, ";
+        }
+
+        if (dfas_ > 1 || sm_.data()._seen_BOL_assertion || !optimize_parameters)
+        {
+            os_ << "\n    ";
+        }
+
+        os_ << "Iterator &start_token_, Iterator const& end_)\n";
+        os_ << "{\n";
+        os_ << "    enum {end_state_index, id_index, state_index, bol_index, "
+          "eol_index,\n";
+        os_ << "        dead_state_index, dfa_offset};\n";
+        os_ << "    static const std::size_t npos = static_cast"
+          "<std::size_t>(~0);\n";
+
+        if (dfas_ > 1)
+        {
+            for (std::size_t state_ = 0; state_ < dfas_; ++state_)
+            {
+                std::size_t i_ = 0;
+                std::size_t j_ = 1;
+                std::size_t count_ = lookups_ / 8;
+                std::size_t const* lookup_ = &sm_.data()._lookup[state_]->front();
+                std::size_t const* dfa_ = &sm_.data()._dfa[state_]->front();
+
+                os_ << "    static const std::size_t lookup" << state_ 
+                    << "_[" << lookups_ << "] = {";
+
+                for (/**/; i_ < count_; ++i_)
+                {
+                    const std::size_t index_ = i_ * 8;
+
+                    os_ << lookup_[index_];
+
+                    for (; j_ < 8; ++j_)
+                    {
+                        os_ << ", " << lookup_[index_ + j_];
+                    }
+
+                    if (i_ < count_ - 1)
+                    {
+                        os_ << "," << std::endl << "        ";
+                    }
+
+                    j_ = 1;
+                }
+
+                os_ << "};\n";
+                count_ = sm_.data()._dfa[state_]->size ();
+                os_ << "    static const std::size_t dfa" << state_ << "_[" <<
+                    count_ << "] = {";
+                count_ /= 8;
+
+                for (i_ = 0; i_ < count_; ++i_)
+                {
+                    const std::size_t index_ = i_ * 8;
+
+                    os_ << dfa_[index_];
+
+                    for (j_ = 1; j_ < 8; ++j_)
+                    {
+                        os_ << ", " << dfa_[index_ + j_];
+                    }
+
+                    if (i_ < count_ - 1)
+                    {
+                        os_ << "," << std::endl << "        ";
+                    }
+                }
+
+                std::size_t const mod_ = sm_.data()._dfa[state_]->size () % 8;
+                if (mod_)
+                {
+                    const std::size_t index_ = count_ * 8;
+
+                    if (count_)
+                    {
+                        os_ << ",\n        ";
+                    }
+
+                    os_ << dfa_[index_];
+
+                    for (j_ = 1; j_ < mod_; ++j_)
+                    {
+                        os_ << ", " << dfa_[index_ + j_];
+                    }
+                }
+
+                os_ << "};\n";
+            }
+
+            std::size_t count_ = sm_.data()._dfa_alphabet.size();
+            std::size_t i_ = 1;
+
+            os_ << "    static const std::size_t *lookup_arr_[" << count_ <<
+                "] = {";
+
+            os_ << "lookup0_";
+
+            for (i_ = 1; i_ < count_; ++i_)
+            {
+                os_ << ", " << "lookup" << i_ << "_";
+            }
+
+            os_ << "};\n";
+            os_ << "    static const std::size_t dfa_alphabet_arr_[" << 
+                count_ << "] = {";
+
+            os_ << sm_.data()._dfa_alphabet.front ();
+
+            for (i_ = 1; i_ < count_; ++i_)
+            {
+                os_ << ", " << sm_.data()._dfa_alphabet[i_];
+            }
+
+            os_ << "};\n";
+            os_ << "    static const std::size_t *dfa_arr_[" << count_ <<
+                "] = {";
+            os_ << "dfa0_";
+
+            for (i_ = 1; i_ < count_; ++i_)
+            {
+                os_ << ", " << "dfa" << i_ << "_";
+            }
+
+            os_ << "};\n";
+        }
+        else
+        {
+            std::size_t const* lookup_ = &sm_.data()._lookup[0]->front();
+            std::size_t const* dfa_ = &sm_.data()._dfa[0]->front();
+            std::size_t i_ = 0;
+            std::size_t j_ = 1;
+            std::size_t count_ = lookups_ / 8;
+
+            os_ << "    static const std::size_t lookup_[";
+            os_ << sm_.data()._lookup[0]->size() << "] = {";
+
+            for (; i_ < count_; ++i_)
+            {
+                const std::size_t index_ = i_ * 8;
+
+                os_ << lookup_[index_];
+
+                for (; j_ < 8; ++j_)
+                {
+                    os_ << ", " << lookup_[index_ + j_];
+                }
+
+                if (i_ < count_ - 1)
+                {
+                    os_ << "," << std::endl << "        ";
+                }
+
+                j_ = 1;
+            }
+
+            os_ << "};\n";
+            os_ << "    static const std::size_t dfa_alphabet_ = " <<
+              sm_.data()._dfa_alphabet.front () << ";\n";
+            os_ << "    static const std::size_t dfa_[" <<
+              sm_.data()._dfa[0]->size () << "] = {";
+                count_ = sm_.data()._dfa[0]->size () / 8;
+
+            for (i_ = 0; i_ < count_; ++i_)
+            {
+                const std::size_t index_ = i_ * 8;
+
+                os_ << dfa_[index_];
+
+                for (j_ = 1; j_ < 8; ++j_)
+                {
+                    os_ << ", " << dfa_[index_ + j_];
+                }
+
+                if (i_ < count_ - 1)
+                {
+                    os_ << "," << std::endl << "        ";
+                }
+            }
+
+            const std::size_t mod_ = sm_.data()._dfa[0]->size () % 8;
+
+            if (mod_)
+            {
+                const std::size_t index_ = count_ * 8;
+
+                if (count_)
+                {
+                    os_ << ",\n        ";
+                }
+
+                os_ << dfa_[index_];
+
+                for (j_ = 1; j_ < mod_; ++j_)
+                {
+                    os_ << ", " << dfa_[index_ + j_];
+                }
+            }
+
+            os_ << "};\n";
+        }
+
+        os_ << "\n    if (start_token_ == end_) return 0;\n\n";
+
+        if (dfas_ > 1)
+        {
+            os_ << "again:\n";
+            os_ << "    const std::size_t * lookup_ = lookup_arr_[start_state_];\n";
+            os_ << "    std::size_t dfa_alphabet_ = dfa_alphabet_arr_[start_state_];\n";
+            os_ << "    const std::size_t *dfa_ = dfa_arr_[start_state_];\n";
+        }
+
+        os_ << "    const std::size_t *ptr_ = dfa_ + dfa_alphabet_;\n";
+        os_ << "    Iterator curr_ = start_token_;\n";
+        os_ << "    bool end_state_ = *ptr_ != 0;\n";
+        os_ << "    std::size_t id_ = *(ptr_ + id_index);\n";
+        os_ << "    Iterator end_token_ = start_token_;\n";
+        os_ << '\n';
+        os_ << "    while (curr_ != end_)\n";
+        os_ << "    {\n";
+
+        if (sm_.data()._seen_BOL_assertion)
+        {
+            os_ << "        std::size_t const BOL_state_ = ptr_[bol_index];\n";
+        }
+
+        if (sm_.data()._seen_EOL_assertion)
+        {
+            os_ << "        std::size_t const EOL_state_ = ptr_[eol_index];\n";
+        }
+
+        if (sm_.data()._seen_BOL_assertion || sm_.data()._seen_EOL_assertion)
+        {
+            os_ << '\n';
+        }
+
+        if (sm_.data()._seen_BOL_assertion && sm_.data()._seen_EOL_assertion)
+        {
+            os_ << "        if (BOL_state_ && (start_token_ == start_ ||\n";
+            os_ << "            *(start_token_ - 1) == '\\n'))\n";
+            os_ << "        {\n";
+            os_ << "            ptr_ = &dfa_[BOL_state_ * dfa_alphabet_];\n";
+            os_ << "        }\n";
+            os_ << "        else if (EOL_state_ && *curr_ == '\\n')\n";
+            os_ << "        {\n";
+            os_ << "            ptr_ = &dfa_[EOL_state_ * dfa_alphabet_];\n";
+            os_ << "        }\n";
+            os_ << "        else\n";
+            os_ << "        {\n";
+            os_ << "            std::size_t const state_ =\n";
+
+            if (lookups_ == 256)
+            {
+                os_ << "                ptr_[lookup_[<typename Traits::index_type>"
+                    "(*curr_++)]];\n";
+            }
+            else
+            {
+                os_ << "                ptr_[lookup_[*curr_++]];\n";
+            }
+
+            os_ << '\n';
+            os_ << "            if (state_ == 0) break;\n";
+            os_ << '\n';
+            os_ << "            ptr_ = &dfa_[state_ * dfa_alphabet_];\n";
+            os_ << "        }\n";
+        }
+        else if (sm_.data()._seen_BOL_assertion)
+        {
+            os_ << "        if (BOL_state_ && (start_token_ == start_ ||\n";
+            os_ << "            *(start_token_ - 1) == '\\n'))\n";
+            os_ << "        {\n";
+            os_ << "            ptr_ = &dfa_[BOL_state_ * dfa_alphabet_];\n";
+            os_ << "        }\n";
+            os_ << "        else\n";
+            os_ << "        {\n";
+            os_ << "            std::size_t const state_ =\n";
+
+            if (lookups_ == 256)
+            {
+                os_ << "                ptr_[lookup_[static_cast<unsigned char>\n";
+                os_ << "                (*curr_++)]];\n";
+            }
+            else
+            {
+                os_ << "                ptr_[lookup_[*curr_++]];\n";
+            }
+
+            os_ << '\n';
+            os_ << "            if (state_ == 0) break;\n";
+            os_ << '\n';
+            os_ << "            ptr_ = &dfa_[state_ * dfa_alphabet_];\n";
+            os_ << "        }\n";
+        }
+        else if (sm_.data()._seen_EOL_assertion)
+        {
+            os_ << "        if (EOL_state_ && *curr_ == '\\n')\n";
+            os_ << "        {\n";
+            os_ << "            ptr_ = &dfa_[EOL_state_ * dfa_alphabet_];\n";
+            os_ << "        }\n";
+            os_ << "        else\n";
+            os_ << "        {\n";
+            os_ << "            std::size_t const state_ =\n";
+
+            if (lookups_ == 256)
+            {
+                os_ << "                ptr_[lookup_[static_cast<unsigned char>\n";
+                os_ << "                    (*curr_++)]];\n";
+            }
+            else
+            {
+                os_ << "                ptr_[lookup_[*curr_++]];\n";
+            }
+
+            os_ << '\n';
+            os_ << "            if (state_ == 0) break;\n";
+            os_ << '\n';
+            os_ << "            ptr_ = &dfa_[state_ * dfa_alphabet_];\n";
+            os_ << "        }\n";
+        }
+        else
+        {
+            os_ << "        std::size_t const state_ =\n";
+
+            if (lookups_ == 256)
+            {
+                os_ << "            ptr_[lookup_[static_cast<unsigned char>\n";
+                os_ << "                (*curr_++)]];\n";
+            }
+            else
+            {
+                os_ << "            ptr_[lookup_[*curr_++]];\n";
+            }
+
+            os_ << '\n';
+            os_ << "        if (state_ == 0) break;\n";
+            os_ << '\n';
+            os_ << "        ptr_ = &dfa_[state_ * dfa_alphabet_];\n";
+        }
+
+        os_ << '\n';
+        os_ << "        if (*ptr_)\n";
+        os_ << "        {\n";
+        os_ << "            end_state_ = true;\n";
+        os_ << "            id_ = *(ptr_ + id_index);\n";
+
+        if (dfas_ > 1)
+        {
+            os_ << "            start_state_ = *(ptr_ + state_index);\n";
+        }
+
+        os_ << "            end_token_ = curr_;\n";
+        os_ << "        }\n";
+        os_ << "    }\n";
+        os_ << '\n';
+
+        if (sm_.data()._seen_EOL_assertion)
+        {
+            os_ << "    const std::size_t EOL_state_ = ptr_[eol_index];\n";
+            os_ << '\n';
+            os_ << "    if (EOL_state_ && curr_ == end_)\n";
+            os_ << "    {\n";
+            os_ << "        ptr_ = &dfa_[EOL_state_ * dfa_alphabet_];\n";
+            os_ << '\n';
+            os_ << "        if (*ptr_)\n";
+            os_ << "        {\n";
+            os_ << "            end_state_ = true;\n";
+            os_ << "            id_ = *(ptr_ + id_index);\n";
+
+            if (dfas_ > 1)
+            {
+                os_ << "            start_state_ = *(ptr_ + state_index);\n";
+            }
+
+            os_ << "            end_token_ = curr_;\n";
+            os_ << "        }\n";
+            os_ << "    }\n";
+            os_ << '\n';
+        }
+
+        os_ << "    if (end_state_)\n";
+        os_ << "    {\n";
+        os_ << "        // return longest match\n";
+        os_ << "        start_token_ = end_token_;\n";
+
+        if (dfas_ > 1)
+        {
+            os_ << '\n';
+            os_ << "        if (id_ == 0) goto again;\n";
+        }
+
+        os_ << "    }\n";
+        os_ << "    else\n";
+        os_ << "    {\n";
+
+        if (skip_on_nomatch)
+        {
+            os_ << "        // No match causes char to be skipped\n";
+            os_ << "        ++start_token_;\n";
+        }
+
+        os_ << "        id_ = npos;\n";
+        os_ << "    }\n";
+        os_ << '\n';
+        os_ << "    return id_;\n";
+        os_ << "}\n\n";
+
+        os_ << "}}}}}  // namespace boost::spirit::lex::lexertl::static_\n\n";
+
+        os_ << "#endif\n";
+
+        return os_.good();
+    }
+
+    }   // namespace detail
+
+    ///////////////////////////////////////////////////////////////////////////
+    template <typename Lexer>
+    inline bool 
+    generate_static(Lexer const& lexer, std::ostream& os
+      , char const* name_suffix = "")
+    {
+        if (!lexer.init_dfa())
+            return false;
+        return detail::generate_cpp(lexer.state_machine, lexer.rules, os
+          , name_suffix, false, false);
+    }
+
+///////////////////////////////////////////////////////////////////////////////
+}}}}
+
+#endif
Added: trunk/boost/spirit/home/lex/lexer/lexertl/iterator.hpp
==============================================================================
--- (empty file)
+++ trunk/boost/spirit/home/lex/lexer/lexertl/iterator.hpp	2009-04-26 10:42:24 EDT (Sun, 26 Apr 2009)
@@ -0,0 +1,105 @@
+//  Copyright (c) 2001-2009 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_LEX_LEXER_ITERATOR_MAR_16_2007_0353PM)
+#define BOOST_SPIRIT_LEX_LEXER_ITERATOR_MAR_16_2007_0353PM
+
+#if defined(_MSC_VER) && (_MSC_VER >= 1020)
+#pragma once      // MS compatible compilers support #pragma once
+#endif
+
+#if defined(BOOST_SPIRIT_DEBUG)
+#include <boost/spirit/home/support/iterators/detail/buf_id_check_policy.hpp>
+#else
+#include <boost/spirit/home/support/iterators/detail/no_check_policy.hpp>
+#endif
+#include <boost/spirit/home/support/iterators/detail/split_functor_input_policy.hpp>
+#include <boost/spirit/home/support/iterators/detail/ref_counted_policy.hpp>
+#include <boost/spirit/home/support/iterators/detail/split_std_deque_policy.hpp>
+#include <boost/spirit/home/support/iterators/multi_pass.hpp>
+
+namespace boost { namespace spirit { namespace lex { namespace lexertl
+{ 
+    ///////////////////////////////////////////////////////////////////////////
+    template <typename FunctorData>
+    struct make_multi_pass
+    {
+        // Divide the given functor type into its components (unique and 
+        // shared) and build a std::pair from these parts
+        typedef std::pair<typename FunctorData::unique
+          , typename FunctorData::shared> functor_data_type;
+
+        // This is the result type returned from the iterator
+        typedef typename FunctorData::result_type result_type;
+
+        // Compose the multi_pass iterator policy type from the appropriate 
+        // policies
+        typedef multi_pass_policies::split_functor_input input_policy;
+        typedef multi_pass_policies::ref_counted ownership_policy;
+#if defined(BOOST_SPIRIT_DEBUG)
+        typedef multi_pass_policies::buf_id_check check_policy;
+#else
+        typedef multi_pass_policies::no_check check_policy;
+#endif
+        typedef multi_pass_policies::split_std_deque storage_policy;
+
+        typedef multi_pass_policies::default_policy<
+                ownership_policy, check_policy, input_policy, storage_policy>
+            policy_type;
+
+        // Compose the multi_pass iterator from the policy
+        typedef spirit::multi_pass<functor_data_type, policy_type> type;
+    };
+
+    ///////////////////////////////////////////////////////////////////////////
+    //  lexer_iterator exposes an iterator for a lexertl based dfa (lexer) 
+    //  The template parameters have the same semantics as described for the
+    //  functor above.
+    ///////////////////////////////////////////////////////////////////////////
+    template <typename Functor>
+    class iterator : public make_multi_pass<Functor>::type
+    {
+    public:
+        typedef typename Functor::unique unique_functor_type;
+        typedef typename Functor::shared shared_functor_type;
+
+        typedef typename Functor::iterator_type base_iterator_type;
+        typedef typename Functor::result_type token_type;
+
+    private:
+        typedef typename make_multi_pass<Functor>::functor_data_type 
+            functor_type;
+        typedef typename make_multi_pass<Functor>::type base_type;
+        typedef typename Functor::char_type char_type;
+
+    public:
+        // create a new iterator encapsulating the lexer object to be used
+        // for tokenization
+        template <typename IteratorData>
+        iterator(IteratorData const& iterdata_, base_iterator_type& first
+              , base_iterator_type const& last)
+          : base_type(functor_type(unique_functor_type()
+              , shared_functor_type(iterdata_, first, last))) {}
+
+        // create an end iterator usable for end of range checking
+        iterator() {}
+
+        // set the new required state for the underlying lexer object
+        std::size_t set_state(std::size_t state)
+        {
+            return unique_functor_type::set_state(*this, state);
+        }
+
+        // map the given state name to a corresponding state id as understood
+        // by the underlying lexer object
+        std::size_t map_state(char_type const* statename)
+        {
+            return unique_functor_type::map_state(*this, statename);
+        }
+    };
+
+}}}}
+
+#endif
Modified: trunk/boost/spirit/home/lex/lexer/lexertl/iterator_tokenizer.hpp
==============================================================================
--- trunk/boost/spirit/home/lex/lexer/lexertl/iterator_tokenizer.hpp	(original)
+++ trunk/boost/spirit/home/lex/lexer/lexertl/iterator_tokenizer.hpp	2009-04-26 10:42:24 EDT (Sun, 26 Apr 2009)
@@ -13,16 +13,16 @@
 #include <boost/spirit/home/support/detail/lexer/char_traits.hpp>
 #include <vector>
 
-namespace boost { namespace spirit { namespace lex 
+namespace boost { namespace spirit { namespace lex { namespace lexertl
 { 
+    ///////////////////////////////////////////////////////////////////////////
     template<typename Iterator>
     class basic_iterator_tokeniser
     {
     public:
         typedef std::vector<std::size_t> size_t_vector;
-        typedef 
-            typename boost::detail::iterator_traits<Iterator>::value_type 
-        char_type;
+        typedef typename boost::detail::iterator_traits<Iterator>::value_type 
+            char_type;
 
 //         static std::size_t next (const std::size_t * const lookup_,
 //             std::size_t const dfa_alphabet_, const std::size_t *  const dfa_,
@@ -97,9 +97,9 @@
 //         }
 
         static std::size_t next (
-            boost::lexer::basic_state_machine<char_type> const& state_machine_,
-            std::size_t &dfa_state_, Iterator const& start_,
-            Iterator &start_token_, Iterator const& end_)
+            boost::lexer::basic_state_machine<char_type> const& state_machine_
+          , std::size_t &dfa_state_, Iterator const& start_
+          , Iterator &start_token_, Iterator const& end_)
         {
             if (start_token_ == end_) return 0;
 
@@ -136,7 +136,7 @@
                     typedef typename 
                         boost::lexer::char_traits<value_type>::index_type 
                     index_type;
-                    
+
                     index_type index = 
                         boost::lexer::char_traits<value_type>::call(*curr_++);
                     std::size_t const state_ = ptr_[
@@ -184,15 +184,14 @@
             else {
                 id_ = boost::lexer::npos;
             }
-            
+
             return id_;
         }
 
         ///////////////////////////////////////////////////////////////////////
-        static 
-        std::size_t next (
-            boost::lexer::basic_state_machine<char_type> const& state_machine_,
-            Iterator const& start_, Iterator &start_token_, Iterator const& end_)
+        static std::size_t next (
+            boost::lexer::basic_state_machine<char_type> const& state_machine_
+          , Iterator const& start_, Iterator &start_token_, Iterator const& end_)
         {
             if (start_token_ == end_) return 0;
 
@@ -270,7 +269,7 @@
             else {
                 id_ = boost::lexer::npos;
             }
-            
+
             return id_;
         }
     };
@@ -279,6 +278,6 @@
     typedef basic_iterator_tokeniser<char const *> tokeniser;
     typedef basic_iterator_tokeniser<wchar_t const *> wtokeniser;
 
-}}}
+}}}}
 
 #endif
Added: trunk/boost/spirit/home/lex/lexer/lexertl/lexer.hpp
==============================================================================
--- (empty file)
+++ trunk/boost/spirit/home/lex/lexer/lexertl/lexer.hpp	2009-04-26 10:42:24 EDT (Sun, 26 Apr 2009)
@@ -0,0 +1,393 @@
+//  Copyright (c) 2001-2009 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_LEX_LEXER_MAR_17_2007_0139PM)
+#define BOOST_SPIRIT_LEX_LEXER_MAR_17_2007_0139PM
+
+#if defined(_MSC_VER) && (_MSC_VER >= 1020)
+#pragma once      // MS compatible compilers support #pragma once
+#endif
+
+#include <iosfwd>
+
+#include <boost/spirit/home/support/safe_bool.hpp>
+#include <boost/spirit/home/support/detail/lexer/generator.hpp>
+#include <boost/spirit/home/support/detail/lexer/rules.hpp>
+#include <boost/spirit/home/support/detail/lexer/consts.hpp>
+#include <boost/spirit/home/support/unused.hpp>
+
+#include <boost/spirit/home/lex/lexer/lexertl/token.hpp>
+#include <boost/spirit/home/lex/lexer/lexertl/functor.hpp>
+#include <boost/spirit/home/lex/lexer/lexertl/iterator.hpp>
+#if defined(BOOST_SPIRIT_LEXERTL_DEBUG)
+#include <boost/spirit/home/support/detail/lexer/debug.hpp>
+#endif
+
+namespace boost { namespace spirit { namespace lex { namespace lexertl
+{ 
+    ///////////////////////////////////////////////////////////////////////////
+    namespace detail
+    {
+        ///////////////////////////////////////////////////////////////////////
+        //  The must_escape function checks if the given character value needs
+        //  to be preceded by a backslash character to disable its special 
+        //  meaning in the context of a regular expression
+        ///////////////////////////////////////////////////////////////////////
+        template <typename Char>
+        inline bool must_escape(Char c)
+        {
+            // FIXME: more needed?
+            switch (c) {
+            case '+': case '/': case '*': case '?':
+            case '|':
+            case '(': case ')':
+            case '[': case ']':
+            case '{': case '}':
+            case '.':
+            case '^': case '$':
+            case '\\':
+            case '"':
+                return true;
+
+            default:
+                break;
+            }
+            return false;
+        }
+
+        ///////////////////////////////////////////////////////////////////////
+        //  The escape function returns the string representation of the given 
+        //  character value, possibly escaped with a backslash character, to 
+        //  allow it being safely used in a regular expression definition.
+        ///////////////////////////////////////////////////////////////////////
+        template <typename Char>
+        inline std::basic_string<Char> escape(Char ch) 
+        { 
+            std::basic_string<Char> result(1, ch);
+            if (detail::must_escape(ch)) 
+            {
+                typedef typename std::basic_string<Char>::size_type size_type;
+                result.insert((size_type)0, 1, '\\');
+            }
+            return result;
+        }
+    }
+
+    ///////////////////////////////////////////////////////////////////////////
+    //  token_set
+    ///////////////////////////////////////////////////////////////////////////
+    template <typename Token, typename Iterator = typename Token::iterator_type>
+    class token_set
+    {
+    protected:
+        typedef typename boost::detail::iterator_traits<Iterator>::value_type 
+            char_type;
+        typedef std::basic_string<char_type> string_type;
+
+    public:
+        typedef Token token_type;
+        typedef typename Token::id_type id_type;
+
+        // interface for token definition management
+        void add_token (char_type const* state, char_type tokendef
+          , std::size_t token_id)
+        {
+            rules.add(state, detail::escape(tokendef), token_id, state);
+        }
+
+        void add_token (char_type const* state, string_type const& tokendef
+          , std::size_t token_id)
+        {
+            rules.add(state, tokendef, token_id, state);
+        }
+
+        // interface for pattern definition management
+        void add_pattern (char_type const* state, string_type const& name
+          , string_type const& patterndef)
+        {
+            add_state(state);
+            rules.add_macro(name.c_str(), patterndef);
+        }
+
+        boost::lexer::rules const& get_rules() const { return rules; }
+
+        void clear() { rules.clear(); }
+
+        std::size_t add_state(char_type const* state)
+        {
+            rules.add_state(state);
+            return rules.state(state);
+        }
+        string_type initial_state() const 
+        { 
+            return string_type(rules.initial());
+        }
+
+    private:
+        boost::lexer::basic_rules<char_type> rules;
+    };
+
+    ///////////////////////////////////////////////////////////////////////////
+    template <typename Lexer>
+    bool generate_static(Lexer const& lex, std::ostream& os, char const* name);
+
+    ///////////////////////////////////////////////////////////////////////////
+    //
+    //  Every lexer type to be used as a lexer for Spirit has to conform to 
+    //  the following public interface:
+    //
+    //    typedefs: 
+    //        iterator_type   The type of the iterator exposed by this lexer.
+    //        token_type      The type of the tokens returned from the exposed 
+    //                        iterators.
+    //        token_set       The type of the token set representing a lexer 
+    //                        state.
+    //
+    //    functions:
+    //        default constructor
+    //                        Since lexers are instantiated as base classes 
+    //                        only it might be a good idea to make this 
+    //                        constructor protected.
+    //        begin, end      Return a pair of iterators, when dereferenced
+    //                        returning the sequence of tokens recognized in 
+    //                        the input stream given as the parameters to the 
+    //                        begin() function.
+    //        add_token       Should add the definition of a token to be 
+    //                        recognized by this lexer.
+    //        clear           Should delete all current token definitions
+    //                        associated with the given state of this lexer 
+    //                        object.
+    //
+    //    template parameters:
+    //        Iterator        The type of the iterator used to access the
+    //                        underlying character stream.
+    //        Token           The type of the tokens to be returned from the
+    //                        exposed token iterator.
+    //        Functor         The type of the InputPolicy to use to instantiate
+    //                        the multi_pass iterator type to be used as the 
+    //                        token iterator (returned from begin()/end()).
+    //        TokenSet        The type of the token set to use in conjunction 
+    //                        with this lexer type. This is used for the 
+    //                        token_set typedef described above only.
+    //
+    ///////////////////////////////////////////////////////////////////////////
+
+    ///////////////////////////////////////////////////////////////////////////
+    //
+    //  The lexer class is a implementation of a Spirit.Lex lexer on 
+    //  top of Ben Hanson's lexertl library as outlined above (For more 
+    //  information about lexertl go here: http://www.benhanson.net/lexertl.html).
+    //
+    //  This class is supposed to be used as the first and only template 
+    //  parameter while instantiating instances of a lex::lexer class.
+    //
+    ///////////////////////////////////////////////////////////////////////////
+    template <typename Token = token<>
+      , typename Iterator = typename Token::iterator_type
+      , typename Functor = functor<Token, Iterator, mpl::false_>
+      , typename TokenSet = lex::token_set<token_set<Token, Iterator> > >
+    class lexer 
+    {
+    public:
+        // operator_bool() is needed for the safe_bool base class
+        operator typename safe_bool<lexer>::result_type() const 
+        { 
+            return safe_bool<lexer>()(initialized_dfa); 
+        }
+
+        typedef typename boost::detail::iterator_traits<Iterator>::value_type 
+            char_type;
+        typedef std::basic_string<char_type> string_type;
+
+        //  Every lexer type to be used as a lexer for Spirit has to conform to 
+        //  a public interface .
+        typedef Token token_type;
+        typedef typename Token::id_type id_type;
+        typedef TokenSet token_set;
+        typedef iterator<Functor> iterator_type;
+
+    private:
+        // this type is purely used for the iterator_type construction below
+        struct iterator_data_type 
+        {
+            boost::lexer::basic_state_machine<char_type> const& state_machine_;
+            boost::lexer::basic_rules<char_type> const& rules_;
+            typename Functor::semantic_actions_type const& actions_;
+        };
+
+    public:
+        //  Return the start iterator usable for iterating over the generated
+        //  tokens.
+        iterator_type begin(Iterator& first, Iterator const& last) const
+        { 
+            if (!init_dfa())
+                return iterator_type();
+
+            iterator_data_type iterator_data = { state_machine, rules, actions };
+            return iterator_type(iterator_data, first, last);
+        }
+
+        //  Return the end iterator usable to stop iterating over the generated 
+        //  tokens.
+        iterator_type end() const
+        { 
+            return iterator_type(); 
+        }
+
+    protected:
+        static boost::lexer::regex_flags map_flags(unsigned int flags)
+        {
+            unsigned int retval = boost::lexer::none;
+            if (flags & match_flags::match_not_dot_newline)
+                retval |= boost::lexer::dot_not_newline;
+            if (flags & match_flags::match_icase)
+                retval |= boost::lexer::icase;
+
+            return boost::lexer::regex_flags(retval);
+        }
+
+        //  Lexer instances can be created by means of a derived class only.
+        lexer(unsigned int flags_) 
+          : initialized_dfa(false), flags(map_flags(flags_)) 
+        {
+            rules.flags(flags);
+        }
+
+    public:
+        // interface for token definition management
+        void add_token (char_type const* state, char_type tokendef, 
+            std::size_t token_id)
+        {
+            add_state(state);
+            rules.add(state, detail::escape(tokendef), token_id, state);
+            initialized_dfa = false;
+        }
+        void add_token (char_type const* state, string_type const& tokendef, 
+            std::size_t token_id)
+        {
+            add_state(state);
+            rules.add(state, tokendef, token_id, state);
+            initialized_dfa = false;
+        }
+        void add_token(char_type const* state, token_set const& tokset)
+        {
+            add_state(state);
+            rules.add(state, tokset.get_rules());
+            initialized_dfa = false;
+        }
+
+        // interface for pattern definition management
+        void add_pattern (char_type const* state, string_type const& name,
+            string_type const& patterndef)
+        {
+            add_state(state);
+            rules.add_macro(name.c_str(), patterndef);
+            initialized_dfa = false;
+        }
+
+        void clear(char_type const* state)
+        {
+            std::size_t s = rules.state(state);
+            if (boost::lexer::npos != s)
+                rules.clear(state);
+            initialized_dfa = false;
+        }
+        std::size_t add_state(char_type const* state)
+        {
+            std::size_t stateid = rules.state(state);
+            if (boost::lexer::npos == stateid) {
+                rules.add_state(state);
+                stateid = rules.state(state);
+                initialized_dfa = false;
+            }
+            return stateid;
+        }
+        string_type initial_state() const 
+        { 
+            return string_type(rules.initial());
+        }
+
+        //  Register a semantic action with the given id
+        template <typename F>
+        void add_action(std::size_t id, F act)
+        {
+            // If you get compilation errors below stating value_type not being
+            // a member of boost::fusion::unused_type, then you are probably
+            // using semantic actions in your token definition without 
+            // the actor_lexer being specified as the base class of your lexer
+            // (instead of the lexer class).
+            typedef typename Functor::semantic_actions_type::value_type
+                value_type;
+            typedef typename Functor::wrap_action_type wrapper_type;
+
+            actions.insert(value_type(id, wrapper_type::call(act)));
+        }
+
+        bool init_dfa() const
+        {
+            if (!initialized_dfa) {
+                state_machine.clear();
+                try {
+                    typedef boost::lexer::basic_generator<char_type> generator;
+                    generator::build (rules, state_machine);
+                    generator::minimise (state_machine);
+
+#if defined(BOOST_SPIRIT_LEXERTL_DEBUG)
+                    boost::lexer::debug::dump(state_machine, std::cerr);
+#endif
+                }
+                catch (std::runtime_error const&) {
+                    return false;
+                }
+                initialized_dfa = true;
+            }
+            return true;
+        }
+
+    private:
+        mutable boost::lexer::basic_state_machine<char_type> state_machine;
+        boost::lexer::basic_rules<char_type> rules;
+        typename Functor::semantic_actions_type actions;
+        mutable bool initialized_dfa;
+        boost::lexer::regex_flags flags;
+
+        template <typename Lexer> 
+        friend bool generate_static(Lexer const&, std::ostream&, char const*);
+    };
+
+    ///////////////////////////////////////////////////////////////////////////
+    //
+    //  The actor_lexer class is another implementation of a Spirit.Lex 
+    //  lexer on top of Ben Hanson's lexertl library as outlined above (For 
+    //  more information about lexertl go here: 
+    //  http://www.benhanson.net/lexertl.html).
+    //
+    //  The only difference to the lexer class above is that token_def
+    //  definitions may have semantic (lexer) actions attached while being 
+    //  defined:
+    //
+    //      int w;
+    //      token_def word = "[^ \t\n]+";
+    //      self = word[++ref(w)];        // see example: word_count_lexer
+    //
+    //  This class is supposed to be used as the first and only template 
+    //  parameter while instantiating instances of a lex::lexer class.
+    //
+    ///////////////////////////////////////////////////////////////////////////
+    template <typename Token = token<>
+      , typename Iterator = typename Token::iterator_type
+      , typename Functor = functor<Token, Iterator, mpl::true_>
+      , typename TokenSet = lex::token_set<token_set<Token, Iterator> > >
+    class actor_lexer : public lexer<Token, Iterator, Functor, TokenSet>
+    {
+    protected:
+        //  Lexer instances can be created by means of a derived class only.
+        actor_lexer(unsigned int flags) 
+          : lexer<Token, Iterator, Functor, TokenSet>(flags) {}
+    };
+
+}}}}
+
+#endif
Deleted: trunk/boost/spirit/home/lex/lexer/lexertl/lexertl_functor.hpp
==============================================================================
--- trunk/boost/spirit/home/lex/lexer/lexertl/lexertl_functor.hpp	2009-04-26 10:42:24 EDT (Sun, 26 Apr 2009)
+++ (empty file)
@@ -1,394 +0,0 @@
-//  Copyright (c) 2001-2009 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_LEX_LEXER_FUNCTOR_NOV_18_2007_1112PM)
-#define BOOST_SPIRIT_LEX_LEXER_FUNCTOR_NOV_18_2007_1112PM
-
-#if defined(_MSC_VER) && (_MSC_VER >= 1020)
-#pragma once      // MS compatible compilers support #pragma once
-#endif
-
-#include <boost/mpl/bool.hpp>
-#include <boost/function.hpp>
-#include <boost/range/iterator_range.hpp>
-#include <boost/detail/iterator.hpp>
-#include <boost/detail/workaround.hpp>
-#include <map>
-#include <boost/spirit/home/support/detail/lexer/generator.hpp>
-#include <boost/spirit/home/support/detail/lexer/rules.hpp>
-#include <boost/spirit/home/support/detail/lexer/state_machine.hpp>
-#include <boost/spirit/home/lex/lexer/lexertl/iterator_tokenizer.hpp>
-#include <boost/spirit/home/lex/lexer/lexertl/wrap_action.hpp>
-
-#if 0 != __COMO_VERSION__ || !BOOST_WORKAROUND(BOOST_MSVC, <= 1310)
-#define BOOST_SPIRIT_STATIC_EOF 1
-#define BOOST_SPIRIT_EOF_PREFIX static
-#else
-#define BOOST_SPIRIT_EOF_PREFIX 
-#endif
-
-namespace boost { namespace spirit { namespace lex 
-{ 
-    namespace detail
-    {
-        ///////////////////////////////////////////////////////////////////////
-        template <typename Iterator, typename HasActors, typename HasState>
-        struct Data;    // no default specialization
-        
-        ///////////////////////////////////////////////////////////////////////
-        //  doesn't support no state and no actors
-        template <typename Iterator>
-        struct Data<Iterator, mpl::false_, mpl::false_>
-        {
-            typedef std::size_t state_type;
-            typedef iterator_range<Iterator> iterpair_type;
-            typedef typename 
-                boost::detail::iterator_traits<Iterator>::value_type 
-            char_type;
-
-            typedef unused_type semantic_actions_type;
-
-            typedef 
-                detail::wrap_action<unused_type, iterpair_type, Data>
-            wrap_action_type;
-
-            // initialize the shared data 
-            template <typename IterData>
-            Data (IterData const& data_, Iterator& first_, Iterator const& last_)
-              : state_machine(data_.state_machine_),
-                rules(data_.rules_), 
-                first(first_), last(last_)
-            {}
-
-            std::size_t next(Iterator& end)
-            {
-                typedef basic_iterator_tokeniser<Iterator> tokenizer;
-                return tokenizer::next(state_machine, first, end, last);
-            }
-
-            // nothing to invoke, so this is empty
-            bool invoke_actions(std::size_t, Iterator const&) 
-            {
-                return true;    // always accept
-            }
-
-            std::size_t get_state() const { return 0; }
-            void set_state_name (char_type const* state) {}
-
-            boost::lexer::basic_state_machine<char_type> const& state_machine;
-            boost::lexer::basic_rules<char_type> const& rules;
-            Iterator& first;
-            Iterator last;
-        };
-        
-        ///////////////////////////////////////////////////////////////////////
-        //  doesn't support actors
-        template <typename Iterator>
-        struct Data<Iterator, mpl::false_, mpl::true_>
-          : Data<Iterator, mpl::false_, mpl::false_>
-        {
-            typedef Data<Iterator, mpl::false_, mpl::false_> base_type;
-
-            typedef typename base_type::state_type state_type;
-            typedef typename base_type::char_type char_type;
-            typedef 
-                typename base_type::semantic_actions_type 
-            semantic_actions_type;
-            
-            // initialize the shared data 
-            template <typename IterData>
-            Data (IterData const& data_, Iterator& first_, Iterator const& last_)
-              : base_type(data_, first_, last_), state(0)
-            {}
-
-            std::size_t next(Iterator& end)
-            {
-                typedef basic_iterator_tokeniser<Iterator> tokenizer;
-                return tokenizer::next(this->state_machine, state, 
-                    this->first, end, this->last);
-            }
-
-            std::size_t& get_state() { return state; }
-            void set_state_name (char_type const* new_state) 
-            { 
-                std::size_t state_id = this->rules.state(new_state);
-                
-                // if the following assertion fires you've probably been using 
-                // a lexer state name which was not defined in your token 
-                // definition
-                BOOST_ASSERT(state_id != boost::lexer::npos);
-
-                if (state_id != boost::lexer::npos)
-                    state = state_id;
-            }
-
-            std::size_t state;
-        };
-        
-        ///////////////////////////////////////////////////////////////////////
-        //  does support actors, but may have no state
-        template <typename Iterator, typename HasState>
-        struct Data<Iterator, mpl::true_, HasState> 
-          : Data<Iterator, mpl::false_, HasState>
-        {
-            typedef Data<Iterator, mpl::false_, HasState> base_type;
-            
-            typedef iterator_range<Iterator> iterpair_type;
-            typedef typename base_type::state_type state_type;
-            typedef typename base_type::char_type char_type;
-
-            typedef void functor_type(iterpair_type, std::size_t, bool&, Data&);
-            typedef boost::function<functor_type> functor_wrapper_type;
-            typedef std::multimap<std::size_t, functor_wrapper_type> 
-                semantic_actions_type;
-
-            typedef 
-                detail::wrap_action<functor_wrapper_type, iterpair_type, Data>
-            wrap_action_type;
-
-            template <typename IterData>
-            Data (IterData const& data_, Iterator& first_, Iterator const& last_)
-              : base_type(data_, first_, last_),
-                actions(data_.actions_)
-            {}
-
-            // invoke attached semantic actions, if defined
-            bool invoke_actions(std::size_t id, Iterator const& end)
-            {
-                if (actions.empty()) 
-                    return true;  // nothing to invoke, continue with 'match'
-
-                iterpair_type itp(this->first, end);
-                bool match = true;
-                
-                typedef typename 
-                    semantic_actions_type::const_iterator 
-                iterator_type;
-                
-                std::pair<iterator_type, iterator_type> p = actions.equal_range(id);
-                while (p.first != p.second)
-                {
-                    ((*p.first).second)(itp, id, match, *this);
-                    if (!match)
-                        return false;   // return a 'no-match'
-                    ++p.first;
-                }
-                return true;    // normal execution
-            }
-            
-            semantic_actions_type const& actions;
-        };
-    }
-    
-    ///////////////////////////////////////////////////////////////////////////
-    //
-    //  lexertl_functor is a template usable as the functor object for the 
-    //  multi_pass iterator allowing to wrap a lexertl based dfa into a 
-    //  iterator based interface.
-    //  
-    //    Iterator:   the type of the underlying iterator
-    //    Token:      the type of the tokens produced by this functor
-    //                this needs to expose a constructor with the following
-    //                prototype:
-    //
-    //                Token(std::size_t id, std::size_t state, 
-    //                      Iterator start, Iterator end)
-    //
-    //                where 'id' is the token id, state is the lexer state,
-    //                this token has been matched in, and 'first' and 'end'  
-    //                mark the start and the end of the token with respect 
-    //                to the underlying character stream.
-    //    SupportsActors:
-    //                this is expected to be a mpl::bool_, if mpl::true_ the
-    //                lexertl_functor invokes functors which (optionally) have 
-    //                been attached to the token definitions.
-    //    SupportState:
-    //                this is expected to be a mpl::bool_, if mpl::true_ the
-    //                lexertl_functor supports different lexer states, 
-    //                otherwise no lexer state is supported.
-    //
-    ///////////////////////////////////////////////////////////////////////////
-    template <typename Token, 
-        typename Iterator = typename Token::iterator_type, 
-        typename SupportsActors = mpl::false_, 
-        typename SupportsState = typename Token::has_state>
-    class lexertl_functor
-    {
-    public:
-        typedef typename 
-            boost::detail::iterator_traits<Iterator>::value_type 
-        char_type;
-
-    private:
-        // Needed by compilers not implementing the resolution to DR45. For
-        // reference, see
-        // http://www.open-std.org/JTC1/SC22/WG21/docs/cwg_defects.html#45.
-        template <typename Iterator_, typename HasActors, typename HasState> 
-        friend struct detail::Data;
-
-        // Helper template allowing to assign a value on exit
-        template <typename T>
-        struct assign_on_exit
-        {
-            assign_on_exit(T& dst_, T const& src_)
-              : dst(dst_), src(src_)
-            {}
-            ~assign_on_exit()
-            {
-                dst = src;
-            }
-            
-            T& dst;
-            T const& src;
-        };
-        
-    public:
-        lexertl_functor()
-#if defined(__PGI)
-          : eof()
-#endif 
-        {}
-
-#if BOOST_WORKAROUND(BOOST_MSVC, <= 1310)
-        // somehow VC7.1 needs this (meaningless) assignment operator
-        lexertl_functor& operator=(lexertl_functor const& rhs)
-        {
-            return *this;
-        }
-#endif
-
-        ///////////////////////////////////////////////////////////////////////
-        // interface to the multi_pass_policies::split_functor_input policy
-        typedef Token result_type;
-        typedef lexertl_functor unique;
-        typedef detail::Data<Iterator, SupportsActors, SupportsState> shared;
-        
-        BOOST_SPIRIT_EOF_PREFIX result_type const eof;
-    
-        ///////////////////////////////////////////////////////////////////////
-        typedef Iterator iterator_type;
-        typedef typename shared::semantic_actions_type semantic_actions_type;
-
-        // this is needed to wrap the semantic actions in a proper way
-        typedef typename shared::wrap_action_type wrap_action_type;
-
-        ///////////////////////////////////////////////////////////////////////
-        template <typename MultiPass>
-        static result_type& get_next(MultiPass& mp, result_type& result)
-        {
-            shared& data = mp.shared->ftor;
-            if (data.first == data.last) 
-#if defined(BOOST_SPIRIT_STATIC_EOF)
-                return result = eof;
-#else
-                return result = mp.ftor.eof;
-#endif
-
-            Iterator end = data.first;
-            std::size_t id = data.next(end);
-            
-            if (boost::lexer::npos == id) {   // no match
-#if defined(BOOST_SPIRIT_LEXERTL_DEBUG)
-                std::string next;
-                Iterator it = data.first;
-                for (std::size_t i = 0; i < 10 && it != data.last; ++it, ++i)
-                    next += *it;
-
-                std::cerr << "Not matched, in state: " << data.state 
-                          << ", lookahead: >" << next << "<" << std::endl;
-#endif
-                result = result_type(0);
-            }
-            else if (0 == id) {         // EOF reached
-#if defined(BOOST_SPIRIT_STATIC_EOF)
-                result = eof;
-#else
-                result = mp.ftor.eof;
-#endif
-            }
-            else {
-#if defined(BOOST_SPIRIT_LEXERTL_DEBUG)
-                {
-                    std::string next;
-                    Iterator it = data.first;
-                    for (std::size_t i = 0; i < 10 && it != data.last; ++it, ++i)
-                        next += *it;
-
-                    std::cerr << "Matched: " << id << ", in state: " 
-                              << data.state << ", string: >" 
-                              << std::basic_string<char_type>(data.first, end) << "<"
-                              << ", lookahead: >" << next << "<" << std::endl;
-                }
-#endif
-                // invoke_actions might change state
-                std::size_t state = data.get_state();
-                
-                // invoke attached semantic actions, if defined
-                if (!data.invoke_actions(id, end))
-                {
-                    // one of the semantic actions signaled no-match
-                    result = result_type(0); 
-                }
-                else 
-                {
-                    // return matched token, advancing 'data.first' past the 
-                    // matched sequence
-                    assign_on_exit<Iterator> on_exit(data.first, end);
-                    result = result_type(id, state, data.first, end);
-                }
-            }
-            return result;
-        }
-
-        // set_state are propagated up to the iterator interface, allowing to 
-        // manipulate the current lexer state through any of the exposed 
-        // iterators.
-        template <typename MultiPass>
-        static std::size_t set_state(MultiPass& mp, std::size_t state_) 
-        { 
-            std::size_t oldstate = mp.shared->ftor.state;
-            mp.shared->ftor.state = state_;
-
-#if defined(BOOST_SPIRIT_LEXERTL_DEBUG)
-            std::cerr << "Switching state from: " << oldstate 
-                      << " to: " << state_
-                      << std::endl;
-#endif
-            return oldstate; 
-        }
-        
-        template <typename MultiPass>
-        static std::size_t 
-        map_state(MultiPass const& mp, char_type const* statename)  
-        { 
-            return mp.shared->ftor.rules.state(statename);
-        }
-        
-        // we don't need this, but it must be there
-        template <typename MultiPass>
-        static void destroy(MultiPass const&)
-        {}  
-    };
-
-#if defined(BOOST_SPIRIT_STATIC_EOF)
-    ///////////////////////////////////////////////////////////////////////////
-    //  eof token
-    ///////////////////////////////////////////////////////////////////////////
-    template <typename Token, typename Iterator, typename SupportsActors, 
-        typename SupportsState>
-    typename lexertl_functor<
-            Token, Iterator, SupportsActors, SupportsState>::result_type const
-        lexertl_functor<
-                Token, Iterator, SupportsActors, SupportsState>::eof = 
-            typename lexertl_functor<
-                Token, Iterator, SupportsActors, SupportsState>::result_type();
-#endif
-
-}}}
-
-#undef BOOST_SPIRIT_EOF_PREFIX
-#undef BOOST_SPIRIT_STATIC_EOF
-
-#endif
Deleted: trunk/boost/spirit/home/lex/lexer/lexertl/lexertl_generate_static.hpp
==============================================================================
--- trunk/boost/spirit/home/lex/lexer/lexertl/lexertl_generate_static.hpp	2009-04-26 10:42:24 EDT (Sun, 26 Apr 2009)
+++ (empty file)
@@ -1,559 +0,0 @@
-//  Copyright (c) 2008 Ben Hanson
-//  Copyright (c) 2009 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_LEX_LEXERTL_GENERATE_CPP_FEB_10_2008_0855PM)
-#define BOOST_SPIRIT_LEX_LEXERTL_GENERATE_CPP_FEB_10_2008_0855PM
-
-#if defined(_MSC_VER) && (_MSC_VER >= 1020)
-#pragma once      // MS compatible compilers support #pragma once
-#endif
-
-#include <boost/spirit/home/support/detail/lexer/char_traits.hpp>
-#include <boost/spirit/home/support/detail/lexer/consts.hpp>
-#include <boost/spirit/home/support/detail/lexer/size_t.hpp>
-#include <boost/spirit/home/support/detail/lexer/state_machine.hpp>
-
-///////////////////////////////////////////////////////////////////////////////
-namespace boost { namespace spirit { namespace lex { namespace detail
-{ 
-    ///////////////////////////////////////////////////////////////////////////
-    // Generate a table of the names of the used lexer states, which is a bit 
-    // tricky, because the table stored with the rules is sorted based on the 
-    // names, but we need it sorted using the state ids.
-    template <typename Char>
-    inline bool 
-    generate_cpp_state_names (boost::lexer::basic_rules<Char> const& rules_,
-        std::ostream &os_, char const* name_suffix = "")
-    {
-        // we need to re-sort the state names in ascending order if the state 
-        // ids, filling possible gaps in between later
-        typedef typename 
-            boost::lexer::basic_rules<Char>::string_size_t_map::const_iterator
-        state_iterator;
-        typedef std::map<std::size_t, char const*> reverse_state_map_type;
-        
-        reverse_state_map_type reverse_state_map;
-        state_iterator send = rules_.statemap().end();
-        for (state_iterator sit = rules_.statemap().begin(); sit != send; ++sit)
-        {
-            typedef typename reverse_state_map_type::value_type value_type;
-            reverse_state_map.insert(value_type((*sit).second, (*sit).first.c_str()));
-        }
-        
-        os_ << "// this table defines the names of the lexer states\n";
-        os_ << "char const* const lexer_state_names" << name_suffix 
-            << "[" << rules_.statemap().size() << "] = \n{\n";
-            
-        typedef typename reverse_state_map_type::iterator iterator;
-        iterator rend = reverse_state_map.end();
-        std::size_t last_id = 0;
-        for (iterator rit = reverse_state_map.begin(); rit != rend; ++rit)
-        {
-            for (/**/; last_id < (*rit).first; ++last_id)
-            {
-                os_ << "    0,  // \"<undefined state>\"\n";
-            }
-            os_ << "    \"" << (*rit).second << "\",\n";
-        }
-        os_ << "};\n\n";
-        
-        return true;
-    }
-    
-    ///////////////////////////////////////////////////////////////////////////
-    // Generate a tokenizer for the given state machine.
-    template <typename Char>
-    inline bool 
-    generate_cpp (boost::lexer::basic_state_machine<Char> const& sm_, 
-        boost::lexer::basic_rules<Char> const& rules_, 
-        std::ostream &os_, char const* name_suffix = "", 
-        bool skip_on_nomatch = true, bool optimize_parameters = true)
-    {
-        if (sm_.data()._lookup->empty())
-            return false;
-            
-        std::size_t const dfas_ = sm_.data()._dfa->size();
-        std::size_t const lookups_ = sm_.data()._lookup->front()->size();
-
-        os_ << "// Copyright (c) 2008 Ben Hanson\n";
-        os_ << "//\n";
-        os_ << "// Distributed under the Boost Software License, "
-            "Version 1.0. (See accompanying\n";
-        os_ << "// file licence_1_0.txt or copy at "
-            "http://www.boost.org/LICENSE_1_0.txt)\n\n";
-        os_ << "// Auto-generated by boost::lexer\n";
-
-        std::string guard(__DATE__ "_" __TIME__);
-        std::string::size_type p = guard.find_first_of(": ");
-        while (std::string::npos != p) 
-        {
-            guard.replace(p, 1, "_");
-            p = guard.find_first_of(": ", p);
-        }
-      
-        os_ << "#if !defined(BOOST_SPIRIT_LEXER_NEXT_TOKEN_" << guard << ")\n";
-        os_ << "#define BOOST_SPIRIT_LEXER_NEXT_TOKEN_" << guard << "\n\n";
-      
-        os_ << "#include <boost/detail/iterator.hpp>\n";
-        os_ << "#include <boost/spirit/home/support/detail/lexer/char_traits.hpp>\n\n";
-
-        os_ << "// the generated table of state names and the tokenizer have to be\n"
-               "// defined in the boost::spirit::lex::static namespace\n";
-        os_ << "namespace boost { namespace spirit { namespace lex { "
-            "namespace static_ {\n\n";
-
-        // generate the table containing state names 
-        if (!generate_cpp_state_names(rules_, os_, name_suffix))
-            return false;
-
-        os_ << "template<typename Iterator>\n";
-        os_ << "std::size_t next_token" << name_suffix  << " (";
-
-        if (dfas_ > 1 || !optimize_parameters)
-        {
-            os_ << "std::size_t &start_state_, ";
-        }
-
-        if (sm_.data()._seen_BOL_assertion || !optimize_parameters)
-        {
-            os_ << "Iterator const& start_, ";
-        }
-
-        if (dfas_ > 1 || sm_.data()._seen_BOL_assertion || !optimize_parameters)
-        {
-            os_ << "\n    ";
-        }
-      
-        os_ << "Iterator &start_token_, Iterator const& end_)\n";
-        os_ << "{\n";
-        os_ << "    enum {end_state_index, id_index, state_index, bol_index, "
-          "eol_index,\n";
-        os_ << "        dead_state_index, dfa_offset};\n";
-        os_ << "    static const std::size_t npos = static_cast"
-          "<std::size_t>(~0);\n";
-
-        if (dfas_ > 1)
-        {
-            for (std::size_t state_ = 0; state_ < dfas_; ++state_)
-            {
-                std::size_t i_ = 0;
-                std::size_t j_ = 1;
-                std::size_t count_ = lookups_ / 8;
-                std::size_t const* lookup_ = &sm_.data()._lookup[state_]->front ();
-                std::size_t const* dfa_ = &sm_.data()._dfa[state_]->front ();
-
-                os_ << "    static const std::size_t lookup" << state_ 
-                    << "_[" << lookups_ << "] = {";
-
-                for (/**/; i_ < count_; ++i_)
-                {
-                    const std::size_t index_ = i_ * 8;
-
-                    os_ << lookup_[index_];
-
-                    for (; j_ < 8; ++j_)
-                    {
-                        os_ << ", " << lookup_[index_ + j_];
-                    }
-
-                    if (i_ < count_ - 1)
-                    {
-                        os_ << "," << std::endl << "        ";
-                    }
-
-                    j_ = 1;
-                }
-
-                os_ << "};\n";
-                count_ = sm_.data()._dfa[state_]->size ();
-                os_ << "    static const std::size_t dfa" << state_ << "_[" <<
-                    count_ << "] = {";
-                count_ /= 8;
-
-                for (i_ = 0; i_ < count_; ++i_)
-                {
-                    const std::size_t index_ = i_ * 8;
-
-                    os_ << dfa_[index_];
-
-                    for (j_ = 1; j_ < 8; ++j_)
-                    {
-                        os_ << ", " << dfa_[index_ + j_];
-                    }
-
-                    if (i_ < count_ - 1)
-                    {
-                        os_ << "," << std::endl << "        ";
-                    }
-                }
-
-                std::size_t const mod_ = sm_.data()._dfa[state_]->size () % 8;
-                if (mod_)
-                {
-                    const std::size_t index_ = count_ * 8;
-
-                    if (count_)
-                    {
-                        os_ << ",\n        ";
-                    }
-
-                    os_ << dfa_[index_];
-
-                    for (j_ = 1; j_ < mod_; ++j_)
-                    {
-                        os_ << ", " << dfa_[index_ + j_];
-                    }
-                }
-
-                os_ << "};\n";
-            }
-
-            std::size_t count_ = sm_.data()._dfa_alphabet.size();
-            std::size_t i_ = 1;
-
-            os_ << "    static const std::size_t *lookup_arr_[" << count_ <<
-                "] = {";
-
-            os_ << "lookup0_";
-
-            for (i_ = 1; i_ < count_; ++i_)
-            {
-                os_ << ", " << "lookup" << i_ << "_";
-            }
-
-            os_ << "};\n";
-            os_ << "    static const std::size_t dfa_alphabet_arr_[" << 
-                count_ << "] = {";
-
-            os_ << sm_.data()._dfa_alphabet.front ();
-
-            for (i_ = 1; i_ < count_; ++i_)
-            {
-                os_ << ", " << sm_.data()._dfa_alphabet[i_];
-            }
-
-            os_ << "};\n";
-            os_ << "    static const std::size_t *dfa_arr_[" << count_ <<
-                "] = {";
-            os_ << "dfa0_";
-
-            for (i_ = 1; i_ < count_; ++i_)
-            {
-                os_ << ", " << "dfa" << i_ << "_";
-            }
-
-            os_ << "};\n";
-        }
-        else
-        {
-            std::size_t const* lookup_ = &sm_.data()._lookup[0]->front();
-            std::size_t const* dfa_ = &sm_.data()._dfa[0]->front();
-            std::size_t i_ = 0;
-            std::size_t j_ = 1;
-            std::size_t count_ = lookups_ / 8;
-
-            os_ << "    static const std::size_t lookup_[";
-            os_ << sm_.data()._lookup[0]->size() << "] = {";
-
-            for (; i_ < count_; ++i_)
-            {
-                const std::size_t index_ = i_ * 8;
-
-                os_ << lookup_[index_];
-
-                for (; j_ < 8; ++j_)
-                {
-                    os_ << ", " << lookup_[index_ + j_];
-                }
-
-                if (i_ < count_ - 1)
-                {
-                    os_ << "," << std::endl << "        ";
-                }
-
-                j_ = 1;
-            }
-
-            os_ << "};\n";
-            os_ << "    static const std::size_t dfa_alphabet_ = " <<
-              sm_.data()._dfa_alphabet.front () << ";\n";
-            os_ << "    static const std::size_t dfa_[" <<
-              sm_.data()._dfa[0]->size () << "] = {";
-                count_ = sm_.data()._dfa[0]->size () / 8;
-
-            for (i_ = 0; i_ < count_; ++i_)
-            {
-                const std::size_t index_ = i_ * 8;
-
-                os_ << dfa_[index_];
-
-                for (j_ = 1; j_ < 8; ++j_)
-                {
-                    os_ << ", " << dfa_[index_ + j_];
-                }
-
-                if (i_ < count_ - 1)
-                {
-                    os_ << "," << std::endl << "        ";
-                }
-            }
-
-            const std::size_t mod_ = sm_.data()._dfa[0]->size () % 8;
-
-            if (mod_)
-            {
-                const std::size_t index_ = count_ * 8;
-
-                if (count_)
-                {
-                    os_ << ",\n        ";
-                }
-
-                os_ << dfa_[index_];
-
-                for (j_ = 1; j_ < mod_; ++j_)
-                {
-                    os_ << ", " << dfa_[index_ + j_];
-                }
-            }
-
-            os_ << "};\n";
-        }
-
-        os_ << "\n    if (start_token_ == end_) return 0;\n\n";
-
-        if (dfas_ > 1)
-        {
-            os_ << "again:\n";
-            os_ << "    const std::size_t * lookup_ = lookup_arr_[start_state_];\n";
-            os_ << "    std::size_t dfa_alphabet_ = dfa_alphabet_arr_[start_state_];\n";
-            os_ << "    const std::size_t *dfa_ = dfa_arr_[start_state_];\n";
-        }
-
-        os_ << "    const std::size_t *ptr_ = dfa_ + dfa_alphabet_;\n";
-        os_ << "    Iterator curr_ = start_token_;\n";
-        os_ << "    bool end_state_ = *ptr_ != 0;\n";
-        os_ << "    std::size_t id_ = *(ptr_ + id_index);\n";
-        os_ << "    Iterator end_token_ = start_token_;\n";
-        os_ << '\n';
-        os_ << "    while (curr_ != end_)\n";
-        os_ << "    {\n";
-
-        if (sm_.data()._seen_BOL_assertion)
-        {
-            os_ << "        std::size_t const BOL_state_ = ptr_[bol_index];\n";
-        }
-
-        if (sm_.data()._seen_EOL_assertion)
-        {
-            os_ << "        std::size_t const EOL_state_ = ptr_[eol_index];\n";
-        }
-
-        if (sm_.data()._seen_BOL_assertion || sm_.data()._seen_EOL_assertion)
-        {
-            os_ << '\n';
-        }
-
-        if (sm_.data()._seen_BOL_assertion && sm_.data()._seen_EOL_assertion)
-        {
-            os_ << "        if (BOL_state_ && (start_token_ == start_ ||\n";
-            os_ << "            *(start_token_ - 1) == '\\n'))\n";
-            os_ << "        {\n";
-            os_ << "            ptr_ = &dfa_[BOL_state_ * dfa_alphabet_];\n";
-            os_ << "        }\n";
-            os_ << "        else if (EOL_state_ && *curr_ == '\\n')\n";
-            os_ << "        {\n";
-            os_ << "            ptr_ = &dfa_[EOL_state_ * dfa_alphabet_];\n";
-            os_ << "        }\n";
-            os_ << "        else\n";
-            os_ << "        {\n";
-            os_ << "            std::size_t const state_ =\n";
-
-            if (lookups_ == 256)
-            {
-                os_ << "                ptr_[lookup_[<typename Traits::index_type>"
-                    "(*curr_++)]];\n";
-            }
-            else
-            {
-                os_ << "                ptr_[lookup_[*curr_++]];\n";
-            }
-
-            os_ << '\n';
-            os_ << "            if (state_ == 0) break;\n";
-            os_ << '\n';
-            os_ << "            ptr_ = &dfa_[state_ * dfa_alphabet_];\n";
-            os_ << "        }\n";
-        }
-        else if (sm_.data()._seen_BOL_assertion)
-        {
-            os_ << "        if (BOL_state_ && (start_token_ == start_ ||\n";
-            os_ << "            *(start_token_ - 1) == '\\n'))\n";
-            os_ << "        {\n";
-            os_ << "            ptr_ = &dfa_[BOL_state_ * dfa_alphabet_];\n";
-            os_ << "        }\n";
-            os_ << "        else\n";
-            os_ << "        {\n";
-            os_ << "            std::size_t const state_ =\n";
-
-            if (lookups_ == 256)
-            {
-                os_ << "                ptr_[lookup_[static_cast<unsigned char>\n";
-                os_ << "                (*curr_++)]];\n";
-            }
-            else
-            {
-                os_ << "                ptr_[lookup_[*curr_++]];\n";
-            }
-
-            os_ << '\n';
-            os_ << "            if (state_ == 0) break;\n";
-            os_ << '\n';
-            os_ << "            ptr_ = &dfa_[state_ * dfa_alphabet_];\n";
-            os_ << "        }\n";
-        }
-        else if (sm_.data()._seen_EOL_assertion)
-        {
-            os_ << "        if (EOL_state_ && *curr_ == '\\n')\n";
-            os_ << "        {\n";
-            os_ << "            ptr_ = &dfa_[EOL_state_ * dfa_alphabet_];\n";
-            os_ << "        }\n";
-            os_ << "        else\n";
-            os_ << "        {\n";
-            os_ << "            std::size_t const state_ =\n";
-
-            if (lookups_ == 256)
-            {
-                os_ << "                ptr_[lookup_[static_cast<unsigned char>\n";
-                os_ << "                (*curr_++)]];\n";
-            }
-            else
-            {
-                os_ << "                ptr_[lookup_[*curr_++]];\n";
-            }
-
-            os_ << '\n';
-            os_ << "            if (state_ == 0) break;\n";
-            os_ << '\n';
-            os_ << "            ptr_ = &dfa_[state_ * dfa_alphabet_];\n";
-            os_ << "        }\n";
-        }
-        else
-        {
-            os_ << "        std::size_t const state_ =\n";
-
-            if (lookups_ == 256)
-            {
-                os_ << "            ptr_[lookup_[static_cast<unsigned char>\n";
-                os_ << "            (*curr_++)]];\n";
-            }
-            else
-            {
-                os_ << "            ptr_[lookup_[*curr_++]];\n";
-            }
-
-            os_ << '\n';
-            os_ << "        if (state_ == 0) break;\n";
-            os_ << '\n';
-            os_ << "        ptr_ = &dfa_[state_ * dfa_alphabet_];\n";
-        }
-
-        os_ << '\n';
-        os_ << "        if (*ptr_)\n";
-        os_ << "        {\n";
-        os_ << "            end_state_ = true;\n";
-        os_ << "            id_ = *(ptr_ + id_index);\n";
-
-        if (dfas_ > 1)
-        {
-            os_ << "            start_state_ = *(ptr_ + state_index);\n";
-        }
-
-        os_ << "            end_token_ = curr_;\n";
-        os_ << "        }\n";
-        os_ << "    }\n";
-        os_ << '\n';
-
-        if (sm_.data()._seen_EOL_assertion)
-        {
-            os_ << "    const std::size_t EOL_state_ = ptr_[eol_index];\n";
-            os_ << '\n';
-            os_ << "    if (EOL_state_ && curr_ == end_)\n";
-            os_ << "    {\n";
-            os_ << "        ptr_ = &dfa_[EOL_state_ * dfa_alphabet_];\n";
-            os_ << '\n';
-            os_ << "        if (*ptr_)\n";
-            os_ << "        {\n";
-            os_ << "            end_state_ = true;\n";
-            os_ << "            id_ = *(ptr_ + id_index);\n";
-
-            if (dfas_ > 1)
-            {
-                os_ << "            start_state_ = *(ptr_ + state_index);\n";
-            }
-
-            os_ << "            end_token_ = curr_;\n";
-            os_ << "        }\n";
-            os_ << "    }\n";
-            os_ << '\n';
-        }
-
-        os_ << "    if (end_state_)\n";
-        os_ << "    {\n";
-        os_ << "        // return longest match\n";
-        os_ << "        start_token_ = end_token_;\n";
-
-        if (dfas_ > 1)
-        {
-            os_ << '\n';
-            os_ << "        if (id_ == 0) goto again;\n";
-        }
-
-        os_ << "    }\n";
-        os_ << "    else\n";
-        os_ << "    {\n";
-      
-        if (skip_on_nomatch)
-        {
-            os_ << "        // No match causes char to be skipped\n";
-            os_ << "        ++start_token_;\n";
-        }
-      
-        os_ << "        id_ = npos;\n";
-        os_ << "    }\n";
-        os_ << '\n';
-        os_ << "    return id_;\n";
-        os_ << "}\n\n";
-
-        os_ << "}}}}  // namespace boost::spirit::lex::static_\n\n";
-        
-        os_ << "#endif\n";
-        
-        return os_.good();
-    }
-    
-///////////////////////////////////////////////////////////////////////////////
-}}}}   // namespace boost::spirit::lex::detail
-
-///////////////////////////////////////////////////////////////////////////////
-namespace boost { namespace spirit { namespace lex 
-{ 
-    ///////////////////////////////////////////////////////////////////////////
-    template <typename Lexer>
-    inline bool 
-    generate_static(Lexer const& lexer, std::ostream& os, 
-        char const* name_suffix = "")
-    {
-        if (!lexer.get_definition().init_dfa())
-            return false;
-        return detail::generate_cpp(lexer.get_definition().state_machine, 
-            lexer.get_definition().rules, os, name_suffix, false, false);
-    }
-
-///////////////////////////////////////////////////////////////////////////////
-}}}
-
-#endif
Deleted: trunk/boost/spirit/home/lex/lexer/lexertl/lexertl_iterator.hpp
==============================================================================
--- trunk/boost/spirit/home/lex/lexer/lexertl/lexertl_iterator.hpp	2009-04-26 10:42:24 EDT (Sun, 26 Apr 2009)
+++ (empty file)
@@ -1,117 +0,0 @@
-//  Copyright (c) 2001-2009 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_LEX_LEXER_ITERATOR_MAR_16_2007_0353PM)
-#define BOOST_SPIRIT_LEX_LEXER_ITERATOR_MAR_16_2007_0353PM
-
-#if defined(_MSC_VER) && (_MSC_VER >= 1020)
-#pragma once      // MS compatible compilers support #pragma once
-#endif
-
-#if defined(BOOST_SPIRIT_LEXERTL_DEBUG)
-#include <boost/spirit/home/support/iterators/detail/buf_id_check_policy.hpp>
-#else
-#include <boost/spirit/home/support/iterators/detail/no_check_policy.hpp>
-#endif
-#include <boost/spirit/home/support/iterators/detail/split_functor_input_policy.hpp>
-#include <boost/spirit/home/support/iterators/detail/ref_counted_policy.hpp>
-#include <boost/spirit/home/support/iterators/detail/split_std_deque_policy.hpp>
-#include <boost/spirit/home/support/iterators/multi_pass.hpp>
-
-namespace boost { namespace spirit { namespace lex 
-{ 
-    ///////////////////////////////////////////////////////////////////////////
-    //  Divide the given functor type into its components (unique and shared) 
-    //  and build a std::pair from these parts
-    template <typename Functor>
-    struct make_functor
-    {
-        typedef 
-            std::pair<typename Functor::unique, typename Functor::shared> 
-        type;
-    };
-    
-    ///////////////////////////////////////////////////////////////////////////////
-    //  Divide the given functor type into its components (unique and shared) 
-    //  and build a std::pair from these parts
-    template <typename FunctorData>
-    struct make_multi_pass
-    {
-        typedef  
-            std::pair<typename FunctorData::unique, typename FunctorData::shared> 
-        functor_data_type;
-        typedef typename FunctorData::result_type result_type;
-
-        typedef multi_pass_policies::split_functor_input input_policy;
-        typedef multi_pass_policies::ref_counted ownership_policy;
-#if defined(BOOST_SPIRIT_LEXERTL_DEBUG)
-        typedef multi_pass_policies::buf_id_check check_policy;
-#else
-        typedef multi_pass_policies::no_check check_policy;
-#endif
-        typedef multi_pass_policies::split_std_deque storage_policy;
-        
-        typedef multi_pass_policies::default_policy<
-                ownership_policy, check_policy, input_policy, storage_policy>
-            policy_type;
-        typedef spirit::multi_pass<functor_data_type, policy_type> type;
-    };
-
-    ///////////////////////////////////////////////////////////////////////////
-    //  lexer_iterator exposes an iterator for a lexertl based dfa (lexer) 
-    //  The template parameters have the same semantics as described for the
-    //  lexertl_functor above.
-    ///////////////////////////////////////////////////////////////////////////
-    template <typename Functor>
-    class lexertl_iterator
-      : public make_multi_pass<Functor>::type
-    {
-    public:
-        typedef typename Functor::unique unique_functor_type;
-        typedef typename Functor::shared shared_functor_type;
-        
-        typedef typename Functor::iterator_type base_iterator_type;
-        typedef typename Functor::result_type token_type;
-        
-    private:
-        typedef 
-            typename make_multi_pass<Functor>::functor_data_type 
-        functor_type;
-        typedef typename make_multi_pass<Functor>::type base_type;
-        typedef typename Functor::char_type char_type;
-        
-    public:
-        // create a new iterator encapsulating the lexer object to be used
-        // for tokenization
-        template <typename IteratorData>
-        lexertl_iterator(IteratorData const& iterdata_, 
-                base_iterator_type& first, base_iterator_type const& last)
-          : base_type(functor_type(unique_functor_type(), 
-                shared_functor_type(iterdata_, first, last))
-            )
-        {
-        }
-        
-        // create an end iterator usable for end of range checking
-        lexertl_iterator()
-        {}
-        
-        // set the new required state for the underlying lexer object
-        std::size_t set_state(std::size_t state)
-        {
-            return unique_functor_type::set_state(*this, state);
-        }
-        
-        // map the given state name to a corresponding state id as understood
-        // by the underlying lexer object
-        std::size_t map_state(char_type const* statename)
-        {
-            return unique_functor_type::map_state(*this, statename);
-        }
-    };
-    
-}}}
-
-#endif
Deleted: trunk/boost/spirit/home/lex/lexer/lexertl/lexertl_lexer.hpp
==============================================================================
--- trunk/boost/spirit/home/lex/lexer/lexertl/lexertl_lexer.hpp	2009-04-26 10:42:24 EDT (Sun, 26 Apr 2009)
+++ (empty file)
@@ -1,371 +0,0 @@
-//  Copyright (c) 2001-2009 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_LEX_LEXERTL_LEXER_MAR_17_2007_0139PM)
-#define BOOST_SPIRIT_LEX_LEXERTL_LEXER_MAR_17_2007_0139PM
-
-#if defined(_MSC_VER) && (_MSC_VER >= 1020)
-#pragma once      // MS compatible compilers support #pragma once
-#endif
-
-#include <iosfwd>
-
-#include <boost/spirit/home/support/safe_bool.hpp>
-#include <boost/spirit/home/support/detail/lexer/generator.hpp>
-#include <boost/spirit/home/support/detail/lexer/rules.hpp>
-#include <boost/spirit/home/support/detail/lexer/consts.hpp>
-#include <boost/spirit/home/lex/lexer/lexer_fwd.hpp>
-#include <boost/spirit/home/lex/lexer/lexertl/lexertl_token.hpp>
-#include <boost/spirit/home/lex/lexer/lexertl/lexertl_functor.hpp>
-#include <boost/spirit/home/lex/lexer/lexertl/lexertl_iterator.hpp>
-#if defined(BOOST_SPIRIT_LEXERTL_DEBUG)
-#include <boost/spirit/home/support/detail/lexer/debug.hpp>
-#endif
-
-namespace boost { namespace spirit { namespace lex 
-{ 
-    ///////////////////////////////////////////////////////////////////////////
-    namespace detail
-    {
-        ///////////////////////////////////////////////////////////////////////
-        //  The must_escape function checks if the given character value needs
-        //  to be preceded by a backslash character to disable its special 
-        //  meaning in the context of a regular expression
-        ///////////////////////////////////////////////////////////////////////
-        template <typename Char>
-        inline bool must_escape(Char c)
-        {
-            // FIXME: more needed?
-            switch (c) {
-            case '+': case '/': case '*': case '?':
-            case '|':
-            case '(': case ')':
-            case '[': case ']':
-            case '{': case '}':
-            case '.':
-            case '^': case '$':
-            case '\\':
-            case '"':
-                return true;
-
-            default:
-                break;
-            }
-            return false;
-        }
-
-        ///////////////////////////////////////////////////////////////////////
-        //  The escape function returns the string representation of the given 
-        //  character value, possibly escaped with a backslash character, to 
-        //  allow it being safely used in a regular expression definition.
-        ///////////////////////////////////////////////////////////////////////
-        template <typename Char>
-        inline std::basic_string<Char> escape(Char ch) 
-        { 
-            std::basic_string<Char> result(1, ch);
-            if (detail::must_escape(ch)) 
-            {
-                typedef typename std::basic_string<Char>::size_type size_type;
-                result.insert((size_type)0, 1, '\\');
-            }
-            return result;
-        }
-    }
-    
-    ///////////////////////////////////////////////////////////////////////////
-    //  lexertl_token_set
-    ///////////////////////////////////////////////////////////////////////////
-    template <typename Token, typename Iterator = typename Token::iterator_type>
-    class lexertl_token_set
-    {
-    protected:
-        typedef typename 
-            boost::detail::iterator_traits<Iterator>::value_type 
-        char_type;
-        typedef std::basic_string<char_type> string_type;
-
-    public:
-        typedef Token token_type;
-        typedef typename Token::id_type id_type;
-
-        // interface for token definition management
-        void add_token (char_type const* state, string_type const& tokendef, 
-            std::size_t token_id)
-        {
-            rules.add(state, tokendef, token_id, state);
-        }
-        
-        // interface for pattern definition management
-        void add_pattern (char_type const* state, string_type const& name,
-            string_type const& patterndef)
-        {
-            add_state(state);
-            rules.add_macro(name.c_str(), patterndef);
-        }
-        
-        boost::lexer::rules const& get_rules() const { return rules; }
-        
-        void clear() { rules.clear(); }
-         
-        std::size_t add_state(char_type const* state)
-        {
-            rules.add_state(state);
-            return rules.state(state);
-        }
-        string_type initial_state() const 
-        { 
-            return string_type(rules.initial());
-        }
-
-    private:
-        boost::lexer::basic_rules<char_type> rules;
-    };
-    
-    ///////////////////////////////////////////////////////////////////////////
-    template <typename Lexer>
-    bool generate_static(Lexer const& lex, std::ostream& os, char const* name);
-    
-    ///////////////////////////////////////////////////////////////////////////
-    //
-    //  Every lexer type to be used as a lexer for Spirit has to conform to 
-    //  the following public interface:
-    //
-    //    typedefs: 
-    //        iterator_type   The type of the iterator exposed by this lexer.
-    //        token_type      The type of the tokens returned from the exposed 
-    //                        iterators.
-    //        token_set       The type of the token set representing a lexer 
-    //                        state.
-    //
-    //    functions:
-    //        default constructor
-    //                        Since lexers are instantiated as base classes 
-    //                        only it might be a good idea to make this 
-    //                        constructor protected.
-    //        begin, end      Return a pair of iterators, when dereferenced
-    //                        returning the sequence of tokens recognized in 
-    //                        the input stream given as the parameters to the 
-    //                        begin() function.
-    //        add_token       Should add the definition of a token to be 
-    //                        recognized by this lexer.
-    //        clear           Should delete all current token definitions
-    //                        associated with the given state of this lexer 
-    //                        object.
-    //
-    //    template parameters:
-    //        Iterator        The type of the iterator used to access the
-    //                        underlying character stream.
-    //        Token           The type of the tokens to be returned from the
-    //                        exposed token iterator.
-    //        Functor         The type of the InputPolicy to use to instantiate
-    //                        the multi_pass iterator type to be used as the 
-    //                        token iterator (returned from begin()/end()).
-    //        TokenSet        The type of the token set to use in conjunction 
-    //                        with this lexer type. This is used for the 
-    //                        token_set typedef described above only.
-    //
-    ///////////////////////////////////////////////////////////////////////////
-    
-    ///////////////////////////////////////////////////////////////////////////
-    //
-    //  The lexertl_lexer class is a implementation of a Spirit.Lex lexer on 
-    //  top of Ben Hanson's lexertl library as outlined above (For more 
-    //  information about lexertl go here: http://www.benhanson.net/lexertl.html).
-    //
-    //  This class is supposed to be used as the first and only template 
-    //  parameter while instantiating instances of a lex::lexer_def class.
-    //
-    ///////////////////////////////////////////////////////////////////////////
-    template <
-        typename Token = lexertl_token<>,
-        typename Iterator = typename Token::iterator_type, 
-        typename Functor = lexertl_functor<Token, Iterator, mpl::false_>,
-        typename TokenSet = token_set<lexertl_token_set<Token, Iterator> >
-    >
-    class lexertl_lexer 
-      : public safe_bool<lexertl_lexer<Token, Iterator, Functor, TokenSet> >
-    {
-    public:
-        // operator_bool() is needed for the safe_bool base class
-        bool operator_bool() const { return initialized_dfa; }
-        
-        typedef typename
-            boost::detail::iterator_traits<Iterator>::value_type 
-        char_type;
-        typedef std::basic_string<char_type> string_type;
-
-        //  Every lexer type to be used as a lexer for Spirit has to conform to 
-        //  a public interface .
-        typedef Token token_type;
-        typedef typename Token::id_type id_type;
-        typedef TokenSet token_set;
-        typedef lexertl_iterator<Functor> iterator_type;
-
-    private:
-        // this type is purely used for the iterator_type construction below
-        struct iterator_data_type {
-            boost::lexer::basic_state_machine<char_type> const& state_machine_;
-            boost::lexer::basic_rules<char_type> const& rules_;
-            typename Functor::semantic_actions_type const& actions_;
-        };
-
-    public:
-        //  Return the start iterator usable for iterating over the generated
-        //  tokens.
-        iterator_type begin(Iterator& first, Iterator const& last) const
-        { 
-            if (!init_dfa())
-                return iterator_type();
-                
-            iterator_data_type iterator_data = { state_machine, rules, actions };
-            return iterator_type(iterator_data, first, last);
-        }
-        
-        //  Return the end iterator usable to stop iterating over the generated 
-        //  tokens.
-        iterator_type end() const
-        { 
-            return iterator_type(); 
-        }
-
-    protected:
-        //  Lexer instances can be created by means of a derived class only.
-        lexertl_lexer()
-          : initialized_dfa(false)
-        {
-        }
-
-    public:
-        // interface for token definition management
-        void add_token (char_type const* state, string_type const& tokendef, 
-            std::size_t token_id)
-        {
-            add_state(state);
-            rules.add(state, tokendef, token_id, state);
-            initialized_dfa = false;
-        }
-        void add_token(char_type const* state, token_set& tokset)
-        {
-            add_state(state);
-            rules.add(state, tokset.get_rules());
-            initialized_dfa = false;
-        }
-        
-        // interface for pattern definition management
-        void add_pattern (char_type const* state, string_type const& name,
-            string_type const& patterndef)
-        {
-            add_state(state);
-            rules.add_macro(name.c_str(), patterndef);
-            initialized_dfa = false;
-        }
-        
-        void clear(char_type const* state)
-        {
-            std::size_t s = rules.state(state);
-            if (boost::lexer::npos != s)
-                rules.clear(state);
-            initialized_dfa = false;
-        }
-        std::size_t add_state(char_type const* state)
-        {
-            std::size_t stateid = rules.state(state);
-            if (boost::lexer::npos == stateid) {
-                rules.add_state(state);
-                stateid = rules.state(state);
-                initialized_dfa = false;
-            }
-            return stateid;
-        }
-        string_type initial_state() const 
-        { 
-            return string_type(rules.initial());
-        }
-        
-        //  Register a semantic action with the given id
-        template <typename F>
-        void add_action(std::size_t id, F act)
-        {
-            // If you get compilation errors below stating value_type not being
-            // a member of boost::fusion::unused_type, then you are probably
-            // using semantic actions in your token definition without 
-            // the lexertl_actor_lexer being specified as the base class 
-            // (instead of the lexertl_lexer class).
-            typedef 
-                typename Functor::semantic_actions_type::value_type
-            value_type;
-            
-            typedef typename Functor::wrap_action_type wrapper_type;
-
-            actions.insert(value_type(id, wrapper_type::call(act)));
-        }
-                
-        bool init_dfa() const
-        {
-            if (!initialized_dfa) {
-                state_machine.clear();
-                try {
-                    typedef boost::lexer::basic_generator<char_type> generator;
-                    generator::build (rules, state_machine);
-                    generator::minimise (state_machine);
-
-#if defined(BOOST_SPIRIT_LEXERTL_DEBUG)
-                    boost::lexer::debug::dump(state_machine, std::cerr);
-#endif
-                }
-                catch (std::runtime_error const&) {
-                    return false;
-                }
-                initialized_dfa = true;
-            }
-            return true;
-        }
-
-    private:
-        mutable boost::lexer::basic_state_machine<char_type> state_machine;
-        boost::lexer::basic_rules<char_type> rules;
-        typename Functor::semantic_actions_type actions;
-        mutable bool initialized_dfa;
-
-        template <typename Lexer> 
-        friend bool generate_static(Lexer const&, std::ostream&, char const*);
-    };
-    
-    ///////////////////////////////////////////////////////////////////////////
-    //
-    //  The lexertl_actor_lexer class is another implementation of a Spirit.Lex 
-    //  lexer on top of Ben Hanson's lexertl library as outlined above (For 
-    //  more information about lexertl go here: 
-    //  http://www.benhanson.net/lexertl.html).
-    //
-    //  The only difference to the lexertl_lexer class above is that token_def
-    //  definitions may have semantic (lexer) actions attached while being 
-    //  defined:
-    //
-    //      int w;
-    //      token_def word = "[^ \t\n]+";
-    //      self = word[++ref(w)];        // see example: word_count_lexer
-    //
-    //  This class is supposed to be used as the first and only template 
-    //  parameter while instantiating instances of a lex::lexer_def class.
-    //
-    ///////////////////////////////////////////////////////////////////////////
-    template <
-        typename Token = lexertl_token<>,
-        typename Iterator = typename Token::iterator_type, 
-        typename Functor = lexertl_functor<Token, Iterator, mpl::true_>,
-        typename TokenSet = token_set<lexertl_token_set<Token, Iterator> >
-    >
-    class lexertl_actor_lexer 
-      : public lexertl_lexer<Token, Iterator, Functor, TokenSet>
-    {
-    protected:
-        //  Lexer instances can be created by means of a derived class only.
-        lexertl_actor_lexer() {}
-    };
-    
-}}}
-
-#endif
Deleted: trunk/boost/spirit/home/lex/lexer/lexertl/lexertl_static_functor.hpp
==============================================================================
--- trunk/boost/spirit/home/lex/lexer/lexertl/lexertl_static_functor.hpp	2009-04-26 10:42:24 EDT (Sun, 26 Apr 2009)
+++ (empty file)
@@ -1,386 +0,0 @@
-//  Copyright (c) 2001-2009 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_LEX_LEXER_STATIC_FUNCTOR_FEB_10_2008_0755PM)
-#define BOOST_SPIRIT_LEX_LEXER_STATIC_FUNCTOR_FEB_10_2008_0755PM
-
-#if defined(_MSC_VER) && (_MSC_VER >= 1020)
-#pragma once      // MS compatible compilers support #pragma once
-#endif
-
-#include <boost/mpl/bool.hpp>
-#include <boost/function.hpp>
-#include <boost/range/iterator_range.hpp>
-#include <boost/detail/iterator.hpp>
-#include <boost/detail/workaround.hpp>
-#include <map>
-#include <boost/spirit/home/support/detail/lexer/generator.hpp>
-#include <boost/spirit/home/support/detail/lexer/rules.hpp>
-#include <boost/spirit/home/support/detail/lexer/state_machine.hpp>
-#include <boost/spirit/home/lex/lexer/lexertl/iterator_tokenizer.hpp>
-#include <boost/spirit/home/lex/lexer/lexertl/wrap_action.hpp>
-
-#if 0 != __COMO_VERSION__ || !BOOST_WORKAROUND(BOOST_MSVC, <= 1310)
-#define BOOST_SPIRIT_STATIC_EOF 1
-#define BOOST_SPIRIT_EOF_PREFIX static
-#else
-#define BOOST_SPIRIT_EOF_PREFIX 
-#endif
-
-namespace boost { namespace spirit { namespace lex 
-{ 
-    namespace detail
-    {
-        ///////////////////////////////////////////////////////////////////////
-        template <typename Iterator, typename HasActors, typename HasState>
-        struct Data;    // no default specialization
-        
-        ///////////////////////////////////////////////////////////////////////
-        //  doesn't support no state and no actors
-        template <typename Iterator>
-        struct Data<Iterator, mpl::false_, mpl::false_>
-        {
-            typedef std::size_t state_type;
-            typedef iterator_range<Iterator> iterpair_type;
-            typedef typename 
-                boost::detail::iterator_traits<Iterator>::value_type 
-            char_type;
-            
-            typedef std::size_t (*next_token_functor)(std::size_t&, 
-                Iterator const&, Iterator&, Iterator const&);
-
-            typedef unused_type semantic_actions_type;
-
-            typedef 
-                detail::wrap_action<unused_type, iterpair_type, Data>
-            wrap_action_type;
-
-            // initialize the shared data 
-            template <typename IterData>
-            Data (IterData const& data_, Iterator& first_, Iterator const& last_)
-              : next_token(data_.next_), first(first_), last(last_)
-            {}
-
-            std::size_t next(Iterator& end)
-            {
-                typedef basic_iterator_tokeniser<Iterator> tokenizer;
-                std::size_t state;
-                return next_token(state, first, end, last);
-            }
-
-            // nothing to invoke, so this is empty
-            bool invoke_actions(std::size_t, Iterator const&) 
-            {
-                return true;    // always accept
-            }
-
-            std::size_t get_state() const { return 0; }
-            void set_state_name (char const*) {}
-
-            next_token_functor next_token;
-            Iterator& first;
-            Iterator last;
-        };
-        
-        ///////////////////////////////////////////////////////////////////////
-        //  doesn't support no actors
-        template <typename Iterator>
-        struct Data<Iterator, mpl::false_, mpl::true_>
-          : Data<Iterator, mpl::false_, mpl::false_>
-        {
-            typedef Data<Iterator, mpl::false_, mpl::false_> base_type;
-
-            typedef typename base_type::state_type state_type;
-            typedef typename base_type::char_type char_type;
-            typedef 
-                typename base_type::semantic_actions_type 
-            semantic_actions_type;
-
-            // initialize the shared data 
-            template <typename IterData>
-            Data (IterData const& data_, Iterator& first_, Iterator const& last_)
-              : base_type(data_, first_, last_), state(0)
-            {}
-
-            std::size_t next(Iterator& end)
-            {
-                typedef basic_iterator_tokeniser<Iterator> tokenizer;
-                return this->next_token(state, this->first, end, this->last);
-            }
-
-            std::size_t& get_state() { return state; }
-            void set_state_name (char_type const* new_state) 
-            { 
-                std::size_t state_id = this->rules.state(new_state);
-                BOOST_ASSERT(state_id != boost::lexer::npos);
-                if (state_id != boost::lexer::npos)
-                    state = state_id;
-            }
-
-            std::size_t state;
-        };
-        
-        ///////////////////////////////////////////////////////////////////////
-        //  does support actors, but may have no state
-        template <typename Iterator, typename HasState>
-        struct Data<Iterator, mpl::true_, HasState> 
-          : Data<Iterator, mpl::false_, HasState>
-        {
-            typedef Data<Iterator, mpl::false_, HasState> base_type;
-
-            typedef iterator_range<Iterator> iterpair_type;
-            typedef typename base_type::state_type state_type;
-            typedef typename base_type::char_type char_type;
-
-            typedef void functor_type(iterpair_type, std::size_t, bool&, Data&);
-            typedef boost::function<functor_type> functor_wrapper_type;
-            typedef std::multimap<std::size_t, functor_wrapper_type> 
-                semantic_actions_type;
-
-            typedef 
-                detail::wrap_action<functor_wrapper_type, iterpair_type, Data>
-            wrap_action_type;
-
-            template <typename IterData>
-            Data (IterData const& data_, Iterator& first_, Iterator const& last_)
-              : base_type(data_, first_, last_),
-                actions(data_.actions_)
-            {}
-
-            // invoke attached semantic actions, if defined
-            bool invoke_actions(std::size_t id, Iterator const& end)
-            {
-                if (actions.empty()) 
-                    return true;  // nothing to invoke, continue with 'match'
-
-                iterpair_type itp(this->first, end);
-                bool match = true;
-                
-                typedef typename 
-                    semantic_actions_type::const_iterator 
-                iterator_type;
-                
-                std::pair<iterator_type, iterator_type> p = actions.equal_range(id);
-                while (p.first != p.second)
-                {
-                    ((*p.first).second)(itp, id, match, *this);
-                    if (!match)
-                        return false;   // return a 'no-match'
-                    ++p.first;
-                }
-                return true;    // normal execution
-            }
-            
-            semantic_actions_type const& actions;
-        };
-    }
-    
-    ///////////////////////////////////////////////////////////////////////////
-    //
-    //  lexertl_static_functor is a template usable as the functor object for 
-    //  the multi_pass iterator allowing to wrap a lexertl based dfa into a 
-    //  iterator based interface.
-    //  
-    //    Iterator:   the type of the underlying iterator
-    //    Token:      the type of the tokens produced by this functor
-    //                this needs to expose a constructor with the following
-    //                prototype:
-    //
-    //                Token(std::size_t id, std::size_t state, 
-    //                      Iterator start, Iterator end)
-    //
-    //                where 'id' is the token id, state is the lexer state,
-    //                this token has been matched in, and 'first' and 'end'  
-    //                mark the start and the end of the token with respect 
-    //                to the underlying character stream.
-    //    SupportsActors:
-    //                this is expected to be a mpl::bool_, if mpl::true_ the
-    //                lexertl_static_functor invokes functors which 
-    //                (optionally) have been attached to the token definitions.
-    //    SupportState:
-    //                this is expected to be a mpl::bool_, if mpl::true_ the
-    //                lexertl_functor supports different lexer states, 
-    //                otherwise no lexer state is supported.
-    //
-    ///////////////////////////////////////////////////////////////////////////
-    template <typename Token, 
-        typename Iterator = typename Token::iterator_type, 
-        typename SupportsActors = mpl::false_,
-        typename SupportsState = typename Token::has_state>
-    class lexertl_static_functor
-    {
-    public:
-        typedef typename 
-            boost::detail::iterator_traits<Iterator>::value_type 
-        char_type;
-
-    private:
-        // Needed by compilers not implementing the resolution to DR45. For
-        // reference, see
-        // http://www.open-std.org/JTC1/SC22/WG21/docs/cwg_defects.html#45.
-        template <typename Iterator_, typename HasActors, typename HasState> 
-        friend struct detail::Data;
-
-        // Helper template allowing to assign a value on exit
-        template <typename T>
-        struct assign_on_exit
-        {
-            assign_on_exit(T& dst_, T const& src_)
-              : dst(dst_), src(src_)
-            {}
-            ~assign_on_exit()
-            {
-                dst = src;
-            }
-            
-            T& dst;
-            T const& src;
-        };
-        
-    public:
-        lexertl_static_functor()
-#if defined(__PGI)
-          : eof()
-#endif 
-        {}
-
-#if BOOST_WORKAROUND(BOOST_MSVC, <= 1310)
-        // somehow VC7.1 needs this (meaningless) assignment operator
-        lexertl_functor& operator=(lexertl_functor const& rhs)
-        {
-            return *this;
-        }
-#endif
-
-        ///////////////////////////////////////////////////////////////////////
-        // interface to the multi_pass_policies::split_functor_input policy
-        typedef Token result_type;
-        typedef lexertl_static_functor unique;
-        typedef detail::Data<Iterator, SupportsActors, SupportsState> shared;
-        
-        BOOST_SPIRIT_EOF_PREFIX result_type const eof;
-    
-        ///////////////////////////////////////////////////////////////////////
-        typedef Iterator iterator_type;
-        typedef typename shared::semantic_actions_type semantic_actions_type;
-        typedef typename shared::next_token_functor next_token_functor;
-
-        // this is needed to wrap the semantic actions in a proper way
-        typedef typename shared::wrap_action_type wrap_action_type;
-
-        ///////////////////////////////////////////////////////////////////////
-        template <typename MultiPass>
-        static result_type& get_next(MultiPass& mp, result_type& result)
-        {
-            shared& data = mp.shared->ftor;
-            if (data.first == data.last) 
-#if defined(BOOST_SPIRIT_STATIC_EOF)
-                return result = eof;
-#else
-                return result = mp.ftor.eof;
-#endif
-
-            Iterator end = data.first;
-            std::size_t id = data.next(end);
-            
-            if (boost::lexer::npos == id) {   // no match
-#if defined(BOOST_SPIRIT_LEXERTL_DEBUG)
-                std::string next;
-                Iterator it = data.first;
-                for (std::size_t i = 0; i < 10 && it != data.last; ++it, ++i)
-                    next += *it;
-
-                std::cerr << "Not matched, in state: " << data.state 
-                          << ", lookahead: >" << next << "<" << std::endl;
-#endif
-                return result = result_type(0);
-            }
-            else if (0 == id) {         // EOF reached
-#if defined(BOOST_SPIRIT_STATIC_EOF)
-                return result = eof;
-#else
-                return result = mp.ftor.eof;
-#endif
-            }
-            
-#if defined(BOOST_SPIRIT_LEXERTL_DEBUG)
-            {
-                std::string next;
-                Iterator it = data.first;
-                for (std::size_t i = 0; i < 10 && it != data.last; ++it, ++i)
-                    next += *it;
-
-                std::cerr << "Matched: " << id << ", in state: " 
-                          << data.state << ", string: >" 
-                          << std::basic_string<char_type>(data.first, end) << "<"
-                          << ", lookahead: >" << next << "<" << std::endl;
-            }
-#endif
-            // invoke_actions might change state
-            std::size_t state = data.get_state();
-
-            // invoke attached semantic actions, if there are any defined
-            if (!data.invoke_actions(id, end))
-            {
-                // one of the semantic actions signaled no-match
-                return result = result_type(0); 
-            }
-            
-            // return matched token, advancing 'data.first' past the matched 
-            // sequence
-            assign_on_exit<Iterator> on_exit(data.first, end);
-            return result = result_type(id, state, data.first, end);
-        }
-
-        // set_state is propagated up to the iterator interface, allowing to 
-        // manipulate the current lexer state through any of the exposed 
-        // iterators.
-        template <typename MultiPass>
-        static std::size_t set_state(MultiPass& mp, std::size_t state_) 
-        { 
-            std::size_t oldstate = mp.shared->ftor.state;
-            mp.shared->ftor.state = state_;
-
-#if defined(BOOST_SPIRIT_LEXERTL_DEBUG)
-            std::cerr << "Switching state from: " << oldstate 
-                      << " to: " << state_
-                      << std::endl;
-#endif
-            return oldstate; 
-        }
-        
-        template <typename MultiPass>
-        static std::size_t 
-        map_state(MultiPass const& mp, char_type const* statename)  
-        { 
-            return mp.shared->ftor.rules.state(statename);
-        }
-        
-        // we don't need this, but it must be there
-        template <typename MultiPass>
-        static void destroy(MultiPass const&)
-        {}  
-    };
-
-#if defined(BOOST_SPIRIT_STATIC_EOF)
-    ///////////////////////////////////////////////////////////////////////////
-    //  eof token
-    ///////////////////////////////////////////////////////////////////////////
-    template <typename Token, typename Iterator, typename SupportsActors, 
-        typename SupportsState>
-    typename lexertl_static_functor<
-            Token, Iterator, SupportsActors, SupportsState>::result_type const
-        lexertl_static_functor<
-                Token, Iterator, SupportsActors, SupportsState>::eof = 
-            typename lexertl_static_functor<
-                Token, Iterator, SupportsActors, SupportsState>::result_type();
-#endif
-
-}}}
-
-#undef BOOST_SPIRIT_EOF_PREFIX
-#undef BOOST_SPIRIT_STATIC_EOF
-
-#endif
Deleted: trunk/boost/spirit/home/lex/lexer/lexertl/lexertl_static_lexer.hpp
==============================================================================
--- trunk/boost/spirit/home/lex/lexer/lexertl/lexertl_static_lexer.hpp	2009-04-26 10:42:24 EDT (Sun, 26 Apr 2009)
+++ (empty file)
@@ -1,301 +0,0 @@
-//  Copyright (c) 2001-2009 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_LEX_LEXERTL_STATIC_LEXER_FEB_10_2008_0753PM)
-#define BOOST_SPIRIT_LEX_LEXERTL_STATIC_LEXER_FEB_10_2008_0753PM
-
-#if defined(_MSC_VER) && (_MSC_VER >= 1020)
-#pragma once      // MS compatible compilers support #pragma once
-#endif
-
-#include <boost/spirit/home/support/safe_bool.hpp>
-#include <boost/spirit/home/lex/lexer/lexer_fwd.hpp>
-#include <boost/spirit/home/lex/lexer/lexertl/lexertl_token.hpp>
-#include <boost/spirit/home/lex/lexer/lexertl/lexertl_static_functor.hpp>
-#include <boost/spirit/home/lex/lexer/lexertl/lexertl_iterator.hpp>
-#if defined(BOOST_SPIRIT_LEXERTL_DEBUG)
-#include <boost/spirit/home/support/detail/lexer/debug.hpp>
-#endif
-
-namespace boost { namespace spirit { namespace lex 
-{ 
-    ///////////////////////////////////////////////////////////////////////////
-    namespace detail
-    {
-        ///////////////////////////////////////////////////////////////////////
-        //  The escape function returns the string representation of the given 
-        //  character value, possibly escaped with a backslash character, to 
-        //  allow it being safely used in a regular expression definition.
-        //
-        //  In the case of the static lexer this function does nothing.
-        ///////////////////////////////////////////////////////////////////////
-        template <typename Char>
-        inline std::basic_string<Char> escape(Char ch) 
-        { 
-            return std::basic_string<Char>(1, ch);
-        }
-    }
-
-    ///////////////////////////////////////////////////////////////////////////
-    // forward declaration only
-    namespace static_ 
-    {
-        //  Both items, the table of names and the function to return the next 
-        //  token have to be generated using the function generate_static().
-        //
-        //  This is a forward declaration for the generated static table of 
-        //  valid state names
-        extern char const* const lexer_state_names[];
-
-        //  This is the forward declaration of the generated function to be 
-        //  called to get the next token. 
-        template <typename Iterator>
-        std::size_t next_token (std::size_t& state_, Iterator const& start_, 
-            Iterator ¤t_, Iterator const& end_);
-    }
-    
-    ///////////////////////////////////////////////////////////////////////////
-    //  lexertl_static_token_set
-    ///////////////////////////////////////////////////////////////////////////
-    template <typename Token, typename Iterator = typename Token::iterator_type>
-    class lexertl_static_token_set
-    {
-    protected:
-        typedef typename 
-            boost::detail::iterator_traits<Iterator>::value_type 
-        char_type;
-        typedef std::basic_string<char_type> string_type;
-
-    public:
-        typedef Token token_type;
-        typedef typename Token::id_type id_type;
-
-        // interface for token definition management
-        void add_token (char_type const* state, string_type const& tokendef, 
-            std::size_t token_id)
-        {}
-        
-        // interface for pattern definition management
-        void add_pattern (char_type const* state, string_type const& name,
-            string_type const& patterndef)
-        {}
-        
-        void clear() {}
-         
-        std::size_t add_state(char_type const* state)
-        {
-            return 0;
-        }
-        string_type initial_state() const 
-        { 
-            return lex::static_::lexer_state_names[0];
-        }
-    };
-
-    ///////////////////////////////////////////////////////////////////////////
-    //
-    //  Every lexer type to be used as a lexer for Spirit has to conform to 
-    //  the following public interface:
-    //
-    //    typedefs: 
-    //        iterator_type   The type of the iterator exposed by this lexer.
-    //        token_type      The type of the tokens returned from the exposed 
-    //                        iterators.
-    //        token_set       The type of the token set representing a lexer 
-    //                        state.
-    //
-    //    functions:
-    //        default constructor
-    //                        Since lexers are instantiated as base classes 
-    //                        only it might be a good idea to make this 
-    //                        constructor protected.
-    //        begin, end      Return a pair of iterators, when dereferenced
-    //                        returning the sequence of tokens recognized in 
-    //                        the input stream given as the parameters to the 
-    //                        begin() function.
-    //        add_token       Should add the definition of a token to be 
-    //                        recognized by this lexer.
-    //        clear           Should delete all current token definitions
-    //                        associated with the given state of this lexer 
-    //                        object.
-    //
-    //    template parameters:
-    //        Token           The type of the tokens to be returned from the
-    //                        exposed token iterator.
-    //        Iterator        The type of the iterator used to access the
-    //                        underlying character stream.
-    //        Functor         The type of the InputPolicy to use to instantiate
-    //                        the multi_pass iterator type to be used as the 
-    //                        token iterator (returned from begin()/end()).
-    //        TokenSet        The type of the token set to use in conjunction 
-    //                        with this lexer type. This is used for the 
-    //                        token_set typedef described above only.
-    //
-    ///////////////////////////////////////////////////////////////////////////
-    
-    ///////////////////////////////////////////////////////////////////////////
-    //
-    //  The lexertl_static_lexer class is a implementation of a Spirit.Lex 
-    //  lexer on top of Ben Hanson's lexertl library (For more information 
-    //  about lexertl go here: http://www.benhanson.net/lexertl.html). 
-    //
-    //  This class is designed to be used in conjunction with a generated, 
-    //  static lexer. For more information see the documentation (The Static 
-    //  Lexer Model).
-    //
-    //  This class is supposed to be used as the first and only template 
-    //  parameter while instantiating instances of a lex::lexer_def class.
-    //
-    ///////////////////////////////////////////////////////////////////////////
-    template <
-        typename Token = lexertl_token<>,
-        typename Iterator = typename Token::iterator_type, 
-        typename Functor = lexertl_static_functor<Token, Iterator, mpl::false_>,
-        typename TokenSet = token_set<lexertl_static_token_set<Token, Iterator> >
-    >
-    class lexertl_static_lexer 
-      : public safe_bool<lexertl_static_lexer<Token, Iterator, Functor, TokenSet> >
-    {
-    public:
-        // operator_bool() is needed for the safe_bool base class
-        bool operator_bool() const { return true; }
-        
-        typedef typename
-            boost::detail::iterator_traits<Iterator>::value_type 
-        char_type;
-        typedef std::basic_string<char_type> string_type;
-
-        //  Every lexer type to be used as a lexer for Spirit has to conform to 
-        //  a public interface 
-        typedef Token token_type;
-        typedef typename Token::id_type id_type;
-        typedef TokenSet token_set;
-        typedef lexertl_iterator<Functor> iterator_type;
-
-    private:        
-        // this type is purely used for the iterator_type construction below
-        struct iterator_data_type {
-            typename Functor::next_token_functor next_;
-            typename Functor::semantic_actions_type const& actions_;
-        };
-
-    public:
-        //  Return the start iterator usable for iterating over the generated
-        //  tokens, the Functor F is called to match the next token from the 
-        //  input.
-        template <typename F>
-        iterator_type begin(Iterator& first, Iterator const& last, F next) const
-        { 
-            iterator_data_type iterator_data = { next, actions };
-            return iterator_type(iterator_data, first, last);
-        }
-        
-        //  Return the start iterator usable for iterating over the generated
-        //  tokens, the generated function next_token(...) is called to match 
-        //  the next token from the input.
-        template <typename Iterator_>
-        iterator_type begin(Iterator_& first, Iterator_ const& last) const
-        { 
-            iterator_data_type iterator_data = 
-                { &lex::static_::next_token<Iterator_>, actions };
-            return iterator_type(iterator_data, first, last);
-        }
-
-        //  Return the end iterator usable to stop iterating over the generated 
-        //  tokens.
-        iterator_type end() const
-        { 
-            return iterator_type(); 
-        }
-
-    protected:
-        //  Lexer instances can be created by means of a derived class only.
-        lexertl_static_lexer() {}
-
-    public:
-        // interface for token definition management
-        void add_token (char_type const* state, string_type const& tokendef, 
-            std::size_t token_id)
-        {}
-        void add_token(char_type const* state, token_set& tokset)
-        {}
-        
-        // interface for pattern definition management
-        void add_pattern (char_type const* state, string_type const& name,
-            string_type const& patterndef)
-        {}
-        
-        void clear(char_type const* state) {}
-        
-        std::size_t add_state(char_type const* state)
-        {
-            return 0;
-        }
-        string_type initial_state() const 
-        { 
-            return lex::static_::lexer_state_names[0];
-        }
-        
-        // register a semantic action with the given id
-        template <typename F>
-        void add_action(std::size_t id, F act) 
-        {
-            // If you get compilation errors below stating value_type not being
-            // a member of boost::fusion::unused_type, then you are probably
-            // using semantic actions in your token definition without 
-            // the lexertl_static_actor_lexer being specified as the base class 
-            // (instead of the lexertl_static_lexer class).
-            typedef 
-                typename Functor::semantic_actions_type::value_type
-            value_type;
-            
-            actions.insert(value_type(id, act));
-        }
-
-        bool init_dfa() const { return true; }
-                    
-    private:
-        typename Functor::semantic_actions_type actions;
-    };
-    
-    ///////////////////////////////////////////////////////////////////////////
-    //
-    //  The lexertl_static_actor_lexer class is another implementation of a 
-    //  Spirit.Lex lexer on top of Ben Hanson's lexertl library as outlined 
-    //  above (For more information about lexertl go here: 
-    //  http://www.benhanson.net/lexertl.html).
-    //
-    //  Just as the lexertl_static_lexer class it is meant to be used with 
-    //  a statically generated lexer as outlined above.
-    //
-    //  The only difference to the lexertl_static_lexer class above is that 
-    //  token_def definitions may have semantic (lexer) actions attached while 
-    //  being defined:
-    //
-    //      int w;
-    //      token_def<> word = "[^ \t\n]+";
-    //      self = word[++ref(w)];        // see example: word_count_lexer
-    //
-    //  This class is supposed to be used as the first and only template 
-    //  parameter while instantiating instances of a lex::lexer_def class.
-    //
-    ///////////////////////////////////////////////////////////////////////////
-    template <
-        typename Token = lexertl_token<>,
-        typename Iterator = typename Token::iterator_type, 
-        typename Functor = lexertl_static_functor<Token, Iterator, mpl::true_>,
-        typename TokenSet = token_set<lexertl_static_token_set<Token, Iterator> >
-    >
-    class lexertl_static_actor_lexer 
-      : public lexertl_static_lexer<Token, Iterator, Functor, TokenSet>
-    {
-    protected:
-        // Lexer instances can be created by means of a derived class only.
-        lexertl_static_actor_lexer() {}
-    };
-    
-}}}
-
-#endif
Deleted: trunk/boost/spirit/home/lex/lexer/lexertl/lexertl_token.hpp
==============================================================================
--- trunk/boost/spirit/home/lex/lexer/lexertl/lexertl_token.hpp	2009-04-26 10:42:24 EDT (Sun, 26 Apr 2009)
+++ (empty file)
@@ -1,430 +0,0 @@
-//  Copyright (c) 2001-2009 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_LEX_LEXERTL_TOKEN_FEB_10_2008_0751PM)
-#define BOOST_SPIRIT_LEX_LEXERTL_TOKEN_FEB_10_2008_0751PM
-
-#if defined(_MSC_VER) && (_MSC_VER >= 1020)
-#pragma once      // MS compatible compilers support #pragma once
-#endif
-
-#include <boost/spirit/home/qi/detail/assign_to.hpp>
-#include <boost/spirit/home/support/placeholders.hpp>
-#include <boost/spirit/home/support/detail/lexer/generator.hpp>
-#include <boost/spirit/home/support/detail/lexer/rules.hpp>
-#include <boost/spirit/home/support/detail/lexer/consts.hpp>
-#include <boost/fusion/include/vector.hpp>
-#include <boost/fusion/include/at.hpp>
-#include <boost/fusion/include/value_at.hpp>
-#include <boost/detail/iterator.hpp>
-#include <boost/variant.hpp>
-#include <boost/mpl/vector.hpp>
-#include <boost/mpl/insert.hpp>
-#include <boost/mpl/begin.hpp>
-#include <boost/mpl/bool.hpp>
-#include <boost/mpl/identity.hpp>
-#include <boost/mpl/if.hpp>
-#include <boost/range/iterator_range.hpp>
-
-namespace boost { namespace spirit { namespace lex 
-{ 
-    ///////////////////////////////////////////////////////////////////////////
-    //
-    //  The lexertl_token is the type of the objects returned by default by the 
-    //  lexertl_iterator.
-    //
-    //    template parameters:
-    //        Iterator        The type of the iterator used to access the
-    //                        underlying character stream.
-    //        AttributeTypes  A mpl sequence containing the types of all 
-    //                        required different token values to be supported 
-    //                        by this token type.
-    //        HasState        A mpl::bool_ indicating, whether this token type
-    //                        should support lexer states.
-    //
-    //  It is possible to use other token types with the spirit::lex 
-    //  framework as well. If you plan to use a different type as your token 
-    //  type, you'll need to expose the following things from your token type 
-    //  to make it compatible with spirit::lex:
-    //
-    //    typedefs
-    //        iterator_type   The type of the iterator used to access the
-    //                        underlying character stream.
-    //
-    //        id_type         The type of the token id used.
-    //
-    //    methods
-    //        default constructor
-    //                        This should initialize the token as an end of 
-    //                        input token.
-    //        constructors    The prototype of the other required 
-    //                        constructors should be:
-    //
-    //              token(int)
-    //                        This constructor should initialize the token as 
-    //                        an invalid token (not carrying any specific 
-    //                        values)
-    //
-    //              where:  the int is used as a tag only and its value is 
-    //                      ignored
-    //
-    //                        and:
-    //
-    //              token(std::size_t id, std::size_t state, 
-    //                    iterator_type first, iterator_type last);
-    //
-    //              where:  id:           token id
-    //                      state:        lexer state this token was matched in
-    //                      first, last:  pair of iterators marking the matched 
-    //                                    range in the underlying input stream 
-    //
-    //        accessors
-    //              id()      return the token id of the matched input sequence
-    //
-    //              state()   return the lexer state this token was matched in
-    //
-    //              value()   return the token value
-    //
-    //  Additionally, you will have to implement a couple of helper functions
-    //  in the same namespace as the token type: a comparison operator==() to 
-    //  compare your token instances, a token_is_valid() function and different 
-    //  construct() function overloads as described below.
-    //
-    ///////////////////////////////////////////////////////////////////////////
-    template <
-        typename Iterator = char const*, 
-        typename AttributeTypes = mpl::vector0<>, 
-        typename HasState = mpl::true_
-    >
-    struct lexertl_token;
-
-    ///////////////////////////////////////////////////////////////////////////
-    //  This specialization of the token type doesn't contain any item data and
-    //  doesn't support working with lexer states.
-    ///////////////////////////////////////////////////////////////////////////
-    template <typename Iterator>
-    struct lexertl_token<Iterator, omitted, mpl::false_>
-    {
-        typedef Iterator iterator_type;
-        typedef mpl::false_ has_state;
-        typedef std::size_t id_type;
-        
-        //  default constructed tokens correspond to EOI tokens
-        lexertl_token() 
-          : id_(boost::lexer::npos) 
-        {}
-        
-        //  construct an invalid token
-        lexertl_token(int)
-          : id_(0) 
-        {}
-        
-        lexertl_token(std::size_t id, std::size_t)
-          : id_(id)
-        {}
-        
-        lexertl_token(std::size_t id, std::size_t, 
-                Iterator const&, Iterator const&)
-          : id_(id)
-        {}
-        
-        //  this default conversion operator is needed to allow the direct 
-        //  usage of tokens in conjunction with the primitive parsers defined 
-        //  in Qi
-        operator std::size_t() const { return id_; }
-        
-        std::size_t id() const { return id_; }
-        std::size_t state() const { return 0; }   // always '0' (INITIAL state)
-
-    protected:
-        std::size_t id_;         // token id, 0 if nothing has been matched
-    };
-    
-    ///////////////////////////////////////////////////////////////////////////
-    //  This specialization of the token type doesn't contain any item data but
-    //  supports working with lexer states.
-    ///////////////////////////////////////////////////////////////////////////
-    template <typename Iterator>
-    struct lexertl_token<Iterator, omitted, mpl::true_>
-      : lexertl_token<Iterator, omitted, mpl::false_>
-    {
-    private:
-        typedef lexertl_token<Iterator, omitted, mpl::false_> base_type;
-
-    public:
-        typedef Iterator iterator_type;
-        typedef mpl::true_ has_state;
-
-        //  default constructed tokens correspond to EOI tokens
-        lexertl_token() 
-          : state_(boost::lexer::npos) 
-        {}
-        
-        //  construct an invalid token
-        lexertl_token(int)
-          : base_type(0), state_(boost::lexer::npos) 
-        {}
-        
-        lexertl_token(std::size_t id, std::size_t state)
-          : base_type(id, boost::lexer::npos), state_(state)
-        {}
-        
-        lexertl_token(std::size_t id, std::size_t state, 
-                Iterator const&, Iterator const&)
-          : base_type(id, boost::lexer::npos), state_(state)
-        {}
-        
-        std::size_t state() const { return state_; }
-
-    protected:
-        std::size_t state_;      // lexer state this token was matched in
-    };
-    
-    ///////////////////////////////////////////////////////////////////////////
-    //  The generic version of the lexertl_token type derives from the 
-    //  specialization above and adds a single data member holding the item 
-    //  data carried by the token instance.
-    ///////////////////////////////////////////////////////////////////////////
-    namespace detail
-    {
-        ///////////////////////////////////////////////////////////////////////
-        //  Metafunction to calculate the type of the variant data item to be 
-        //  stored with each token instance.
-        //
-        //  Note: The iterator pair needs to be the first type in the list of 
-        //        types supported by the generated variant type (this is being 
-        //        used to identify whether the stored data item in a particular 
-        //        token instance needs to be converted from the pair of 
-        //        iterators (see the first of the construct() functions below).
-        ///////////////////////////////////////////////////////////////////////
-        template <typename IteratorPair, typename AttributeTypes>
-        struct token_value_typesequence
-        {
-            typedef typename 
-                mpl::insert<
-                    AttributeTypes, 
-                    typename mpl::begin<AttributeTypes>::type, 
-                    IteratorPair
-                >::type
-            sequence_type;
-            typedef typename make_variant_over<sequence_type>::type type;
-        };
-        
-        ///////////////////////////////////////////////////////////////////////
-        //  The type of the data item stored with a token instance is defined 
-        //  by the template parameter 'AttributeTypes' and may be:
-        //  
-        //     omitted:           no data item is stored with the token 
-        //                        instance (this is handled by the 
-        //                        specializations of the lexertl_token class
-        //                        below)
-        //     mpl::vector0<>:    each token instance stores a pair of 
-        //                        iterators pointing to the matched input 
-        //                        sequence
-        //     mpl::vector<...>:  each token instance stores a variant being 
-        //                        able to store the pair of iterators pointing 
-        //                        to the matched input sequence, or any of the 
-        //                        types a specified in the mpl::vector<>
-        //
-        //  All this is done to ensure the token type is as small (in terms 
-        //  of its byte-size) as possible.
-        ///////////////////////////////////////////////////////////////////////
-        template <typename IteratorPair, typename AttributeTypes>
-        struct token_value_type
-        {
-            typedef 
-                typename mpl::eval_if<
-                    is_same<AttributeTypes, mpl::vector0<> >,
-                    mpl::identity<IteratorPair>,
-                    token_value_typesequence<IteratorPair, AttributeTypes>
-                >::type 
-            type;
-        };
-    }
-
-    template <typename Iterator, typename AttributeTypes, typename HasState>
-    struct lexertl_token : lexertl_token<Iterator, omitted, HasState>
-    {
-    private: // precondition assertions
-#if !BOOST_WORKAROUND(BOOST_MSVC, <= 1300)
-        BOOST_STATIC_ASSERT((mpl::is_sequence<AttributeTypes>::value || 
-                            is_same<AttributeTypes, omitted>::value));
-#endif
-        typedef lexertl_token<Iterator, omitted, HasState> base_type;
-        
-    protected: 
-        //  If no additional token value types are given, the the token will 
-        //  hold the plain pair of iterators pointing to the matched range
-        //  in the underlying input sequence. Otherwise the token value is 
-        //  stored as a variant and will again hold the pair of iterators but
-        //  is able to hold any of the given data types as well. The conversion 
-        //  from the iterator pair to the required data type is done when it is
-        //  accessed for the first time.
-        typedef iterator_range<Iterator> iterpair_type;
-        typedef 
-            typename detail::token_value_type<iterpair_type, AttributeTypes>::type 
-        token_value_type;
-
-    public:
-        typedef Iterator iterator_type;
-
-        //  default constructed tokens correspond to EOI tokens
-        lexertl_token() 
-          : value_(iterpair_type(iterator_type(), iterator_type())) 
-        {}
-        
-        //  construct an invalid token
-        lexertl_token(int)
-          : base_type(0), value_(iterpair_type(iterator_type(), iterator_type())) 
-        {}
-        
-        lexertl_token(std::size_t id, std::size_t state, 
-                Iterator first, Iterator last)
-          : base_type(id, state), value_(iterpair_type(first, last))
-        {}
-
-        token_value_type& value() { return value_; }
-        token_value_type const& value() const { return value_; }
-        
-    protected:
-        token_value_type value_; // token value, by default a pair of iterators
-    };
-    
-    ///////////////////////////////////////////////////////////////////////////
-    //  tokens are considered equal, if their id's match (these are unique)
-    template <typename Iterator, typename AttributeTypes, typename HasState>
-    inline bool 
-    operator== (lexertl_token<Iterator, AttributeTypes, HasState> const& lhs, 
-                lexertl_token<Iterator, AttributeTypes, HasState> const& rhs)
-    {
-        return lhs.id() == rhs.id();
-    }
-    
-    ///////////////////////////////////////////////////////////////////////////
-    //  This overload is needed by the multi_pass/functor_input_policy to 
-    //  validate a token instance. It has to be defined in the same namespace 
-    //  as the token class itself to allow ADL to find it.
-    ///////////////////////////////////////////////////////////////////////////
-    template <typename Iterator, typename AttributeTypes, typename HasState>
-    inline bool 
-    token_is_valid(lexertl_token<Iterator, AttributeTypes, HasState> const& t)
-    {
-        return 0 != t.id() && std::size_t(boost::lexer::npos) != t.id();
-    }
-    
-    ///////////////////////////////////////////////////////////////////////////
-    //  We have to provide overloads for the construct() function allowing
-    //  to extract the needed value from the token. These overloads have to be
-    //  defined in the same namespace as the token class itself to allow ADL to 
-    //  find them.
-    ///////////////////////////////////////////////////////////////////////////
-    
-    //  This is called from the parse function of token_def if the token_def
-    //  has been defined to carry a special attribute type
-    template <typename Attribute, typename Iterator, typename AttributeTypes,
-        typename HasState>
-    inline void construct(Attribute& attr, 
-        lexertl_token<Iterator, AttributeTypes, HasState>& t)
-    {
-    //  The goal of this function is to avoid the conversion of the pair of
-    //  iterators (to the matched character sequence) into the token value 
-    //  of the required type being done more than once. For this purpose it 
-    //  checks whether the stored value type is still the default one (pair 
-    //  of iterators) and if yes, replaces the pair of iterators with the 
-    //  converted value to be returned from subsequent calls.
-        
-        if (0 == t.value().which()) {
-        //  first access to the token value
-            typedef iterator_range<Iterator> iterpair_type;
-            iterpair_type const& ip = get<iterpair_type>(t.value());
-            
-        // Interestingly enough we use the assign_to() framework defined in 
-        // Spirit.Qi allowing to convert the pair of iterators to almost any 
-        // required type (assign_to(), if available, uses the standard Spirit 
-        // parsers to do the conversion, and falls back to boost::lexical_cast
-        // otherwise).
-            qi::detail::assign_to(ip.begin(), ip.end(), attr);
-
-        //  If you get an error during the compilation of the following 
-        //  assignment expression, you probably forgot to list one or more 
-        //  types used as token value types (in your token_def<...> 
-        //  definitions) in your definition of the token class. I.e. any token 
-        //  value type used for a token_def<...> definition has to be listed 
-        //  during the declaration of the token type to use. For instance let's 
-        //  assume we have two token_def's:
-        //
-        //      token_def<int> number; number = "...";
-        //      token_def<std::string> identifier; identifier = "...";
-        //
-        //  Then you'll have to use the following token type definition 
-        //  (assuming you are using the lexertl_token class):
-        //
-        //      typedef mpl::vector<int, std::string> token_values;
-        //      typedef lexertl_token<base_iter_type, token_values> token_type;
-        //
-        //  where: base_iter_type is the iterator type used to expose the 
-        //         underlying input stream.
-        //
-        //  This token_type has to be used as the second template parameter 
-        //  to the lexer class:
-        //
-        //      typedef lexertl_lexer<base_iter_type, token_type> lexer_type;
-        //
-        //  again, assuming you're using the lexertl_lexer<> template for your 
-        //  tokenization.
-        
-            t.value() = attr;   // re-assign value
-        }
-        else {
-        // reuse the already assigned value
-            qi::detail::assign_to(get<Attribute>(t.value()), attr);
-        }
-    }
-    
-    //  This is called from the parse function of token_def if the token type
-    //  has no special attribute type assigned 
-    template <typename Attribute, typename Iterator, typename HasState>
-    inline void construct(Attribute& attr, 
-        lexertl_token<Iterator, mpl::vector0<>, HasState>& t)
-    {
-    //  The default type returned by the token_def parser component (if it
-    //  has no token value type assigned) is the pair of iterators to the 
-    //  matched character sequence.
-        
-        qi::detail::assign_to(t.value().begin(), t.value().end(), attr);
-    }
-    
-    //  This is called from the parse function of token_def if the token type
-    //  has been explicitly omitted (i.e. no attribute value is used), which
-    //  essentially means that every attribute gets initialized using default 
-    //  constructed values.
-    template <typename Attribute, typename Iterator, typename HasState>
-    inline void
-    construct(Attribute& attr, lexertl_token<Iterator, omitted, HasState>& t)
-    {
-    }
-    
-    //  This is called from the parse function of token_set or lexer_def_
-    template <typename Iterator, typename AttributeTypes, typename HasState>
-    inline void
-    construct(fusion::vector<std::size_t, iterator_range<Iterator> >& attr,
-        lexertl_token<Iterator, AttributeTypes, HasState> const& t)
-    {
-    //  The type returned by the token_set and lexer_def_ parser components
-    //  is a fusion::vector containing the token id of the matched token 
-    //  and the pair of iterators to the matched character sequence.
-        
-        typedef iterator_range<Iterator> iterpair_type;
-        typedef 
-            fusion::vector<std::size_t, iterator_range<Iterator> > 
-        attribute_type;
-        
-        iterpair_type const& ip = get<iterpair_type>(t.value());
-        attr = attribute_type(t.id(), get<iterpair_type>(t.value()));
-    }
-
-}}}
-
-#endif
Added: trunk/boost/spirit/home/lex/lexer/lexertl/static_functor.hpp
==============================================================================
--- (empty file)
+++ trunk/boost/spirit/home/lex/lexer/lexertl/static_functor.hpp	2009-04-26 10:42:24 EDT (Sun, 26 Apr 2009)
@@ -0,0 +1,378 @@
+//  Copyright (c) 2001-2009 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_LEX_LEXER_STATIC_FUNCTOR_FEB_10_2008_0755PM)
+#define BOOST_SPIRIT_LEX_LEXER_STATIC_FUNCTOR_FEB_10_2008_0755PM
+
+#if defined(_MSC_VER) && (_MSC_VER >= 1020)
+#pragma once      // MS compatible compilers support #pragma once
+#endif
+
+#include <boost/mpl/bool.hpp>
+#include <boost/function.hpp>
+#include <boost/range/iterator_range.hpp>
+#include <boost/detail/iterator.hpp>
+#include <boost/detail/workaround.hpp>
+#include <map>
+#include <boost/spirit/home/support/detail/lexer/generator.hpp>
+#include <boost/spirit/home/support/detail/lexer/rules.hpp>
+#include <boost/spirit/home/support/detail/lexer/state_machine.hpp>
+#include <boost/spirit/home/lex/lexer/lexertl/iterator_tokenizer.hpp>
+#include <boost/spirit/home/lex/lexer/lexertl/wrap_action.hpp>
+
+#if 0 != __COMO_VERSION__ || !BOOST_WORKAROUND(BOOST_MSVC, <= 1310)
+#define BOOST_SPIRIT_STATIC_EOF 1
+#define BOOST_SPIRIT_EOF_PREFIX static
+#else
+#define BOOST_SPIRIT_EOF_PREFIX 
+#endif
+
+namespace boost { namespace spirit { namespace lex { namespace lexertl
+{ 
+    namespace detail
+    {
+        ///////////////////////////////////////////////////////////////////////
+        template <typename Iterator, typename HasActors, typename HasState>
+        struct Data;    // no default specialization
+        
+        ///////////////////////////////////////////////////////////////////////
+        //  doesn't support no state and no actors
+        template <typename Iterator>
+        struct Data<Iterator, mpl::false_, mpl::false_>
+        {
+            typedef std::size_t state_type;
+            typedef iterator_range<Iterator> iterpair_type;
+            typedef typename 
+                boost::detail::iterator_traits<Iterator>::value_type 
+            char_type;
+            
+            typedef std::size_t (*next_token_functor)(std::size_t&, 
+                Iterator const&, Iterator&, Iterator const&);
+
+            typedef unused_type semantic_actions_type;
+
+            typedef detail::wrap_action<unused_type, iterpair_type, Data>
+                wrap_action_type;
+
+            // initialize the shared data 
+            template <typename IterData>
+            Data (IterData const& data_, Iterator& first_, Iterator const& last_)
+              : next_token(data_.next_), first(first_), last(last_)
+            {}
+
+            std::size_t next(Iterator& end)
+            {
+                typedef basic_iterator_tokeniser<Iterator> tokenizer;
+                std::size_t state;
+                return next_token(state, first, end, last);
+            }
+
+            // nothing to invoke, so this is empty
+            bool invoke_actions(std::size_t, Iterator const&) 
+            {
+                return true;    // always accept
+            }
+
+            std::size_t get_state() const { return 0; }
+            void set_state_name (char const*) {}
+
+            next_token_functor next_token;
+            Iterator& first;
+            Iterator last;
+        };
+
+        ///////////////////////////////////////////////////////////////////////
+        //  doesn't support no actors
+        template <typename Iterator>
+        struct Data<Iterator, mpl::false_, mpl::true_>
+          : Data<Iterator, mpl::false_, mpl::false_>
+        {
+            typedef Data<Iterator, mpl::false_, mpl::false_> base_type;
+
+            typedef typename base_type::state_type state_type;
+            typedef typename base_type::char_type char_type;
+            typedef 
+                typename base_type::semantic_actions_type 
+            semantic_actions_type;
+
+            // initialize the shared data 
+            template <typename IterData>
+            Data (IterData const& data_, Iterator& first_, Iterator const& last_)
+              : base_type(data_, first_, last_), state(0)
+            {}
+
+            std::size_t next(Iterator& end)
+            {
+                typedef basic_iterator_tokeniser<Iterator> tokenizer;
+                return this->next_token(state, this->first, end, this->last);
+            }
+
+            std::size_t& get_state() { return state; }
+            void set_state_name (char_type const* new_state) 
+            { 
+                std::size_t state_id = this->rules.state(new_state);
+                BOOST_ASSERT(state_id != boost::lexer::npos);
+                if (state_id != boost::lexer::npos)
+                    state = state_id;
+            }
+
+            std::size_t state;
+        };
+
+        ///////////////////////////////////////////////////////////////////////
+        //  does support actors, but may have no state
+        template <typename Iterator, typename HasState>
+        struct Data<Iterator, mpl::true_, HasState> 
+          : Data<Iterator, mpl::false_, HasState>
+        {
+            typedef Data<Iterator, mpl::false_, HasState> base_type;
+
+            typedef iterator_range<Iterator> iterpair_type;
+            typedef typename base_type::state_type state_type;
+            typedef typename base_type::char_type char_type;
+
+            typedef void functor_type(iterpair_type, std::size_t, bool&, Data&);
+            typedef boost::function<functor_type> functor_wrapper_type;
+            typedef std::multimap<std::size_t, functor_wrapper_type> 
+                semantic_actions_type;
+
+            typedef detail::wrap_action<functor_wrapper_type
+              , iterpair_type, Data> wrap_action_type;
+
+            template <typename IterData>
+            Data (IterData const& data_, Iterator& first_, Iterator const& last_)
+              : base_type(data_, first_, last_),
+                actions(data_.actions_)
+            {}
+
+            // invoke attached semantic actions, if defined
+            bool invoke_actions(std::size_t id, Iterator const& end)
+            {
+                if (actions.empty()) 
+                    return true;  // nothing to invoke, continue with 'match'
+
+                iterpair_type itp(this->first, end);
+                bool match = true;
+
+                typedef typename semantic_actions_type::const_iterator 
+                    iterator_type;
+
+                std::pair<iterator_type, iterator_type> p = actions.equal_range(id);
+                while (p.first != p.second)
+                {
+                    ((*p.first).second)(itp, id, match, *this);
+                    if (!match)
+                        return false;   // return a 'no-match'
+                    ++p.first;
+                }
+                return true;    // normal execution
+            }
+
+            semantic_actions_type const& actions;
+        };
+    }
+
+    ///////////////////////////////////////////////////////////////////////////
+    //
+    //  static_functor is a template usable as the functor object for 
+    //  the multi_pass iterator allowing to wrap a lexertl based dfa into a 
+    //  iterator based interface.
+    //  
+    //    Iterator:   the type of the underlying iterator
+    //    Token:      the type of the tokens produced by this functor
+    //                this needs to expose a constructor with the following
+    //                prototype:
+    //
+    //                Token(std::size_t id, std::size_t state, 
+    //                      Iterator start, Iterator end)
+    //
+    //                where 'id' is the token id, state is the lexer state,
+    //                this token has been matched in, and 'first' and 'end'  
+    //                mark the start and the end of the token with respect 
+    //                to the underlying character stream.
+    //    SupportsActors:
+    //                this is expected to be a mpl::bool_, if mpl::true_ the
+    //                static_functor invokes functors which 
+    //                (optionally) have been attached to the token definitions.
+    //    SupportState:
+    //                this is expected to be a mpl::bool_, if mpl::true_ the
+    //                functor supports different lexer states, 
+    //                otherwise no lexer state is supported.
+    //
+    ///////////////////////////////////////////////////////////////////////////
+    template <typename Token
+      , typename Iterator = typename Token::iterator_type
+      , typename SupportsActors = mpl::false_
+      , typename SupportsState = typename Token::has_state>
+    class static_functor
+    {
+    public:
+        typedef typename boost::detail::iterator_traits<Iterator>::value_type 
+            char_type;
+
+    private:
+        // Needed by compilers not implementing the resolution to DR45. For
+        // reference, see
+        // http://www.open-std.org/JTC1/SC22/WG21/docs/cwg_defects.html#45.
+        template <typename Iterator_, typename HasActors, typename HasState> 
+        friend struct detail::Data;
+
+        // Helper template allowing to assign a value on exit
+        template <typename T>
+        struct assign_on_exit
+        {
+            assign_on_exit(T& dst_, T const& src_)
+              : dst(dst_), src(src_)
+            {}
+            ~assign_on_exit()
+            {
+                dst = src;
+            }
+            
+            T& dst;
+            T const& src;
+        };
+        
+    public:
+        static_functor()
+#if defined(__PGI)
+          : eof()
+#endif 
+        {}
+
+#if BOOST_WORKAROUND(BOOST_MSVC, <= 1310)
+        // somehow VC7.1 needs this (meaningless) assignment operator
+        functor& operator=(functor const& rhs)
+        {
+            return *this;
+        }
+#endif
+
+        ///////////////////////////////////////////////////////////////////////
+        // interface to the multi_pass_policies::split_functor_input policy
+        typedef Token result_type;
+        typedef static_functor unique;
+        typedef detail::Data<Iterator, SupportsActors, SupportsState> shared;
+
+        BOOST_SPIRIT_EOF_PREFIX result_type const eof;
+
+        ///////////////////////////////////////////////////////////////////////
+        typedef Iterator iterator_type;
+        typedef typename shared::semantic_actions_type semantic_actions_type;
+        typedef typename shared::next_token_functor next_token_functor;
+
+        // this is needed to wrap the semantic actions in a proper way
+        typedef typename shared::wrap_action_type wrap_action_type;
+
+        ///////////////////////////////////////////////////////////////////////
+        template <typename MultiPass>
+        static result_type& get_next(MultiPass& mp, result_type& result)
+        {
+            shared& data = mp.shared->ftor;
+            if (data.first == data.last) 
+#if defined(BOOST_SPIRIT_STATIC_EOF)
+                return result = eof;
+#else
+                return result = mp.ftor.eof;
+#endif
+
+            Iterator end = data.first;
+            std::size_t id = data.next(end);
+            
+            if (boost::lexer::npos == id) {   // no match
+#if defined(BOOST_SPIRIT_DEBUG)
+                std::string next;
+                Iterator it = data.first;
+                for (std::size_t i = 0; i < 10 && it != data.last; ++it, ++i)
+                    next += *it;
+
+                std::cerr << "Not matched, in state: " << data.state 
+                          << ", lookahead: >" << next << "<" << std::endl;
+#endif
+                return result = result_type(0);
+            }
+            else if (0 == id) {         // EOF reached
+#if defined(BOOST_SPIRIT_STATIC_EOF)
+                return result = eof;
+#else
+                return result = mp.ftor.eof;
+#endif
+            }
+
+#if defined(BOOST_SPIRIT_DEBUG)
+            {
+                std::string next;
+                Iterator it = end;
+                for (std::size_t i = 0; i < 10 && it != data.last; ++it, ++i)
+                    next += *it;
+
+                std::cerr << "Matched: " << id << ", in state: " 
+                          << data.state << ", string: >" 
+                          << std::basic_string<char_type>(data.first, end) << "<"
+                          << ", lookahead: >" << next << "<" << std::endl;
+            }
+#endif
+            // invoke_actions might change state
+            std::size_t state = data.get_state();
+
+            // invoke attached semantic actions, if there are any defined
+            if (!data.invoke_actions(id, end))
+            {
+                // one of the semantic actions signaled no-match
+                return result = result_type(0); 
+            }
+
+            // return matched token, advancing 'data.first' past the matched 
+            // sequence
+            assign_on_exit<Iterator> on_exit(data.first, end);
+            return result = result_type(id, state, data.first, end);
+        }
+
+        // set_state is propagated up to the iterator interface, allowing to 
+        // manipulate the current lexer state through any of the exposed 
+        // iterators.
+        template <typename MultiPass>
+        static std::size_t set_state(MultiPass& mp, std::size_t state_) 
+        { 
+            std::size_t oldstate = mp.shared->ftor.state;
+            mp.shared->ftor.state = state_;
+
+#if defined(BOOST_SPIRIT_DEBUG)
+            std::cerr << "Switching state from: " << oldstate 
+                      << " to: " << state_
+                      << std::endl;
+#endif
+            return oldstate; 
+        }
+
+        template <typename MultiPass>
+        static std::size_t 
+        map_state(MultiPass const& mp, char_type const* statename)  
+        { 
+            return mp.shared->ftor.rules.state(statename);
+        }
+
+        // we don't need this, but it must be there
+        template <typename MultiPass>
+        static void destroy(MultiPass const&) {}
+    };
+
+#if defined(BOOST_SPIRIT_STATIC_EOF)
+    ///////////////////////////////////////////////////////////////////////////
+    //  eof token
+    ///////////////////////////////////////////////////////////////////////////
+    template <typename Token, typename Iterator, typename SupportsActors
+      , typename SupportsState>
+    typename static_functor<Token, Iterator, SupportsActors, SupportsState>::result_type const
+        static_functor<Token, Iterator, SupportsActors, SupportsState>::eof = 
+            typename static_functor<Token, Iterator, SupportsActors, SupportsState>::result_type();
+#endif
+
+}}}}
+
+#undef BOOST_SPIRIT_EOF_PREFIX
+#undef BOOST_SPIRIT_STATIC_EOF
+
+#endif
Added: trunk/boost/spirit/home/lex/lexer/lexertl/static_lexer.hpp
==============================================================================
--- (empty file)
+++ trunk/boost/spirit/home/lex/lexer/lexertl/static_lexer.hpp	2009-04-26 10:42:24 EDT (Sun, 26 Apr 2009)
@@ -0,0 +1,277 @@
+//  Copyright (c) 2001-2009 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_LEX_STATIC_LEXER_FEB_10_2008_0753PM)
+#define BOOST_SPIRIT_LEX_STATIC_LEXER_FEB_10_2008_0753PM
+
+#if defined(_MSC_VER) && (_MSC_VER >= 1020)
+#pragma once      // MS compatible compilers support #pragma once
+#endif
+
+#include <boost/spirit/home/support/safe_bool.hpp>
+#include <boost/spirit/home/lex/lexer/lexertl/token.hpp>
+#include <boost/spirit/home/lex/lexer/lexertl/static_functor.hpp>
+#include <boost/spirit/home/lex/lexer/lexertl/iterator.hpp>
+#if defined(BOOST_SPIRIT_DEBUG)
+#include <boost/spirit/home/support/detail/lexer/debug.hpp>
+#endif
+
+namespace boost { namespace spirit { namespace lex { namespace lexertl
+{ 
+    ///////////////////////////////////////////////////////////////////////////
+    // forward declaration only
+    namespace static_ 
+    {
+        //  Both items, the table of names and the function to return the next 
+        //  token have to be generated using the function generate_static().
+        //
+        //  This is a forward declaration for the generated static table of 
+        //  valid state names
+        extern char const* const lexer_state_names[];
+
+        //  This is the forward declaration of the generated function to be 
+        //  called to get the next token. 
+        template <typename Iterator>
+        std::size_t next_token (std::size_t& state_, Iterator const& start_, 
+            Iterator ¤t_, Iterator const& end_);
+    }
+    
+    ///////////////////////////////////////////////////////////////////////////
+    //  static_token_set
+    ///////////////////////////////////////////////////////////////////////////
+    template <typename Token, typename Iterator = typename Token::iterator_type>
+    class static_token_set
+    {
+    protected:
+        typedef typename boost::detail::iterator_traits<Iterator>::value_type 
+            char_type;
+        typedef std::basic_string<char_type> string_type;
+
+    public:
+        typedef Token token_type;
+        typedef typename Token::id_type id_type;
+
+        // interface for token definition management
+        void add_token (char_type const* state, string_type const& tokendef
+          , std::size_t token_id) {}
+
+        // interface for pattern definition management
+        void add_pattern (char_type const* state, string_type const& name
+          , string_type const& patterndef) {}
+
+        void clear() {}
+
+        std::size_t add_state(char_type const* state)
+        {
+            return 0;
+        }
+        string_type initial_state() const 
+        { 
+            return lex::lexertl::static_::lexer_state_names[0];
+        }
+    };
+
+    ///////////////////////////////////////////////////////////////////////////
+    //
+    //  Every lexer type to be used as a lexer for Spirit has to conform to 
+    //  the following public interface:
+    //
+    //    typedefs: 
+    //        iterator_type   The type of the iterator exposed by this lexer.
+    //        token_type      The type of the tokens returned from the exposed 
+    //                        iterators.
+    //        token_set       The type of the token set representing a lexer 
+    //                        state.
+    //
+    //    functions:
+    //        default constructor
+    //                        Since lexers are instantiated as base classes 
+    //                        only it might be a good idea to make this 
+    //                        constructor protected.
+    //        begin, end      Return a pair of iterators, when dereferenced
+    //                        returning the sequence of tokens recognized in 
+    //                        the input stream given as the parameters to the 
+    //                        begin() function.
+    //        add_token       Should add the definition of a token to be 
+    //                        recognized by this lexer.
+    //        clear           Should delete all current token definitions
+    //                        associated with the given state of this lexer 
+    //                        object.
+    //
+    //    template parameters:
+    //        Token           The type of the tokens to be returned from the
+    //                        exposed token iterator.
+    //        Iterator        The type of the iterator used to access the
+    //                        underlying character stream.
+    //        Functor         The type of the InputPolicy to use to instantiate
+    //                        the multi_pass iterator type to be used as the 
+    //                        token iterator (returned from begin()/end()).
+    //        TokenSet        The type of the token set to use in conjunction 
+    //                        with this lexer type. This is used for the 
+    //                        token_set typedef described above only.
+    //
+    ///////////////////////////////////////////////////////////////////////////
+
+    ///////////////////////////////////////////////////////////////////////////
+    //
+    //  The static_lexer class is a implementation of a Spirit.Lex 
+    //  lexer on top of Ben Hanson's lexertl library (For more information 
+    //  about lexertl go here: http://www.benhanson.net/lexertl.html). 
+    //
+    //  This class is designed to be used in conjunction with a generated, 
+    //  static lexer. For more information see the documentation (The Static 
+    //  Lexer Model).
+    //
+    //  This class is supposed to be used as the first and only template 
+    //  parameter while instantiating instances of a lex::lexer class.
+    //
+    ///////////////////////////////////////////////////////////////////////////
+    template <typename Token = token<>
+      , typename Iterator = typename Token::iterator_type
+      , typename Functor = static_functor<Token, Iterator, mpl::false_>
+      , typename TokenSet = lex::token_set<static_token_set<Token, Iterator> > >
+    class static_lexer 
+    {
+    public:
+        // operator_bool() is needed for the safe_bool base class
+        operator typename safe_bool<static_lexer>::result_type() const 
+        { 
+            return safe_bool<static_lexer>()(true);    // object is always valid
+        }
+
+        typedef typename boost::detail::iterator_traits<Iterator>::value_type 
+            char_type;
+        typedef std::basic_string<char_type> string_type;
+
+        //  Every lexer type to be used as a lexer for Spirit has to conform to 
+        //  a public interface 
+        typedef Token token_type;
+        typedef typename Token::id_type id_type;
+        typedef TokenSet token_set;
+        typedef iterator<Functor> iterator_type;
+
+    private:
+        // this type is purely used for the iterator_type construction below
+        struct iterator_data_type 
+        {
+            typename Functor::next_token_functor next_;
+            typename Functor::semantic_actions_type const& actions_;
+        };
+
+    public:
+        //  Return the start iterator usable for iterating over the generated
+        //  tokens, the Functor F is called to match the next token from the 
+        //  input.
+        template <typename F>
+        iterator_type begin(Iterator& first, Iterator const& last, F next) const
+        { 
+            iterator_data_type iterator_data = { next, actions };
+            return iterator_type(iterator_data, first, last);
+        }
+
+        //  Return the start iterator usable for iterating over the generated
+        //  tokens, the generated function next_token(...) is called to match 
+        //  the next token from the input.
+        template <typename Iterator_>
+        iterator_type begin(Iterator_& first, Iterator_ const& last) const
+        { 
+            iterator_data_type iterator_data = 
+                { &lex::lexertl::static_::next_token<Iterator_>, actions };
+            return iterator_type(iterator_data, first, last);
+        }
+
+        //  Return the end iterator usable to stop iterating over the generated 
+        //  tokens.
+        iterator_type end() const
+        { 
+            return iterator_type(); 
+        }
+
+    protected:
+        //  Lexer instances can be created by means of a derived class only.
+        static_lexer(unsigned int flags) {}
+
+    public:
+        // interface for token definition management
+        void add_token (char_type const* state, char_type tokendef
+          , std::size_t token_id) {}
+        void add_token (char_type const* state, string_type const& tokendef
+          , std::size_t token_id) {}
+        void add_token(char_type const* state, token_set& tokset) {}
+
+        // interface for pattern definition management
+        void add_pattern (char_type const* state, string_type const& name
+          , string_type const& patterndef) {}
+
+        void clear(char_type const* state) {}
+
+        std::size_t add_state(char_type const* state)
+        {
+            return 0;
+        }
+        string_type initial_state() const 
+        { 
+            return lex::lexertl::static_::lexer_state_names[0];
+        }
+
+        // register a semantic action with the given id
+        template <typename F>
+        void add_action(std::size_t id, F act) 
+        {
+            // If you get compilation errors below stating value_type not being
+            // a member of boost::fusion::unused_type, then you are probably
+            // using semantic actions in your token definition without 
+            // the static_actor_lexer being specified as the base class of your 
+            // lexer (instead of the static_lexer class).
+            typedef typename Functor::semantic_actions_type::value_type
+                value_type;
+
+            actions.insert(value_type(id, act));
+        }
+
+        bool init_dfa() const { return true; }
+
+    private:
+        typename Functor::semantic_actions_type actions;
+    };
+
+    ///////////////////////////////////////////////////////////////////////////
+    //
+    //  The static_actor_lexer class is another implementation of a 
+    //  Spirit.Lex lexer on top of Ben Hanson's lexertl library as outlined 
+    //  above (For more information about lexertl go here: 
+    //  http://www.benhanson.net/lexertl.html).
+    //
+    //  Just as the static_lexer class it is meant to be used with 
+    //  a statically generated lexer as outlined above.
+    //
+    //  The only difference to the static_lexer class above is that 
+    //  token_def definitions may have semantic (lexer) actions attached while 
+    //  being defined:
+    //
+    //      int w;
+    //      token_def<> word = "[^ \t\n]+";
+    //      self = word[++ref(w)];        // see example: word_count_lexer
+    //
+    //  This class is supposed to be used as the first and only template 
+    //  parameter while instantiating instances of a lex::lexer class.
+    //
+    ///////////////////////////////////////////////////////////////////////////
+    template <typename Token = token<>
+      , typename Iterator = typename Token::iterator_type
+      , typename Functor = static_functor<Token, Iterator, mpl::true_>
+      , typename TokenSet = lex::token_set<static_token_set<Token, Iterator> > >
+    class static_actor_lexer 
+      : public static_lexer<Token, Iterator, Functor, TokenSet>
+    {
+    protected:
+        // Lexer instances can be created by means of a derived class only.
+        static_actor_lexer(unsigned int flags) 
+          : static_lexer<Token, Iterator, Functor, TokenSet>(flags) {}
+    };
+
+}}}}
+
+#endif
Added: trunk/boost/spirit/home/lex/lexer/lexertl/token.hpp
==============================================================================
--- (empty file)
+++ trunk/boost/spirit/home/lex/lexer/lexertl/token.hpp	2009-04-26 10:42:24 EDT (Sun, 26 Apr 2009)
@@ -0,0 +1,432 @@
+//  Copyright (c) 2001-2009 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_LEX_TOKEN_FEB_10_2008_0751PM)
+#define BOOST_SPIRIT_LEX_TOKEN_FEB_10_2008_0751PM
+
+#if defined(_MSC_VER) && (_MSC_VER >= 1020)
+#pragma once      // MS compatible compilers support #pragma once
+#endif
+
+#include <boost/spirit/home/qi/detail/assign_to.hpp>
+#include <boost/spirit/home/support/argument.hpp>
+#include <boost/spirit/home/support/detail/lexer/generator.hpp>
+#include <boost/spirit/home/support/detail/lexer/rules.hpp>
+#include <boost/spirit/home/support/detail/lexer/consts.hpp>
+#include <boost/fusion/include/vector.hpp>
+#include <boost/fusion/include/at.hpp>
+#include <boost/fusion/include/value_at.hpp>
+#include <boost/detail/iterator.hpp>
+#include <boost/variant.hpp>
+#include <boost/mpl/vector.hpp>
+#include <boost/mpl/insert.hpp>
+#include <boost/mpl/begin.hpp>
+#include <boost/mpl/bool.hpp>
+#include <boost/mpl/identity.hpp>
+#include <boost/mpl/if.hpp>
+#include <boost/range/iterator_range.hpp>
+#if defined(BOOST_SPIRIT_DEBUG)
+#include <iosfwd>
+#endif
+
+namespace boost { namespace spirit { namespace lex { namespace lexertl
+{ 
+    ///////////////////////////////////////////////////////////////////////////
+    //
+    //  The token is the type of the objects returned by default by the 
+    //  iterator.
+    //
+    //    template parameters:
+    //        Iterator        The type of the iterator used to access the
+    //                        underlying character stream.
+    //        AttributeTypes  A mpl sequence containing the types of all 
+    //                        required different token values to be supported 
+    //                        by this token type.
+    //        HasState        A mpl::bool_ indicating, whether this token type
+    //                        should support lexer states.
+    //
+    //  It is possible to use other token types with the spirit::lex 
+    //  framework as well. If you plan to use a different type as your token 
+    //  type, you'll need to expose the following things from your token type 
+    //  to make it compatible with spirit::lex:
+    //
+    //    typedefs
+    //        iterator_type   The type of the iterator used to access the
+    //                        underlying character stream.
+    //
+    //        id_type         The type of the token id used.
+    //
+    //    methods
+    //        default constructor
+    //                        This should initialize the token as an end of 
+    //                        input token.
+    //        constructors    The prototype of the other required 
+    //                        constructors should be:
+    //
+    //              token(int)
+    //                        This constructor should initialize the token as 
+    //                        an invalid token (not carrying any specific 
+    //                        values)
+    //
+    //              where:  the int is used as a tag only and its value is 
+    //                      ignored
+    //
+    //                        and:
+    //
+    //              token(std::size_t id, std::size_t state, 
+    //                    iterator_type first, iterator_type last);
+    //
+    //              where:  id:           token id
+    //                      state:        lexer state this token was matched in
+    //                      first, last:  pair of iterators marking the matched 
+    //                                    range in the underlying input stream 
+    //
+    //        accessors
+    //              id()      return the token id of the matched input sequence
+    //
+    //              state()   return the lexer state this token was matched in
+    //
+    //              value()   return the token value
+    //
+    //  Additionally, you will have to implement a couple of helper functions
+    //  in the same namespace as the token type: a comparison operator==() to 
+    //  compare your token instances, a token_is_valid() function and different 
+    //  construct() function overloads as described below.
+    //
+    ///////////////////////////////////////////////////////////////////////////
+    template <typename Iterator = char const*
+      , typename AttributeTypes = mpl::vector0<>
+      , typename HasState = mpl::true_> 
+    struct token;
+
+    ///////////////////////////////////////////////////////////////////////////
+    //  This specialization of the token type doesn't contain any item data and
+    //  doesn't support working with lexer states.
+    ///////////////////////////////////////////////////////////////////////////
+    template <typename Iterator>
+    struct token<Iterator, omitted, mpl::false_>
+    {
+        typedef Iterator iterator_type;
+        typedef mpl::false_ has_state;
+        typedef std::size_t id_type;
+
+        //  default constructed tokens correspond to EOI tokens
+        token() : id_(boost::lexer::npos) {}
+
+        //  construct an invalid token
+        token(int) : id_(0) {}
+
+        token(std::size_t id, std::size_t) : id_(id) {}
+
+        token(std::size_t id, std::size_t, Iterator const& first
+              , Iterator const& last)
+          : id_(id) 
+#if defined(BOOST_SPIRIT_DEBUG)
+          , matched_(first, last)
+#endif
+        {}
+
+        //  this default conversion operator is needed to allow the direct 
+        //  usage of tokens in conjunction with the primitive parsers defined 
+        //  in Qi
+        operator std::size_t() const { return id_; }
+
+        std::size_t id() const { return id_; }
+        std::size_t state() const { return 0; }   // always '0' (INITIAL state)
+
+#if defined(BOOST_SPIRIT_DEBUG)
+        std::pair<Iterator, Iterator> matched_;
+#endif
+
+    protected:
+        std::size_t id_;         // token id, 0 if nothing has been matched
+    };
+
+#if defined(BOOST_SPIRIT_DEBUG)
+    template <typename Char, typename Traits, typename Iterator
+      , typename AttributeTypes, typename HasState> 
+    inline std::basic_ostream<Char, Traits>& 
+    operator<< (std::basic_ostream<Char, Traits>& os
+      , token<Iterator, AttributeTypes, HasState> const& t)
+    {
+        Iterator end = t.matched_.second;
+        for (Iterator it = t.matched_.first; it != end; ++it)
+            os << *it;
+        return os;
+    }
+#endif
+
+    ///////////////////////////////////////////////////////////////////////////
+    //  This specialization of the token type doesn't contain any item data but
+    //  supports working with lexer states.
+    ///////////////////////////////////////////////////////////////////////////
+    template <typename Iterator>
+    struct token<Iterator, omitted, mpl::true_>
+      : token<Iterator, omitted, mpl::false_>
+    {
+    private:
+        typedef token<Iterator, omitted, mpl::false_> base_type;
+
+    public:
+        typedef Iterator iterator_type;
+        typedef mpl::true_ has_state;
+
+        //  default constructed tokens correspond to EOI tokens
+        token() : state_(boost::lexer::npos) {}
+
+        //  construct an invalid token
+        token(int) : base_type(0), state_(boost::lexer::npos) {}
+
+        token(std::size_t id, std::size_t state)
+          : base_type(id, boost::lexer::npos), state_(state) {}
+
+        token(std::size_t id, std::size_t state
+              , Iterator const& first, Iterator const& last)
+          : base_type(id, boost::lexer::npos, first, last)
+          , state_(state) {}
+
+        std::size_t state() const { return state_; }
+
+    protected:
+        std::size_t state_;      // lexer state this token was matched in
+    };
+
+    ///////////////////////////////////////////////////////////////////////////
+    //  The generic version of the token type derives from the 
+    //  specialization above and adds a single data member holding the item 
+    //  data carried by the token instance.
+    ///////////////////////////////////////////////////////////////////////////
+    namespace detail
+    {
+        ///////////////////////////////////////////////////////////////////////
+        //  Metafunction to calculate the type of the variant data item to be 
+        //  stored with each token instance.
+        //
+        //  Note: The iterator pair needs to be the first type in the list of 
+        //        types supported by the generated variant type (this is being 
+        //        used to identify whether the stored data item in a particular 
+        //        token instance needs to be converted from the pair of 
+        //        iterators (see the first of the construct() functions below).
+        ///////////////////////////////////////////////////////////////////////
+        template <typename IteratorPair, typename AttributeTypes>
+        struct token_value_typesequence
+        {
+            typedef typename mpl::insert<
+                AttributeTypes
+              , typename mpl::begin<AttributeTypes>::type
+              , IteratorPair
+            >::type sequence_type;
+            typedef typename make_variant_over<sequence_type>::type type;
+        };
+
+        ///////////////////////////////////////////////////////////////////////
+        //  The type of the data item stored with a token instance is defined 
+        //  by the template parameter 'AttributeTypes' and may be:
+        //  
+        //     omitted:           no data item is stored with the token 
+        //                        instance (this is handled by the 
+        //                        specializations of the token class
+        //                        below)
+        //     mpl::vector0<>:    each token instance stores a pair of 
+        //                        iterators pointing to the matched input 
+        //                        sequence
+        //     mpl::vector<...>:  each token instance stores a variant being 
+        //                        able to store the pair of iterators pointing 
+        //                        to the matched input sequence, or any of the 
+        //                        types a specified in the mpl::vector<>
+        //
+        //  All this is done to ensure the token type is as small (in terms 
+        //  of its byte-size) as possible.
+        ///////////////////////////////////////////////////////////////////////
+        template <typename IteratorPair, typename AttributeTypes>
+        struct token_value_type
+        {
+            typedef typename mpl::eval_if<
+                is_same<AttributeTypes, mpl::vector0<> >
+              , mpl::identity<IteratorPair>
+              , token_value_typesequence<IteratorPair, AttributeTypes>
+            >::type type;
+        };
+    }
+
+    template <typename Iterator, typename AttributeTypes, typename HasState>
+    struct token : token<Iterator, omitted, HasState>
+    {
+    private: // precondition assertions
+#if !BOOST_WORKAROUND(BOOST_MSVC, <= 1300)
+        BOOST_STATIC_ASSERT((mpl::is_sequence<AttributeTypes>::value || 
+                            is_same<AttributeTypes, omitted>::value));
+#endif
+        typedef token<Iterator, omitted, HasState> base_type;
+
+    protected: 
+        //  If no additional token value types are given, the the token will 
+        //  hold the plain pair of iterators pointing to the matched range
+        //  in the underlying input sequence. Otherwise the token value is 
+        //  stored as a variant and will again hold the pair of iterators but
+        //  is able to hold any of the given data types as well. The conversion 
+        //  from the iterator pair to the required data type is done when it is
+        //  accessed for the first time.
+        typedef iterator_range<Iterator> iterpair_type;
+        typedef typename detail::token_value_type<
+            iterpair_type, AttributeTypes
+        >::type token_value_type;
+
+    public:
+        typedef Iterator iterator_type;
+
+        //  default constructed tokens correspond to EOI tokens
+        token() : value_(iterpair_type(iterator_type(), iterator_type())) {}
+
+        //  construct an invalid token
+        token(int)
+          : base_type(0)
+          , value_(iterpair_type(iterator_type(), iterator_type())) {}
+
+        token(std::size_t id, std::size_t state, Iterator const& first
+              , Iterator const& last)
+          : base_type(id, state, first, last)
+          , value_(iterpair_type(first, last)) {}
+
+        token_value_type& value() { return value_; }
+        token_value_type const& value() const { return value_; }
+
+    protected:
+        token_value_type value_; // token value, by default a pair of iterators
+    };
+
+    ///////////////////////////////////////////////////////////////////////////
+    //  tokens are considered equal, if their id's match (these are unique)
+    template <typename Iterator, typename AttributeTypes, typename HasState>
+    inline bool 
+    operator== (token<Iterator, AttributeTypes, HasState> const& lhs, 
+                token<Iterator, AttributeTypes, HasState> const& rhs)
+    {
+        return lhs.id() == rhs.id();
+    }
+
+    ///////////////////////////////////////////////////////////////////////////
+    //  This overload is needed by the multi_pass/functor_input_policy to 
+    //  validate a token instance. It has to be defined in the same namespace 
+    //  as the token class itself to allow ADL to find it.
+    ///////////////////////////////////////////////////////////////////////////
+    template <typename Iterator, typename AttributeTypes, typename HasState>
+    inline bool 
+    token_is_valid(token<Iterator, AttributeTypes, HasState> const& t)
+    {
+        return 0 != t.id() && std::size_t(boost::lexer::npos) != t.id();
+    }
+
+    ///////////////////////////////////////////////////////////////////////////
+    //  We have to provide overloads for the construct() function allowing
+    //  to extract the needed value from the token. These overloads have to be
+    //  defined in the same namespace as the token class itself to allow ADL to 
+    //  find them.
+    ///////////////////////////////////////////////////////////////////////////
+
+    //  This is called from the parse function of token_def if the token_def
+    //  has been defined to carry a special attribute type
+    template <typename Attribute, typename Iterator, typename AttributeTypes
+      , typename HasState>
+    inline void 
+    construct(Attribute& attr, token<Iterator, AttributeTypes, HasState>& t)
+    {
+    //  The goal of this function is to avoid the conversion of the pair of
+    //  iterators (to the matched character sequence) into the token value 
+    //  of the required type being done more than once. For this purpose it 
+    //  checks whether the stored value type is still the default one (pair 
+    //  of iterators) and if yes, replaces the pair of iterators with the 
+    //  converted value to be returned from subsequent calls.
+
+        if (0 == t.value().which()) {
+        //  first access to the token value
+            typedef iterator_range<Iterator> iterpair_type;
+            iterpair_type const& ip = get<iterpair_type>(t.value());
+
+        // Interestingly enough we use the assign_to() framework defined in 
+        // Spirit.Qi allowing to convert the pair of iterators to almost any 
+        // required type (assign_to(), if available, uses the standard Spirit 
+        // parsers to do the conversion, and falls back to boost::lexical_cast
+        // otherwise).
+            qi::detail::assign_to(ip.begin(), ip.end(), attr);
+
+        //  If you get an error during the compilation of the following 
+        //  assignment expression, you probably forgot to list one or more 
+        //  types used as token value types (in your token_def<...> 
+        //  definitions) in your definition of the token class. I.e. any token 
+        //  value type used for a token_def<...> definition has to be listed 
+        //  during the declaration of the token type to use. For instance let's 
+        //  assume we have two token_def's:
+        //
+        //      token_def<int> number; number = "...";
+        //      token_def<std::string> identifier; identifier = "...";
+        //
+        //  Then you'll have to use the following token type definition 
+        //  (assuming you are using the token class):
+        //
+        //      typedef mpl::vector<int, std::string> token_values;
+        //      typedef token<base_iter_type, token_values> token_type;
+        //
+        //  where: base_iter_type is the iterator type used to expose the 
+        //         underlying input stream.
+        //
+        //  This token_type has to be used as the second template parameter 
+        //  to the lexer class:
+        //
+        //      typedef lexer<base_iter_type, token_type> lexer_type;
+        //
+        //  again, assuming you're using the lexer<> template for your 
+        //  tokenization.
+
+            t.value() = attr;   // re-assign value
+        }
+        else {
+        // reuse the already assigned value
+            qi::detail::assign_to(get<Attribute>(t.value()), attr);
+        }
+    }
+
+    //  This is called from the parse function of token_def if the token type
+    //  has no special attribute type assigned 
+    template <typename Attribute, typename Iterator, typename HasState>
+    inline void construct(Attribute& attr, 
+        token<Iterator, mpl::vector0<>, HasState>& t)
+    {
+    //  The default type returned by the token_def parser component (if it
+    //  has no token value type assigned) is the pair of iterators to the 
+    //  matched character sequence.
+
+        qi::detail::assign_to(t.value().begin(), t.value().end(), attr);
+    }
+
+    //  This is called from the parse function of token_def if the token type
+    //  has been explicitly omitted (i.e. no attribute value is used), which
+    //  essentially means that every attribute gets initialized using default 
+    //  constructed values.
+    template <typename Attribute, typename Iterator, typename HasState>
+    inline void
+    construct(Attribute& attr, token<Iterator, omitted, HasState>& t) {}
+
+    //  This is called from the parse function of token_set or lexer_def_
+    template <typename Iterator, typename AttributeTypes, typename HasState>
+    inline void
+    construct(fusion::vector2<std::size_t, iterator_range<Iterator> >& attr,
+        token<Iterator, AttributeTypes, HasState> const& t)
+    {
+    //  The type returned by the token_set and lexer_def_ parser components
+    //  is a fusion::vector containing the token id of the matched token 
+    //  and the pair of iterators to the matched character sequence.
+
+        typedef iterator_range<Iterator> iterpair_type;
+        typedef fusion::vector2<std::size_t, iterator_range<Iterator> > 
+            attribute_type;
+
+        iterpair_type const& ip = get<iterpair_type>(t.value());
+        attr = attribute_type(t.id(), get<iterpair_type>(t.value()));
+    }
+
+}}}}
+
+#endif
Modified: trunk/boost/spirit/home/lex/lexer/lexertl/wrap_action.hpp
==============================================================================
--- trunk/boost/spirit/home/lex/lexer/lexertl/wrap_action.hpp	(original)
+++ trunk/boost/spirit/home/lex/lexer/lexertl/wrap_action.hpp	2009-04-26 10:42:24 EDT (Sun, 26 Apr 2009)
@@ -1,6 +1,6 @@
 /*=============================================================================
-    Copyright (c) 2001-2008 Joel de Guzman
-    Copyright (c) 2001-2008 Hartmut Kaiser
+    Copyright (c) 2001-2009 Joel de Guzman
+    Copyright (c) 2001-2009 Hartmut Kaiser
     http://spirit.sourceforge.net/
 
     Distributed under the Boost Software License, Version 1.0. (See accompanying
@@ -9,140 +9,143 @@
 #if !defined(BOOST_SPIRIT_WRAP_ACTION_APR_19_2008_0103PM)
 #define BOOST_SPIRIT_WRAP_ACTION_APR_19_2008_0103PM
 
-#include <boost/spirit/home/support/detail/values.hpp>
 #include <boost/spirit/home/phoenix/core/actor.hpp>
 #include <boost/spirit/home/phoenix/core/argument.hpp>
 #include <boost/spirit/home/phoenix/bind.hpp>
 #include <boost/spirit/home/phoenix/scope.hpp>
 
 ///////////////////////////////////////////////////////////////////////////////
-namespace boost { namespace spirit { namespace lex { namespace detail
-{
-    template <typename FunctionType, typename Attribute, typename Context>
-    struct wrap_action
+namespace boost { namespace spirit { namespace lex { namespace lexertl 
+{ 
+    namespace detail
     {
-        // plain functions with 4 arguments and function objects are not 
-        // touched at all
-        template <typename F>
-        static FunctionType call(F const& f)
+        template <typename FunctionType, typename Attribute, typename Context>
+        struct wrap_action
         {
-            return f;
-        }
+            // plain functions with 4 arguments and function objects are not 
+            // touched at all
+            template <typename F>
+            static FunctionType call(F const& f)
+            {
+                return f;
+            }
+
+            // wrap phoenix actor, make sure first argument is a fusion sequence
+            struct phoenix_action
+            {
+                template <typename F, typename T1, typename T2, typename T3
+                  , typename T4>
+                struct result { typedef void type; };
+
+                template <typename Eval>
+                void operator()(phoenix::actor<Eval> const& f
+                  , Attribute const& attr, std::size_t id, bool& pass
+                  , Context& ctx) const
+                {
+                    f (spirit::detail::pass_value<Attribute const>::call(attr)
+                      , id, pass, ctx);
+                }
+            };
 
-        // wrap phoenix actor, make sure first argument is a fusion sequence
-        struct phoenix_action
-        {
-            template <typename F, typename T1, typename T2, typename T3, typename T4>
-            struct result { typedef void type; };
-            
             template <typename Eval>
-            void 
-            operator()(phoenix::actor<Eval> const& f, Attribute const& attr, 
-                std::size_t id, bool& pass, Context& ctx) const
+            static FunctionType call(phoenix::actor<Eval> const& f)
             {
-                f (spirit::detail::pass_value<Attribute const>::call(attr), 
-                    id, pass, ctx);
+                using phoenix::arg_names::_1;
+                using phoenix::arg_names::_2;
+                using phoenix::arg_names::_3;
+                using phoenix::arg_names::_4;
+                return phoenix::bind(phoenix_action(), phoenix::lambda[f], 
+                    _1, _2, _3, _4);
             }
-        };
 
-        template <typename Eval>
-        static FunctionType call(phoenix::actor<Eval> const& f)
-        {
-            using phoenix::arg_names::_1;
-            using phoenix::arg_names::_2;
-            using phoenix::arg_names::_3;
-            using phoenix::arg_names::_4;
-            return phoenix::bind(phoenix_action(), phoenix::lambda[f], 
-                _1, _2, _3, _4);
-        }
-
-        // semantic actions with 3 arguments
-        template <typename F>
-        static void arg3_action(F* f, Attribute const& attr,
-            std::size_t id, bool& pass, Context&)
-        {
-            f(attr, id, pass);
-        }
+            // semantic actions with 3 arguments
+            template <typename F>
+            static void arg3_action(F* f, Attribute const& attr
+              , std::size_t id, bool& pass, Context&)
+            {
+                f(attr, id, pass);
+            }
 
-        template <typename A0, typename A1, typename A2>
-        static FunctionType call(void(*f)(A0, A1, A2))
-        {
-            void (*pf)(void(*)(A0, A1, A2), Attribute const&, std::size_t, 
-                bool&, Context&) = &wrap_action::arg3_action;
+            template <typename A0, typename A1, typename A2>
+            static FunctionType call(void(*f)(A0, A1, A2))
+            {
+                void (*pf)(void(*)(A0, A1, A2), Attribute const&, std::size_t
+                  , bool&, Context&) = &wrap_action::arg3_action;
 
-            using phoenix::arg_names::_1;
-            using phoenix::arg_names::_2;
-            using phoenix::arg_names::_3;
-            return phoenix::bind(pf, f, _1, _2, _3);
-        }
-
-        // semantic actions with 2 arguments
-        template <typename F>
-        static void arg2_action(F* f, Attribute const& attr,
-            std::size_t id, bool&, Context&)
-        {
-            f(attr, id);
-        }
+                using phoenix::arg_names::_1;
+                using phoenix::arg_names::_2;
+                using phoenix::arg_names::_3;
+                return phoenix::bind(pf, f, _1, _2, _3);
+            }
 
-        template <typename A0, typename A1>
-        static FunctionType call(void(*f)(A0, A1))
-        {
-            void (*pf)(void(*)(A0, A1), Attribute const&, std::size_t, 
-                bool&, Context&) = &wrap_action::arg2_action;
+            // semantic actions with 2 arguments
+            template <typename F>
+            static void arg2_action(F* f, Attribute const& attr
+              , std::size_t id, bool&, Context&)
+            {
+                f(attr, id);
+            }
 
-            using phoenix::arg_names::_1;
-            using phoenix::arg_names::_2;
-            return phoenix::bind(pf, f, _1, _2);
-        }
-
-        // semantic actions with 1 argument
-        template <typename F>
-        static void arg1_action(F* f, Attribute const& attr,
-            std::size_t, bool&, Context&)
-        {
-            f(attr);
-        }
+            template <typename A0, typename A1>
+            static FunctionType call(void(*f)(A0, A1))
+            {
+                void (*pf)(void(*)(A0, A1), Attribute const&, std::size_t
+                  , bool&, Context&) = &wrap_action::arg2_action;
 
-        template <typename A0>
-        static FunctionType call(void(*f)(A0))
-        {
-            void (*pf)(void(*)(A0), Attribute const&, std::size_t, 
-                bool&, Context&) = &arg1_action;
+                using phoenix::arg_names::_1;
+                using phoenix::arg_names::_2;
+                return phoenix::bind(pf, f, _1, _2);
+            }
 
-            using phoenix::arg_names::_1;
-            return phoenix::bind(pf, f, _1);
-        }
-
-        // semantic actions with 0 argument
-        template <typename F>
-        static void arg0_action(F* f, Attribute const&,
-            std::size_t, bool&, Context&)
-        {
-            f();
-        }
+            // semantic actions with 1 argument
+            template <typename F>
+            static void arg1_action(F* f, Attribute const& attr
+              , std::size_t, bool&, Context&)
+            {
+                f(attr);
+            }
 
-        static FunctionType call(void(*f)())
-        {
-            void (*pf)(void(*)(), Attribute const&, std::size_t, 
-                bool&, Context&) = &arg0_action;
+            template <typename A0>
+            static FunctionType call(void(*f)(A0))
+            {
+                void (*pf)(void(*)(A0), Attribute const&, std::size_t
+                  , bool&, Context&) = &arg1_action;
 
-            using phoenix::arg_names::_1;
-            return phoenix::bind(pf, f, _1);
-        }
-    };
-
-    // specialization allowing to skip wrapping for lexer types not supporting
-    // semantic actions
-    template <typename Attribute, typename Context>
-    struct wrap_action<unused_type, Attribute, Context>
-    {
-        // plain functors are not touched at all
-        template <typename F>
-        static F const& call(F const& f)
-        {
-            return f;
-        }
-    };
+                using phoenix::arg_names::_1;
+                return phoenix::bind(pf, f, _1);
+            }
+
+            // semantic actions with 0 argument
+            template <typename F>
+            static void arg0_action(F* f, Attribute const&
+              , std::size_t, bool&, Context&)
+            {
+                f();
+            }
+
+            static FunctionType call(void(*f)())
+            {
+                void (*pf)(void(*)(), Attribute const&, std::size_t
+                  , bool&, Context&) = &arg0_action;
+
+                using phoenix::arg_names::_1;
+                return phoenix::bind(pf, f, _1);
+            }
+        };
+
+        // specialization allowing to skip wrapping for lexer types not 
+        // supporting semantic actions
+        template <typename Attribute, typename Context>
+        struct wrap_action<unused_type, Attribute, Context>
+        {
+            // plain functors are not touched at all
+            template <typename F>
+            static F const& call(F const& f)
+            {
+                return f;
+            }
+        };
+    }
 
 }}}}
 
Deleted: trunk/boost/spirit/home/lex/lexer/meta_grammar.hpp
==============================================================================
--- trunk/boost/spirit/home/lex/lexer/meta_grammar.hpp	2009-04-26 10:42:24 EDT (Sun, 26 Apr 2009)
+++ (empty file)
@@ -1,151 +0,0 @@
-//  Copyright (c) 2001-2007 Joel de Guzman
-//  Copyright (c) 2001-2009 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_LEX_LEXER_META_GRAMMAR_MAR_22_2007_0548PM)
-#define BOOST_SPIRIT_LEX_LEXER_META_GRAMMAR_MAR_22_2007_0548PM
-
-#if defined(_MSC_VER) && (_MSC_VER >= 1020)
-#pragma once      // MS compatible compilers support #pragma once
-#endif
-
-#include <boost/spirit/home/lex/domain.hpp>
-#include <boost/spirit/home/lex/lexer/lexer_fwd.hpp>
-#include <boost/spirit/home/lex/lexer/terminal_holder.hpp>
-#include <boost/spirit/home/support/placeholders.hpp>
-#include <boost/spirit/home/support/meta_grammar.hpp>
-#include <boost/utility/enable_if.hpp>
-#include <boost/mpl/bool.hpp>
-
-namespace boost { namespace spirit { namespace lex
-{
-    ///////////////////////////////////////////////////////////////////////////
-    // forward declarations
-    ///////////////////////////////////////////////////////////////////////////
-    struct terminal_director;
-    struct sequence;
-    struct action;
-    struct string_token_def;
-    struct char_token_def;
-    
-    struct lexer_meta_grammar;
-
-    template <typename Expr, typename Enable>
-    struct is_valid_expr;
-
-    template <typename Expr, typename Enable>
-    struct expr_transform;
-
-    ///////////////////////////////////////////////////////////////////////////
-    //  main lexer_meta_grammar in the lex namespace
-    ///////////////////////////////////////////////////////////////////////////
-
-    struct token_def_meta_grammar
-      : proto::or_<
-            // token_def<>
-            meta_grammar::terminal_rule<
-                lex::domain, 
-                terminal_holder<proto::_, lex::token_def<proto::_, proto::_, proto::_> >, 
-                terminal_director
-            >,
-            // token_set
-            meta_grammar::terminal_rule<
-                lex::domain, 
-                terminal_holder<proto::_, lex::token_set<proto::_> >, 
-                terminal_director
-            >
-        >
-    {
-    };
-    
-    // 'x', L'x', "x", L"x", std::string, std::wstring
-    struct literal_token_def_meta_grammar
-      : proto::or_<
-            meta_grammar::terminal_rule<
-                lex::domain, char, char_token_def
-            >,
-            meta_grammar::terminal_rule<
-                lex::domain, wchar_t, char_token_def
-            >,
-            meta_grammar::terminal_rule<
-                lex::domain, char const*, string_token_def 
-            >,
-            meta_grammar::terminal_rule<
-                lex::domain, wchar_t const*, string_token_def 
-            >,
-            meta_grammar::terminal_rule<
-                lex::domain,
-                std::basic_string<char, proto::_, proto::_>,
-                string_token_def 
-            >,
-            meta_grammar::terminal_rule<
-                lex::domain,
-                std::basic_string<wchar_t, proto::_, proto::_>,
-                string_token_def 
-            >
-        >
-    {
-    };
-    
-    struct action_lexer_meta_grammar
-      : proto::or_<
-            // semantic actions for tokens
-            meta_grammar::binary_rule<
-                lex::domain, proto::tag::subscript, action,
-                token_def_meta_grammar, proto::when<proto::_, proto::_child>
-            >,
-            meta_grammar::binary_rule<
-                lex::domain, proto::tag::subscript, action,
-                action_lexer_meta_grammar, proto::when<proto::_, proto::_child>
-            >
-        >
-    {
-    };
-    
-    struct lexer_meta_grammar
-      : proto::or_<
-            // token_def<>, ' ', L' ', "...", L"...", std::string, std::wstring
-            token_def_meta_grammar,
-            literal_token_def_meta_grammar,
-            // token_def[...]
-            action_lexer_meta_grammar,
-            // sequence delimited by '|'
-            meta_grammar::binary_rule_flat<
-                lex::domain, proto::tag::bitwise_or, sequence,
-                lexer_meta_grammar
-            >
-        >
-    {
-    };
-    
-    ///////////////////////////////////////////////////////////////////////////
-    //  These specializations non-intrusively hook into the Lex meta-grammar.
-    //  (see lex/meta_grammar.hpp)
-    ///////////////////////////////////////////////////////////////////////////
-    template <typename Expr>
-    struct is_valid_expr<
-            Expr,
-            typename enable_if<
-                proto::matches<Expr, lexer_meta_grammar> 
-            >::type
-        >
-      : mpl::true_
-    {
-    };
-
-    template <typename Expr>
-    struct expr_transform<
-            Expr,
-            typename enable_if<
-                proto::matches<Expr, lexer_meta_grammar> 
-            >::type
-        >
-      : mpl::identity<lexer_meta_grammar>
-    {
-    };
-
-}}}
-
-#endif
Modified: trunk/boost/spirit/home/lex/lexer/sequence.hpp
==============================================================================
--- trunk/boost/spirit/home/lex/lexer/sequence.hpp	(original)
+++ trunk/boost/spirit/home/lex/lexer/sequence.hpp	2009-04-26 10:42:24 EDT (Sun, 26 Apr 2009)
@@ -10,23 +10,53 @@
 #pragma once      // MS compatible compilers support #pragma once
 #endif
 
-#include <boost/spirit/home/lex/lexer/detail/sequence.hpp>
+#include <boost/spirit/home/lex/domain.hpp>
+#include <boost/spirit/home/lex/lexer_type.hpp>
+#include <boost/spirit/home/lex/meta_compiler.hpp>
+#include <boost/spirit/home/lex/detail/sequence_function.hpp>
 #include <boost/fusion/include/any.hpp>
 
+namespace boost { namespace spirit
+{
+    ///////////////////////////////////////////////////////////////////////////
+    // Enablers
+    ///////////////////////////////////////////////////////////////////////////
+    template <>
+    struct use_operator<lex::domain, proto::tag::bitwise_or>  // enables |
+      : mpl::true_ {};
+
+    template <>
+    struct flatten_tree<lex::domain, proto::tag::bitwise_or>  // flattens |
+      : mpl::true_ {};
+
+}}
+
 namespace boost { namespace spirit { namespace lex
 {
-    struct sequence
+    template <typename Elements>
+    struct sequence : nary_lexer<sequence<Elements> >
     {
-        template <typename Component, typename LexerDef, typename String>
-        static void 
-        collect(Component const& component, LexerDef& lexdef, 
-            String const& state)
+        sequence(Elements const& elements)
+          : elements(elements) {}
+
+        template <typename LexerDef, typename String>
+        void collect(LexerDef& lexdef, String const& state)
         {
-            detail::sequence_collect<LexerDef, String> f (lexdef, state);
-            fusion::any(component.elements, f);
+            detail::sequence_function<LexerDef, String> f (lexdef, state);
+            fusion::any(elements, f);
         }
+
+        Elements elements;
     };
-    
+
+    ///////////////////////////////////////////////////////////////////////////
+    // Lexer generator: make_xxx function (objects)
+    ///////////////////////////////////////////////////////////////////////////
+    template <typename Elements, typename Modifiers>
+    struct make_composite<proto::tag::bitwise_or, Elements, Modifiers>
+      : make_nary_composite<Elements, sequence>
+    {};
+
 }}} // namespace boost::spirit::lex
 
 #endif
Modified: trunk/boost/spirit/home/lex/lexer/string_token_def.hpp
==============================================================================
--- trunk/boost/spirit/home/lex/lexer/string_token_def.hpp	(original)
+++ trunk/boost/spirit/home/lex/lexer/string_token_def.hpp	2009-04-26 10:42:24 EDT (Sun, 26 Apr 2009)
@@ -10,7 +10,35 @@
 #pragma once      // MS compatible compilers support #pragma once
 #endif
 
-#include <boost/spirit/home/support/component.hpp>
+#include <boost/spirit/home/support/common_terminals.hpp>
+#include <boost/spirit/home/support/string_traits.hpp>
+#include <boost/spirit/home/lex/domain.hpp>
+#include <boost/spirit/home/lex/lexer_type.hpp>
+#include <boost/spirit/home/lex/meta_compiler.hpp>
+#include <boost/type_traits/add_const.hpp>
+#include <boost/type_traits/add_reference.hpp>
+#include <boost/type_traits/remove_const.hpp>
+#include <boost/fusion/include/vector.hpp>
+#include <boost/fusion/include/at.hpp>
+
+namespace boost { namespace spirit
+{
+    ///////////////////////////////////////////////////////////////////////////
+    // Enablers
+    ///////////////////////////////////////////////////////////////////////////
+    template <typename T>
+    struct use_terminal<lex::domain, T
+      , typename enable_if<traits::is_string<T> >::type> // enables strings
+      : mpl::true_ {};
+
+    template <typename CharEncoding, typename A0>
+    struct use_terminal<lex::domain
+      , terminal_ex<
+            tag::char_code<tag::string, CharEncoding>   // enables string(str)
+          , fusion::vector1<A0> >
+    > : traits::is_string<A0> {};
+
+}}
 
 namespace boost { namespace spirit { namespace lex
 { 
@@ -20,19 +48,62 @@
     //      represents a string based token definition
     //
     ///////////////////////////////////////////////////////////////////////////
+    template <typename String, typename CharEncoding = unused_type>
     struct string_token_def
+      : primitive_lexer<string_token_def<String, CharEncoding> >
     {
-        template <typename Component, typename LexerDef, typename String>
-        static void 
-        collect(Component const& component, LexerDef& lexdef, 
-            String const& state)
+        typedef typename
+            remove_const<typename traits::char_type_of<String>::type>::type
+        char_type;
+        typedef std::basic_string<char_type> string_type;
+
+        string_token_def(typename add_reference<String>::type str)
+          : str_(str) {}
+
+        template <typename LexerDef, typename State>
+        void collect(LexerDef& lexdef, State const& state) const
         {
             typedef typename LexerDef::id_type id_type;
-            lexdef.add_token (state.c_str(), subject(component), 
-                next_id<id_type>::get());
+            lexdef.add_token (state.c_str(), str_, next_id<id_type>::get());
         }
+
+        string_type str_;
     };
-                
+
+    ///////////////////////////////////////////////////////////////////////////
+    // Lex generators: make_xxx function (objects)
+    ///////////////////////////////////////////////////////////////////////////
+    template <typename T, typename Modifiers>
+    struct make_primitive<T, Modifiers
+      , typename enable_if<traits::is_string<T> >::type>
+    {
+        typedef typename add_const<T>::type const_string;
+        typedef string_token_def<const_string> result_type;
+
+        result_type operator()(
+            typename add_reference<const_string>::type str, unused_type) const
+        {
+            return result_type(str);
+        }
+    };
+
+    template <typename Modifiers, typename CharEncoding, typename A0>
+    struct make_primitive<
+        terminal_ex<
+            tag::char_code<tag::string, CharEncoding>
+          , fusion::vector1<A0> >
+      , Modifiers>
+    {
+        typedef typename add_const<A0>::type const_string;
+        typedef string_token_def<const_string, CharEncoding> result_type;
+
+        template <typename Terminal>
+        result_type operator()(Terminal const& term, unused_type) const
+        {
+            return result_type(fusion::at_c<0>(term.args), no_case());
+        }
+    };
+
 }}}  // namespace boost::spirit::lex
 
 #endif 
Deleted: trunk/boost/spirit/home/lex/lexer/terminal_director.hpp
==============================================================================
--- trunk/boost/spirit/home/lex/lexer/terminal_director.hpp	2009-04-26 10:42:24 EDT (Sun, 26 Apr 2009)
+++ (empty file)
@@ -1,73 +0,0 @@
-//  Copyright (c) 2001-2009 Hartmut Kaiser
-//  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_LEX_TERMINAL_DIRECTOR_MAR_22_2007_0846PM)
-#define BOOST_SPIRIT_LEX_TERMINAL_DIRECTOR_MAR_22_2007_0846PM
-
-#include <boost/spirit/home/lex/lexer/terminal_holder.hpp>
-#include <boost/spirit/home/lex/domain.hpp>
-#include <boost/spirit/home/support/component.hpp>
-
-namespace boost { namespace spirit { namespace lex
-{
-    // this is the director for all lexer related proto terminals
-    struct terminal_director
-    {
-        // Qi interface: return value of the parser
-        template <typename Component, typename Context, typename Iterator>
-        struct attribute
-        {
-            typedef typename
-                result_of::subject<Component>::type
-            terminal_holder;
-            typedef typename terminal_holder::terminal_type terminal_type;
-
-            typedef typename
-                terminal_type::template attribute<
-                    terminal_holder, Context, Iterator
-                >::type
-            type;
-        };
-
-        // Qi interface: parse functionality, delegates back to the
-        // corresponding lexer terminal
-        template <typename Component, typename Iterator, typename Context,
-            typename Skipper, typename Attribute>
-        static bool parse(Component const& component,
-            Iterator& first, Iterator const& last, Context& context,
-            Skipper const& skipper, Attribute& attr)
-        {
-            // main entry point, just forward to the lexer terminal
-            return subject(component).held->parse(
-                first, last, context, skipper, attr);
-        }
-
-        template <typename Component, typename Context>
-        static std::string what(Component const& component, Context const& ctx)
-        {
-            return subject(component).held->what();
-        }
-
-        // Lex interface: collect functionality, delegates back to the
-        // corresponding lexer terminal
-        template <typename Component, typename LexerDef, typename String>
-        static void collect (Component const& component, LexerDef& lexdef,
-            String const& state)
-        {
-            subject(component).held->collect(lexdef, state);
-        }
-
-        // Lex interface: return the token id of the associated token_def
-        template <typename Component>
-        static std::size_t id(Component const& component)
-        {
-            return subject(component).held->id();
-        }
-    };
-
-}}}
-
-#endif
Deleted: trunk/boost/spirit/home/lex/lexer/terminal_holder.hpp
==============================================================================
--- trunk/boost/spirit/home/lex/lexer/terminal_holder.hpp	2009-04-26 10:42:24 EDT (Sun, 26 Apr 2009)
+++ (empty file)
@@ -1,29 +0,0 @@
-//  Copyright (c) 2001-2009 Hartmut Kaiser
-//  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_LEX_TERMINAL_HOLDER_MAR_22_2007_0217PM)
-#define BOOST_SPIRIT_LEX_TERMINAL_HOLDER_MAR_22_2007_0217PM
-
-#include <boost/proto/core.hpp>
-
-namespace boost { namespace spirit { namespace lex
-{
-    template <typename T, typename Terminal>
-    struct terminal_holder
-    {
-        typedef Terminal terminal_type;
-        T held;
-    };
-
-    template <typename T, typename Terminal>
-    struct make_terminal_holder
-      : proto::terminal<terminal_holder<T, Terminal> >
-    {
-    };
-
-}}}
-
-#endif
Added: trunk/boost/spirit/home/lex/lexer/terminals.hpp
==============================================================================
--- (empty file)
+++ trunk/boost/spirit/home/lex/lexer/terminals.hpp	2009-04-26 10:42:24 EDT (Sun, 26 Apr 2009)
@@ -0,0 +1,23 @@
+//  Copyright (c) 2001-2009 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_LEX_TERMINALS_APR_20_2009_0550PM)
+#define BOOST_SPIRIT_LEX_TERMINALS_APR_20_2009_0550PM
+
+#if defined(_MSC_VER) && (_MSC_VER >= 1020)
+#pragma once      // MS compatible compilers support #pragma once
+#endif
+
+#include <boost/spirit/home/support/common_terminals.hpp>
+
+namespace boost { namespace spirit { namespace lex
+{
+    ///////////////////////////////////////////////////////////////////////////
+    //  Define a more convenient name for an omitted token attribute type
+    typedef omit_type omitted;
+
+}}}
+
+#endif
Modified: trunk/boost/spirit/home/lex/lexer/token_def.hpp
==============================================================================
--- trunk/boost/spirit/home/lex/lexer/token_def.hpp	(original)
+++ trunk/boost/spirit/home/lex/lexer/token_def.hpp	2009-04-26 10:42:24 EDT (Sun, 26 Apr 2009)
@@ -10,15 +10,23 @@
 #pragma once      // MS compatible compilers support #pragma once
 #endif
 
-#include <boost/spirit/home/lex/lexer/lexer_fwd.hpp>
-#include <boost/spirit/home/lex/lexer/terminal_holder.hpp>
-#include <boost/fusion/include/vector.hpp>
-#include <boost/spirit/home/qi/skip.hpp>
+#include <boost/spirit/home/support/unused.hpp>
+#include <boost/spirit/home/support/argument.hpp>
+#include <boost/spirit/home/support/info.hpp>
+#include <boost/spirit/home/qi/parser.hpp>
+#include <boost/spirit/home/qi/skip_over.hpp>
 #include <boost/spirit/home/qi/detail/construct.hpp>
 #include <boost/spirit/home/qi/detail/assign_to.hpp>
+#include <boost/spirit/home/lex/reference.hpp>
+#include <boost/spirit/home/lex/lexer_type.hpp>
+#include <boost/spirit/home/lex/lexer/terminals.hpp>
+
+#include <boost/fusion/include/vector.hpp>
 #include <boost/mpl/if.hpp>
 #include <boost/detail/iterator.hpp>
 #include <boost/type_traits/is_same.hpp>
+#include <boost/variant.hpp>
+
 #include <string>
 #include <cstdlib>
 
@@ -27,20 +35,21 @@
     ///////////////////////////////////////////////////////////////////////////
     //  create a unique token id, note this is not thread safe
     ///////////////////////////////////////////////////////////////////////////
-    enum tokenids {
+    enum tokenids 
+    {
         // this is the first token id automatically assigned by the library
         // if needed
         min_token_id = 0x10000
     };
-    
+
     ///////////////////////////////////////////////////////////////////////////
     //  The next_id template needs to be specialized for any non-default token 
-    //  id type used by a custom token type. It need to expose a function
+    //  id type used by a custom token type. It needs to expose a function
     //  'static Idtype get()' returning the next available token id each time 
     //  it is called.
     template <typename Idtype>
     struct next_id;
-    
+
     ///////////////////////////////////////////////////////////////////////////
     //  Default specialization for the next_id template returning the next 
     //  available token id.
@@ -50,38 +59,39 @@
         static std::size_t get()
         {
             static std::size_t next_token_id = min_token_id;
-            return next_token_id++;   
+            return next_token_id++;
         }
     };
-    
+
     ///////////////////////////////////////////////////////////////////////////
     //  This component represents a token definition
     ///////////////////////////////////////////////////////////////////////////
-    template<typename Attribute, typename Char, typename Idtype>
-    class token_def
-      : public proto::extends<
-            typename make_terminal_holder<
-                token_def<Attribute, Char, Idtype>*, 
-                token_def<Attribute, Char, Idtype>
-            >::type,
-            token_def<Attribute, Char, Idtype>
-        >
+    template<typename Attribute = unused_type
+      , typename Char = char
+      , typename Idtype = std::size_t>
+    struct token_def
+      : proto::extends<
+            typename proto::terminal<
+                lex::reference<token_def<Attribute, Char, Idtype> const, Idtype> 
+            >::type
+          , token_def<Attribute, Char, Idtype> >
+      , qi::parser<token_def<Attribute, Char, Idtype> >
+      , lex::lexer_type<token_def<Attribute, Char, Idtype> >
     {
     private:
         // initialize proto base class
-        typedef terminal_holder<token_def*, token_def> terminal_holder_;
-        typedef typename proto::terminal<terminal_holder_>::type tag;
-        typedef proto::extends<tag, token_def> base_type;
+        typedef lex::reference<token_def const, Idtype> reference_;
+        typedef typename proto::terminal<reference_>::type terminal_type;
+        typedef proto::extends<terminal_type, token_def> proto_base_type;
 
-        tag make_tag() 
+        reference_ alias() const
         {
-            tag xpr = {{ this }};
-            return xpr;
+            return reference_(*this);
         }
 
     public:
         // Qi interface: metafunction calculating parser return type
-        template <typename Component, typename Context, typename Iterator>
+        template <typename Context, typename Iterator>
         struct attribute
         {
             //  The return value of the token_def is either the specified 
@@ -89,27 +99,24 @@
             //  corresponding token (if no attribute type has been specified),
             //  or unused_type (if omitted has been specified).
             typedef typename Iterator::base_iterator_type iterator_type;
-            typedef typename
-                mpl::if_<
-                    is_same<Attribute, unused_type>,
-                    iterator_range<iterator_type>,
-                    typename mpl::if_<
-                        is_same<Attribute, omitted>,
-                        unused_type,
-                        Attribute
-                    >::type
+            typedef typename mpl::if_<
+                traits::is_not_unused<Attribute>
+              , typename mpl::if_<
+                    is_same<Attribute, omitted>, unused_type, Attribute
                 >::type
-            type;
+              , iterator_range<iterator_type>
+            >::type type;
         };
 
-    private:
+    public:
         // Qi interface: parse functionality
-        template <typename Iterator, typename Context, typename Skipper, 
-            typename Attribute1>
-        bool parse(Iterator& first, Iterator const& last, 
-            Context& /*context*/, Skipper const& skipper, Attribute1& attr) const
+        template <typename Iterator, typename Context
+          , typename Skipper, typename Attribute_>
+        bool parse(Iterator& first, Iterator const& last
+          , Context& /*context*/, Skipper const& skipper
+          , Attribute_& attr) const
         {
-            qi::skip(first, last, skipper);   // always do a pre-skip
+            qi::skip_over(first, last, skipper);   // always do a pre-skip
 
             if (first != last) {
                 typedef typename 
@@ -129,69 +136,79 @@
             }
             return false;
         }
-        friend struct terminal_director;
-        
-        std::string what() const
-        {
-            std::string result = "token_def(\"";
-            result += def;
-            result += "\")";
-            return result;
+
+        template <typename Context>
+        info what(Context& /*context*/) const
+        {
+            return info("token_def");
         }
-        
+
         ///////////////////////////////////////////////////////////////////////
         // Lex interface: collect token definitions and put it into the 
         // provided lexer def
         template <typename LexerDef, typename String>
-        void collect(LexerDef& lexdef, String const& state)
+        void collect(LexerDef& lexdef, String const& state) const
         {
             token_state = lexdef.add_state(state.c_str());
             if (0 == token_id)
                 token_id = next_id<Idtype>::get();
-            lexdef.add_token (state.c_str(), def, token_id);
+
+            if (0 == def.which())
+                lexdef.add_token (state.c_str(), get<string_type>(def), token_id);
+            else
+                lexdef.add_token (state.c_str(), get<char_type>(def), token_id);
         }
-            
+
     public:
         typedef Char char_type;
         typedef Idtype id_type;
         typedef std::basic_string<char_type> string_type;
-        
+
         // Lex interface: constructing token definitions
         token_def() 
-          : base_type(make_tag()), token_id(0), token_state(~0) 
-        {}
+          : proto_base_type(terminal_type::make(alias()))
+          , def('\0'), token_id(), token_state(~0)  {}
+
         explicit token_def(char_type def_, Idtype id_ = Idtype())
-          : base_type(make_tag()), def(lex::detail::escape(def_)), 
-            token_id(0 == id_ ? def_ : id_), token_state(~0) 
-        {}
-        explicit token_def(string_type def_, Idtype id_ = Idtype())
-          : base_type(make_tag()), def(def_), token_id(id_), token_state(~0) 
-        {}
-        
+          : proto_base_type(terminal_type::make(alias()))
+          , def(def_)
+          , token_id(Idtype() == id_ ? def_ : id_)
+          , token_state(~0) {}
+
+        explicit token_def(string_type const& def_, Idtype id_ = Idtype())
+          : proto_base_type(terminal_type::make(alias()))
+          , def(def_), token_id(id_), token_state(~0) {}
+
         template <typename String>
         token_def& operator= (String const& definition)
         {
             def = definition;
-            token_id = 0;
+            token_id = Idtype();
+            token_state = std::size_t(~0);
             return *this;
         }
         token_def& operator= (token_def const& rhs)
         {
             def = rhs.def;
             token_id = rhs.token_id;
+            token_state = rhs.token_state;
             return *this;
         }
-        
+
         // general accessors 
         Idtype id() const { return token_id; }
         void id(Idtype id) { token_id = id; }
-        string_type const& definition() const { return def; }
+        string_type definition() const 
+        { 
+            return (0 == def.which()) 
+              ? get<string_type>(def) : string_type(1, get<char_type>(def));
+        }
         std::size_t state() const { return token_state; }
-        
+
     private:
-        string_type def;
-        Idtype token_id;
-        std::size_t token_state;
+        variant<string_type, char_type> def;
+        mutable Idtype token_id;
+        mutable std::size_t token_state;
     };
 
 }}}
Modified: trunk/boost/spirit/home/lex/lexer/token_set.hpp
==============================================================================
--- trunk/boost/spirit/home/lex/lexer/token_set.hpp	(original)
+++ trunk/boost/spirit/home/lex/lexer/token_set.hpp	2009-04-26 10:42:24 EDT (Sun, 26 Apr 2009)
@@ -10,8 +10,13 @@
 #pragma once      // MS compatible compilers support #pragma once
 #endif
 
-#include <boost/spirit/home/lex/lexer/lexer_fwd.hpp>
-#include <boost/spirit/home/lex/lexer/terminal_holder.hpp>
+#include <boost/spirit/home/support/unused.hpp>
+#include <boost/spirit/home/support/argument.hpp>
+#include <boost/spirit/home/support/info.hpp>
+#include <boost/spirit/home/qi/parser.hpp>
+#include <boost/spirit/home/qi/skip_over.hpp>
+#include <boost/spirit/home/lex/reference.hpp>
+#include <boost/spirit/home/lex/lexer_type.hpp>
 #include <boost/spirit/home/lex/lexer/token_def.hpp>
 #include <boost/detail/iterator.hpp>
 #include <boost/fusion/include/vector.hpp>
@@ -25,14 +30,16 @@
     //  token_set
     ///////////////////////////////////////////////////////////////////////////
     template <typename TokenSet>
-    class token_set
-      : public TokenSet,
-        public proto::extends<
-            typename make_terminal_holder<
-                token_set<TokenSet>*, token_set<TokenSet>
-            >::type,
-            token_set<TokenSet>
-        >
+    struct token_set
+      : proto::extends<
+            typename proto::terminal<
+                lex::reference<token_set<TokenSet> const> 
+            >::type
+          , token_set<TokenSet> >
+      , TokenSet
+      , qi::parser<token_set<TokenSet> >
+      , lex::lexer_type<token_set<TokenSet> >
+      , noncopyable
     {
     protected:
         typedef typename TokenSet::char_type char_type;
@@ -42,43 +49,40 @@
         // avoid warnings about using 'this' in constructor
         token_set& this_() { return *this; }
 
-        typedef token_set self_type;
         typedef TokenSet base_token_set;
 
         // initialize proto base class
-        typedef terminal_holder<token_set*, token_set> terminal_holder_;
-        typedef typename proto::terminal<terminal_holder_>::type tag;
-        typedef proto::extends<tag, token_set> base_type;
+        typedef lex::reference<token_set const> reference_;
+        typedef typename proto::terminal<reference_>::type terminal_type;
+        typedef proto::extends<terminal_type, token_set> proto_base_type;
 
-        tag make_tag()
+        reference_ alias() const
         {
-            tag xpr = {{ this }};
-            return xpr;
+            return reference_(*this);
         }
 
     public:
         typedef typename TokenSet::id_type id_type;
-        
+
         // Qi interface: metafunction calculating parser return type
-        template <typename Component, typename Context, typename Iterator>
+        template <typename Context, typename Iterator>
         struct attribute
         {
             //  the return value of a token set contains the matched token id,
             //  and the corresponding pair of iterators
             typedef typename Iterator::base_iterator_type iterator_type;
-            typedef
-                fusion::vector<id_type, iterator_range<iterator_type> >
-            type;
+            typedef fusion::vector2<id_type, iterator_range<iterator_type> >
+                type;
         };
 
-    private:
         // Qi interface: parse functionality
-        template <typename Iterator, typename Context, typename Skipper,
-            typename Attribute>
-        bool parse(Iterator& first, Iterator const& last,
-            Context& context, Skipper const& skipper, Attribute& attr) const
+        template <typename Iterator, typename Context
+          , typename Skipper, typename Attribute_>
+        bool parse(Iterator& first, Iterator const& last
+          , Context& /*context*/, Skipper const& skipper
+          , Attribute_& attr) const
         {
-            qi::skip(first, last, skipper);   // always do a pre-skip
+            qi::skip_over(first, last, skipper);   // always do a pre-skip
 
             if (first != last) {
                 typedef typename
@@ -99,56 +103,56 @@
             }
             return false;
         }
-        friend struct terminal_director;
 
-        static std::string what() 
+        template <typename Context>
+        info what(Context& /*context*/) const
         {
-            return "token_set";
+            return info("token_set");
         }
 
         ///////////////////////////////////////////////////////////////////////
         // Lex interface: collect token definitions and put it into the
         // provided lexer def
         template <typename LexerDef, typename String>
-        void collect(LexerDef& lexdef, String const& state)
+        void collect(LexerDef& lexdef, String const& state) const
         {
             token_state = lexdef.add_state(state.c_str());
             lexdef.add_token (state.c_str(), *this);
         }
 
+    private:
         // allow to use the tokset.add("regex1", id1)("regex2", id2);
         // syntax
         struct adder
         {
-            adder(token_set& def_)
-            : def(def_)
-            {}
+            adder(token_set& def_) : def(def_) {}
 
-            adder const&
-            operator()(char_type c, id_type token_id = id_type()) const
+            adder const& operator()(char_type c
+              , id_type token_id = id_type()) const
             {
-                if (0 == token_id)
+                if (id_type() == token_id)
                     token_id = static_cast<std::size_t>(c);
-                def.add_token (def.initial_state().c_str(),
-                    lex::detail::escape(c), token_id);
+                def.add_token (def.initial_state().c_str(), c, token_id);
                 return *this;
             }
-            adder const&
-            operator()(string_type const& s, id_type token_id = id_type()) const
+
+            adder const& operator()(string_type const& s
+              , id_type token_id = id_type()) const
             {
-                if (0 == token_id)
+                if (id_type() == token_id)
                     token_id = next_id<id_type>::get();
                 def.add_token (def.initial_state().c_str(), s, token_id);
                 return *this;
             }
+
             template <typename Attribute>
-            adder const&
-            operator()(token_def<Attribute, char_type, id_type>& tokdef,
-                id_type token_id = id_type()) const
+            adder const& operator()(
+                token_def<Attribute, char_type, id_type>& tokdef
+              , id_type token_id = id_type()) const
             {
                 // make sure we have a token id
-                if (0 == token_id) {
-                    if (0 == tokdef.id()) {
+                if (id_type() == token_id) {
+                    if (id_type() == tokdef.id()) {
                         token_id = next_id<id_type>::get();
                         tokdef.id(token_id);
                     }
@@ -167,9 +171,9 @@
                     token_id);
                 return *this;
             }
+
             template <typename TokenSet_>
-            adder const&
-            operator()(token_set<TokenSet_> const& tokset) const
+            adder const& operator()(token_set<TokenSet_> const& tokset) const
             {
                 def.add_token (def.initial_state().c_str(), tokset);
                 return *this;
@@ -183,9 +187,7 @@
         // syntax
         struct pattern_adder
         {
-            pattern_adder(token_set& def_) 
-            : def(def_)
-            {}
+            pattern_adder(token_set& def_) : def(def_) {}
 
             pattern_adder const&
             operator()(string_type const& p, string_type const& s) const
@@ -197,38 +199,29 @@
             token_set& def;
         };
         friend struct pattern_adder;
-            
+
     public:
         ///////////////////////////////////////////////////////////////////
         template <typename Expr>
-        void define(Expr const& xpr)
+        void define(Expr const& expr)
         {
-            typedef typename
-                result_of::as_component<lex::domain, Expr>::type
-            component;
-            typedef typename component::director director;
-
-            component c = spirit::as_component(lex::domain(), xpr);
-            director::collect(c, *this, base_token_set::initial_state());
+            compile<lex::domain>(expr).collect(
+                *this, base_token_set::initial_state());
         }
 
         token_set()
-          : base_type(make_tag()), add(this_()), add_pattern(this_()), 
-            token_state(~0)
-        {}
+          : proto_base_type(terminal_type::make(alias()))
+          , add(this_()), add_pattern(this_()), token_state(~0) {}
 
         // allow to assign a token definition expression
         template <typename Expr>
         token_set& operator= (Expr const& xpr)
         {
-            typedef
-                spirit::traits::is_component<lex::domain, Expr>
-            is_component;
-
-            // report invalid expression error as early as possible
-            BOOST_MPL_ASSERT_MSG(
-                is_component::value,
-                xpr_is_not_convertible_to_a_token_definition, ());
+            // Report invalid expression error as early as possible.
+            // If you got an error_invalid_expression error message here,
+            // then the expression (expr) is not a valid spirit lex 
+            // expression.
+            BOOST_SPIRIT_ASSERT_MATCH(lex::domain, Expr)
 
             this->clear();
             define(xpr);
@@ -239,7 +232,7 @@
         pattern_adder add_pattern;
 
     private:
-        std::size_t token_state;
+        mutable std::size_t token_state;
     };
 
     // allow to assign a token definition expression
@@ -247,30 +240,25 @@
     inline token_set<TokenSet>&
     operator+= (token_set<TokenSet>& tokset, Expr& xpr)
     {
-        typedef
-            spirit::traits::is_component<lex::domain, Expr>
-        is_component;
-
-        // report invalid expression error as early as possible
-        BOOST_MPL_ASSERT_MSG(
-            is_component::value,
-            xpr_is_not_convertible_to_a_token_definition, ());
+        // Report invalid expression error as early as possible.
+        // If you got an error_invalid_expression error message here,
+        // then the expression (expr) is not a valid spirit lex 
+        // expression.
+        BOOST_SPIRIT_ASSERT_MATCH(lex::domain, Expr)
 
         tokset.define(xpr);
         return tokset;
     }
+
     template <typename TokenSet, typename Expr>
     inline token_set<TokenSet>&
     operator+= (token_set<TokenSet>& tokset, Expr const& xpr)
     {
-        typedef
-            spirit::traits::is_component<lex::domain, Expr>
-        is_component;
-
-        // report invalid expression error as early as possible
-        BOOST_MPL_ASSERT_MSG(
-            is_component::value,
-            xpr_is_not_convertible_to_a_token_definition, ());
+        // Report invalid expression error as early as possible.
+        // If you got an error_invalid_expression error message here,
+        // then the expression (expr) is not a valid spirit lex 
+        // expression.
+        BOOST_SPIRIT_ASSERT_MATCH(lex::domain, Expr)
 
         tokset.define(xpr);
         return tokset;
Modified: trunk/boost/spirit/home/lex/lexer_lexertl.hpp
==============================================================================
--- trunk/boost/spirit/home/lex/lexer_lexertl.hpp	(original)
+++ trunk/boost/spirit/home/lex/lexer_lexertl.hpp	2009-04-26 10:42:24 EDT (Sun, 26 Apr 2009)
@@ -12,7 +12,7 @@
 
 //  These includes make available everything needed to use lexertl either 
 //  standalone or as a lexer component for spirit::qi
-#include <boost/spirit/home/lex/lexer/lexertl/lexertl_lexer.hpp>
 #include <boost/spirit/home/lex.hpp>
+#include <boost/spirit/home/lex/lexer/lexertl/lexer.hpp>
 
 #endif
Modified: trunk/boost/spirit/home/lex/lexer_static_lexertl.hpp
==============================================================================
--- trunk/boost/spirit/home/lex/lexer_static_lexertl.hpp	(original)
+++ trunk/boost/spirit/home/lex/lexer_static_lexertl.hpp	2009-04-26 10:42:24 EDT (Sun, 26 Apr 2009)
@@ -10,9 +10,9 @@
 #pragma once      // MS compatible compilers support #pragma once
 #endif
 
-//  These includes make available everything needed to use lexertl as a lexer 
-//  component for spirit::qi
-#include <boost/spirit/home/lex/lexer/lexertl/lexertl_static_lexer.hpp>
+//  These includes make available everything needed to use lexertl either 
+//  standalone or as a lexer component for spirit::qi
 #include <boost/spirit/home/lex.hpp>
+#include <boost/spirit/home/lex/lexer/lexertl/static_lexer.hpp>
 
 #endif
Added: trunk/boost/spirit/home/lex/lexer_type.hpp
==============================================================================
--- (empty file)
+++ trunk/boost/spirit/home/lex/lexer_type.hpp	2009-04-26 10:42:24 EDT (Sun, 26 Apr 2009)
@@ -0,0 +1,98 @@
+//  Copyright (c) 2001-2009 Hartmut Kaiser
+//  Copyright (c) 2001-2009 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_LEXER_TYPE_APR_20_2009_0759PM)
+#define BOOST_SPIRIT_LEXER_TYPE_APR_20_2009_0759PM
+
+#if defined(_MSC_VER)
+#pragma once
+#endif
+
+#include <boost/mpl/has_xxx.hpp>
+#include <boost/spirit/home/lex/domain.hpp>
+
+namespace boost { namespace spirit { namespace lex
+{
+    template <typename Derived>
+    struct lexer_type
+    {
+        struct lexer_id;
+        typedef Derived derived_type;
+        typedef lex::domain domain;
+
+        // Requirement: l.collect(def, state) -> void
+        //
+        //  l:          a lexer
+        //  def:        token definition
+        //  state:      lexer state this token definition needs to be added to
+
+        Derived const& derived() const
+        {
+            return *static_cast<Derived const*>(this);
+        }
+    };
+
+    template <typename Derived>
+    struct primitive_lexer : lexer_type<Derived>
+    {
+        struct primitive_lexer_id;
+    };
+
+    template <typename Derived>
+    struct unary_lexer : lexer_type<Derived>
+    {
+        struct unary_lexer_id;
+
+        // Requirement: l.subject -> subject lexer
+        //
+        // l:   a unary lexer
+
+        // Requirement: L::subject_type -> subject lexer type
+        //
+        // L:   a unary lexer type
+    };
+
+    template <typename Derived>
+    struct nary_lexer : lexer_type<Derived>
+    {
+        struct nary_lexer_id;
+
+        // Requirement: l.elements -> fusion sequence
+        //
+        // l:   a composite lexer
+
+        // Requirement: L::elements_type -> fusion sequence
+        //
+        // L:   a composite lexer type
+    };
+
+}}}
+
+namespace boost { namespace spirit { namespace traits // classification
+{
+    namespace detail
+    {
+        BOOST_MPL_HAS_XXX_TRAIT_DEF(lexer_id)
+        BOOST_MPL_HAS_XXX_TRAIT_DEF(primitive_lexer_id)
+        BOOST_MPL_HAS_XXX_TRAIT_DEF(unary_lexer_id)
+        BOOST_MPL_HAS_XXX_TRAIT_DEF(nary_lexer_id)
+    }
+
+    template <typename T>
+    struct is_lexer : detail::has_lexer_id<T> {};
+
+    template <typename T>
+    struct is_primitive_lexer : detail::has_primitive_lexer_id<T> {};
+
+    template <typename T>
+    struct is_unary_lexer : detail::has_unary_lexer_id<T> {};
+
+    template <typename T>
+    struct is_nary_lexer : detail::has_nary_lexer_id<T> {};
+
+}}}
+
+#endif
Added: trunk/boost/spirit/home/lex/meta_compiler.hpp
==============================================================================
--- (empty file)
+++ trunk/boost/spirit/home/lex/meta_compiler.hpp	2009-04-26 10:42:24 EDT (Sun, 26 Apr 2009)
@@ -0,0 +1,104 @@
+//  Copyright (c) 2001-2009 Hartmut Kaiser
+//  Copyright (c) 2001-2009 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_LEX_META_COMPILER_APR_20_2009_0756PM)
+#define BOOST_SPIRIT_LEX_META_COMPILER_APR_20_2009_0756PM
+
+#if defined(_MSC_VER)
+#pragma once
+#endif
+
+#include <boost/spirit/home/support/meta_compiler.hpp>
+#include <boost/spirit/home/lex/domain.hpp>
+#include <boost/spirit/home/lex/lexer_type.hpp>
+#include <boost/type_traits/remove_reference.hpp>
+#include <boost/utility/enable_if.hpp>
+
+namespace boost { namespace spirit
+{
+    template <typename T>
+    struct use_terminal<lex::domain, T
+      , typename enable_if<traits::is_lexer<T> >::type> // enables lexers
+      : mpl::true_ {};
+
+    namespace lex
+    {
+        template <typename T, typename Modifiers, typename Enable = void>
+        struct make_primitive // by default, return it as-is
+        {
+            typedef T result_type;
+
+            template <typename T_>
+            T_& operator()(T_& val, unused_type) const
+            {
+                return val;
+            }
+
+            template <typename T_>
+            T_ const& operator()(T_ const& val, unused_type) const
+            {
+                return val;
+            }
+        };
+
+        template <typename Tag, typename Elements
+          , typename Modifiers, typename Enable = void>
+        struct make_composite;
+    }
+
+    // Lex primitive meta-compiler
+    template <>
+    struct make_component<lex::domain, proto::tag::terminal>
+    {
+        template <typename Sig>
+        struct result;
+
+        template <typename This, typename Elements, typename Modifiers>
+        struct result<This(Elements, Modifiers)>
+        {
+            typedef typename lex::make_primitive<
+                typename remove_const<typename Elements::car_type>::type,
+                typename remove_reference<Modifiers>::type>::result_type
+            type;
+        };
+
+        template <typename Elements, typename Modifiers>
+        typename result<make_component(Elements, Modifiers)>::type
+        operator()(Elements const& elements, Modifiers const& modifiers) const
+        {
+            typedef typename remove_const<typename Elements::car_type>::type term;
+            return lex::make_primitive<term, Modifiers>()(elements.car, modifiers);
+        }
+    };
+
+    // Lex composite meta-compiler
+    template <typename Tag>
+    struct make_component<lex::domain, Tag>
+    {
+        template <typename Sig>
+        struct result;
+
+        template <typename This, typename Elements, typename Modifiers>
+        struct result<This(Elements, Modifiers)>
+        {
+            typedef typename
+                lex::make_composite<Tag, Elements
+                  , typename remove_reference<Modifiers>::type>::result_type
+            type;
+        };
+
+        template <typename Elements, typename Modifiers>
+        typename result<make_component(Elements, Modifiers)>::type
+        operator()(Elements const& elements, Modifiers const& modifiers) const
+        {
+            return lex::make_composite<Tag, Elements, Modifiers>()(
+                elements, modifiers);
+        }
+    };
+
+}}
+
+#endif
Deleted: trunk/boost/spirit/home/lex/meta_grammar.hpp
==============================================================================
--- trunk/boost/spirit/home/lex/meta_grammar.hpp	2009-04-26 10:42:24 EDT (Sun, 26 Apr 2009)
+++ (empty file)
@@ -1,53 +0,0 @@
-//  Copyright (c) 2001-2007 Joel de Guzman
-//  Copyright (c) 2001-2009 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_LEX_META_GRAMMAR_MAR_13_2007_0243PM)
-#define BOOST_SPIRIT_LEX_META_GRAMMAR_MAR_13_2007_0243PM
-
-#if defined(_MSC_VER) && (_MSC_VER >= 1020)
-#pragma once      // MS compatible compilers support #pragma once
-#endif
-
-#include <boost/spirit/home/support/meta_grammar/grammar.hpp>
-#include <boost/spirit/home/support/meta_grammar/basic_transforms.hpp>
-#include <boost/spirit/home/lex/domain.hpp>
-#include <boost/mpl/bool.hpp>
-#include <boost/mpl/placeholders.hpp>
-
-namespace boost { namespace spirit { namespace lex
-{
-    // Check if Expr is a valid lexer expression
-    template <typename Expr, typename Enable = void>
-    struct is_valid_expr : mpl::false_ {};
-
-    // Return a suitable transform for the given Expr
-    template <typename Expr, typename Enable = void>
-    struct expr_transform;
-
-    struct main_meta_grammar
-      : meta_grammar::if_transform<
-            is_valid_expr<proto::_>(),
-            expr_transform<proto::_> 
-        >
-    {
-    };
-    
-}}}
-
-namespace boost { namespace spirit { namespace meta_grammar
-{
-    ///////////////////////////////////////////////////////////////////////////
-    //  The spirit lexer domain meta-grammar
-    ///////////////////////////////////////////////////////////////////////////
-    template <>
-    struct grammar<lex::domain>
-    {
-        typedef lex::main_meta_grammar type;
-    };
-    
-}}}
-
-#endif
Added: trunk/boost/spirit/home/lex/qi.hpp
==============================================================================
--- (empty file)
+++ trunk/boost/spirit/home/lex/qi.hpp	2009-04-26 10:42:24 EDT (Sun, 26 Apr 2009)
@@ -0,0 +1,17 @@
+//  Copyright (c) 2001-2009 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_LEXER_QI_APR_21_2009_0205PM)
+#define BOOST_SPIRIT_LEXER_QI_APR_21_2009_0205PM
+
+#if defined(_MSC_VER) && (_MSC_VER >= 1020)
+#pragma once      // MS compatible compilers support #pragma once
+#endif
+
+#include <boost/spirit/home/lex/qi/state_switcher.hpp>
+#include <boost/spirit/home/lex/qi/in_state.hpp>
+#include <boost/spirit/home/lex/qi/plain_token.hpp>
+
+#endif
Added: trunk/boost/spirit/home/lex/qi/in_state.hpp
==============================================================================
--- (empty file)
+++ trunk/boost/spirit/home/lex/qi/in_state.hpp	2009-04-26 10:42:24 EDT (Sun, 26 Apr 2009)
@@ -0,0 +1,33 @@
+//  Copyright (c) 2001-2009 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_LEX_IN_STATE_OCT_09_2007_0748PM)
+#define BOOST_SPIRIT_LEX_IN_STATE_OCT_09_2007_0748PM
+
+#if defined(_MSC_VER) && (_MSC_VER >= 1020)
+#pragma once      // MS compatible compilers support #pragma once
+#endif
+
+#include <boost/proto/core.hpp>
+
+///////////////////////////////////////////////////////////////////////////////
+namespace boost { namespace spirit { namespace qi
+{
+    ///////////////////////////////////////////////////////////////////////////
+    // The following is a helper template allowing to use the in_state()[] as 
+    // a skip parser
+    ///////////////////////////////////////////////////////////////////////////
+    template <typename Skipper, typename String = char const*>
+    struct in_state_skipper
+      : proto::subscript<
+            typename proto::terminal<
+                terminal_ex<tag::in_state, fusion::vector1<String> > 
+            >::type
+          , Skipper
+        >::type {};
+
+}}}
+
+#endif
Deleted: trunk/boost/spirit/home/lex/qi/meta_grammar.hpp
==============================================================================
--- trunk/boost/spirit/home/lex/qi/meta_grammar.hpp	2009-04-26 10:42:24 EDT (Sun, 26 Apr 2009)
+++ (empty file)
@@ -1,96 +0,0 @@
-//  Copyright (c) 2001-2007 Joel de Guzman
-//  Copyright (c) 2001-2009 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_LEX_QI_META_GRAMMAR_NOV_18_2007_1144AM)
-#define BOOST_SPIRIT_LEX_QI_META_GRAMMAR_NOV_18_2007_1144AM
-
-#if defined(_MSC_VER) && (_MSC_VER >= 1020)
-#pragma once      // MS compatible compilers support #pragma once
-#endif
-
-#include <boost/spirit/home/qi/domain.hpp>
-#include <boost/spirit/home/support/placeholders.hpp>
-#include <boost/spirit/home/support/meta_grammar.hpp>
-#include <boost/utility/enable_if.hpp>
-#include <boost/mpl/bool.hpp>
-
-namespace boost { namespace spirit { namespace qi
-{
-    ///////////////////////////////////////////////////////////////////////////
-    // forward declarations
-    ///////////////////////////////////////////////////////////////////////////
-    struct main_meta_grammar;
-    struct lexer_meta_grammar;
-
-    struct state_switcher;
-    struct state_switcher_context;
-
-    struct plain_token;
-
-    template <typename Expr, typename Enable>
-    struct is_valid_expr;
-
-    template <typename Expr, typename Enable>
-    struct expr_transform;
-
-    ///////////////////////////////////////////////////////////////////////////
-    //  main lexer_meta_grammar in the qi namespace
-    ///////////////////////////////////////////////////////////////////////////
-    struct lexer_meta_grammar
-      : proto::or_<
-            // lexer, lexer_def, token_def
-            meta_grammar::terminal_rule<
-                qi::domain, 
-                lex::terminal_holder<proto::_, proto::_>, 
-                lex::terminal_director
-            >,
-            // set_state("..."), set_state(str)
-            meta_grammar::terminal_rule<
-                qi::domain, tag::set_state_tag<proto::_>, state_switcher
-            >,
-            // in_state("...")[], in_state(str)[]
-            meta_grammar::subscript_rule<
-                qi::domain, in_state_tag<proto::_>, state_switcher_context,
-                main_meta_grammar
-            >,
-            // token(id)
-            meta_grammar::function1_rule<
-                qi::domain, tag::token, plain_token, 
-                proto::terminal<proto::convertible_to<int> >
-            >
-        >
-    {
-    };
-    
-    ///////////////////////////////////////////////////////////////////////////
-    //  These specializations non-intrusively hook into the Qi meta-grammar.
-    //  (see qi/meta_grammar.hpp)
-    ///////////////////////////////////////////////////////////////////////////
-    template <typename Expr>
-    struct is_valid_expr<
-            Expr,
-            typename enable_if<
-                proto::matches<Expr, lexer_meta_grammar> 
-            >::type
-        >
-      : mpl::true_
-    {
-    };
-
-    template <typename Expr>
-    struct expr_transform<
-            Expr,
-            typename enable_if<
-                proto::matches<Expr, lexer_meta_grammar> 
-            >::type
-        >
-      : mpl::identity<lexer_meta_grammar>
-    {
-    };
-
-}}}
-
-#endif
Added: trunk/boost/spirit/home/lex/qi/plain_token.hpp
==============================================================================
--- (empty file)
+++ trunk/boost/spirit/home/lex/qi/plain_token.hpp	2009-04-26 10:42:24 EDT (Sun, 26 Apr 2009)
@@ -0,0 +1,119 @@
+//  Copyright (c) 2001-2009 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_LEX_PLAIN_TOKEN_NOV_11_2007_0451PM)
+#define BOOST_SPIRIT_LEX_PLAIN_TOKEN_NOV_11_2007_0451PM
+
+#if defined(_MSC_VER) && (_MSC_VER >= 1020)
+#pragma once      // MS compatible compilers support #pragma once
+#endif
+
+#include <boost/spirit/home/support/info.hpp>
+#include <boost/spirit/home/support/attributes.hpp>
+#include <boost/spirit/home/support/common_terminals.hpp>
+#include <boost/spirit/home/qi/skip_over.hpp>
+#include <boost/spirit/home/qi/domain.hpp>
+#include <boost/spirit/home/qi/parser.hpp>
+#include <boost/spirit/home/qi/meta_compiler.hpp>
+#include <boost/spirit/home/qi/detail/assign_to.hpp>
+#include <boost/range/iterator_range.hpp>
+#include <boost/fusion/include/vector.hpp>
+#include <boost/fusion/include/at.hpp>
+#include <boost/mpl/or.hpp>
+#include <boost/type_traits/is_integral.hpp>
+#include <boost/type_traits/is_enum.hpp>
+
+namespace boost { namespace spirit
+{
+    ///////////////////////////////////////////////////////////////////////////
+    // Enablers
+    ///////////////////////////////////////////////////////////////////////////
+
+    // enables token(id)
+    template <typename A0>
+    struct use_terminal<qi::domain
+      , terminal_ex<tag::token, fusion::vector1<A0> >
+    > : mpl::or_<is_integral<A0>, is_enum<A0> > {};
+
+    // enables *lazy* token(id)
+    template <>
+    struct use_lazy_terminal<
+        qi::domain, tag::token, 1
+    > : mpl::true_ {};
+
+}}
+
+namespace boost { namespace spirit { namespace qi
+{
+    using spirit::token;
+
+    ///////////////////////////////////////////////////////////////////////////
+    template <typename TokenId>
+    struct plain_token
+    {
+        template <typename Context, typename Iterator>
+        struct attribute
+        {
+            typedef typename Iterator::base_iterator_type iterator_type;
+            typedef iterator_range<iterator_type> type;
+        };
+
+        plain_token(TokenId const& id)
+          : id(id) {}
+
+        template <typename Iterator, typename Context
+          , typename Skipper, typename Attribute>
+        bool parse(Iterator& first, Iterator const& last
+          , Context& /*context*/, Skipper const& skipper
+          , Attribute& attr) const
+        {
+            qi::skip_over(first, last, skipper);   // always do a pre-skip
+
+            if (first != last) {
+                // simply match the token id with the id this component has 
+                // been initialized with
+
+                typedef typename 
+                    boost::detail::iterator_traits<Iterator>::value_type 
+                token_type;
+
+                token_type &t = *first;
+                if (id == t.id()) {
+                    qi::detail::assign_to(t, attr);
+                    ++first;
+                    return true;
+                }
+            }
+            return false;
+        }
+
+        template <typename Context>
+        info what(Context& /*context*/) const
+        {
+            return info("token");
+        }
+
+        TokenId id;
+    };
+
+    ///////////////////////////////////////////////////////////////////////////
+    // Parser generators: make_xxx function (objects)
+    ///////////////////////////////////////////////////////////////////////////
+    template <typename Modifiers, typename TokenId>
+    struct make_primitive<terminal_ex<tag::token, fusion::vector1<TokenId> >
+      , Modifiers>
+    {
+        typedef plain_token<TokenId> result_type;
+
+        template <typename Terminal>
+        result_type operator()(Terminal const& term, unused_type) const
+        {
+            return result_type(fusion::at_c<0>(term.args));
+        }
+    };
+
+}}}
+
+#endif
Added: trunk/boost/spirit/home/lex/qi/state_switcher.hpp
==============================================================================
--- (empty file)
+++ trunk/boost/spirit/home/lex/qi/state_switcher.hpp	2009-04-26 10:42:24 EDT (Sun, 26 Apr 2009)
@@ -0,0 +1,241 @@
+//  Copyright (c) 2001-2009 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_LEX_STATE_SWITCHER_SEP_23_2007_0714PM)
+#define BOOST_SPIRIT_LEX_STATE_SWITCHER_SEP_23_2007_0714PM
+
+#if defined(_MSC_VER) && (_MSC_VER >= 1020)
+#pragma once      // MS compatible compilers support #pragma once
+#endif
+
+#include <boost/spirit/home/support/info.hpp>
+#include <boost/spirit/home/support/attributes.hpp>
+#include <boost/spirit/home/support/common_terminals.hpp>
+#include <boost/spirit/home/support/string_traits.hpp>
+#include <boost/spirit/home/qi/skip_over.hpp>
+#include <boost/spirit/home/qi/domain.hpp>
+#include <boost/spirit/home/qi/parser.hpp>
+#include <boost/spirit/home/qi/meta_compiler.hpp>
+#include <boost/mpl/print.hpp>
+
+namespace boost { namespace spirit
+{
+    ///////////////////////////////////////////////////////////////////////////
+    // Enablers
+    ///////////////////////////////////////////////////////////////////////////
+
+    // enables set_state(s)
+    template <typename A0>
+    struct use_terminal<qi::domain
+      , terminal_ex<tag::set_state, fusion::vector1<A0> >
+    > : traits::is_string<A0> {};
+
+    // enables *lazy* set_state(s)
+    template <>
+    struct use_lazy_terminal<
+        qi::domain, tag::set_state, 1
+    > : mpl::true_ {};
+
+    // enables in_state(s)[p]
+    template <typename A0>
+    struct use_directive<qi::domain
+      , terminal_ex<tag::in_state, fusion::vector1<A0> >
+    > : traits::is_string<A0> {};
+
+    // enables *lazy* in_state(s)[p]
+    template <>
+    struct use_lazy_directive<
+        qi::domain, tag::in_state, 1
+    > : mpl::true_ {};
+
+}}
+
+namespace boost { namespace spirit { namespace qi
+{
+    using spirit::set_state;
+    using spirit::in_state;
+
+    ///////////////////////////////////////////////////////////////////////////
+    namespace detail
+    {
+        template <typename Iterator>
+        inline std::size_t
+        set_lexer_state(Iterator& it, std::size_t state)
+        {
+            return it.set_state(state);
+        }
+
+        template <typename Iterator, typename Char>
+        inline std::size_t
+        set_lexer_state(Iterator& it, Char const* statename)
+        {
+            std::size_t state = it.map_state(statename);
+
+            //  If the following assertion fires you probably used the
+            //  set_state(...) or in_state(...)[...] lexer state switcher with
+            //  a lexer state name unknown to the lexer (no token definitions
+            //  have been associated with this lexer state).
+            BOOST_ASSERT(static_cast<std::size_t>(~0) != state);
+            return it.set_state(state);
+        }
+    }
+
+    ///////////////////////////////////////////////////////////////////////////
+    //  Parser switching the state of the underlying lexer component.
+    //  This parser gets used for the set_state(...) construct.
+    ///////////////////////////////////////////////////////////////////////////
+    template <typename State>
+    struct state_switcher
+      : primitive_parser<state_switcher<State> >
+    {
+        typedef typename 
+            remove_const<typename traits::char_type_of<State>::type>::type 
+        char_type;
+        typedef std::basic_string<char_type> string_type;
+
+        template <typename Context, typename Iterator>
+        struct attribute
+        {
+            typedef unused_type type;
+        };
+
+        state_switcher(char_type const* state)
+          : state(state) {}
+
+        template <typename Iterator, typename Context
+          , typename Skipper, typename Attribute>
+        bool parse(Iterator& first, Iterator const& last
+          , Context& /*context*/, Skipper const& skipper
+          , Attribute& attr) const
+        {
+            qi::skip_over(first, last, skipper);   // always do a pre-skip
+
+            // just switch the state and return success
+            detail::set_lexer_state(first, state.c_str());
+            return true;
+        }
+
+        template <typename Context>
+        info what(Context& /*context*/) const
+        {
+            return info("set_state");
+        }
+
+        string_type state;
+    };
+
+    ///////////////////////////////////////////////////////////////////////////
+    namespace detail
+    {
+        template <typename Iterator>
+        struct reset_state_on_exit
+        {
+            template <typename State>
+            reset_state_on_exit(Iterator& it_, State state_)
+              : it(it_)
+              , state(detail::set_lexer_state(it_, traits::get_c_string(state_))) 
+            {}
+
+            ~reset_state_on_exit()
+            {
+                // reset the state of the underlying lexer instance
+                detail::set_lexer_state(it, state);
+            }
+
+            Iterator& it;
+            std::size_t state;
+        };
+    }
+
+    ///////////////////////////////////////////////////////////////////////////
+    // Parser, which switches the state of the underlying lexer component
+    // for the execution of the embedded sub-parser, switching the state back
+    // afterwards. This parser gets used for the in_state(...)[p] construct.
+    ///////////////////////////////////////////////////////////////////////////
+    template <typename Subject, typename State>
+    struct state_switcher_context 
+      : unary_parser<state_switcher_context<Subject, State> >
+    {
+        typedef Subject subject_type;
+        typedef typename traits::char_type_of<State>::type char_type;
+        typedef typename remove_const<char_type>::type non_const_char_type;
+
+        template <typename Context, typename Iterator>
+        struct attribute
+        {
+            typedef typename
+                traits::attribute_of<subject_type, Context>::type
+            type;
+        };
+
+        state_switcher_context(Subject const& subject
+              , typename add_reference<State>::type state)
+          : subject(subject), state(state) {}
+
+        // The following conversion constructors are needed to make the 
+        // in_state_switcher template usable
+        template <typename String>
+        state_switcher_context(
+                state_switcher_context<Subject, String> const& rhs)
+          : subject(rhs.subject), state(traits::get_c_string(rhs.state)) {}
+
+        template <typename Iterator, typename Context
+          , typename Skipper, typename Attribute>
+        bool parse(Iterator& first, Iterator const& last
+          , Context& context, Skipper const& skipper
+          , Attribute& attr) const
+        {
+            qi::skip_over(first, last, skipper);   // always do a pre-skip
+
+            // the state has to be reset at exit in any case
+            detail::reset_state_on_exit<Iterator> guard(first, state);
+            return subject.parse(first, last, context, skipper, attr);
+        }
+
+        template <typename Context>
+        info what(Context& context) const
+        {
+            return info("in_state", subject.what(context));
+        }
+
+        Subject subject;
+        State state;
+    };
+
+    ///////////////////////////////////////////////////////////////////////////
+    // Parser generators: make_xxx function (objects)
+    ///////////////////////////////////////////////////////////////////////////
+    template <typename Modifiers, typename State>
+    struct make_primitive<terminal_ex<tag::set_state, fusion::vector1<State> >
+      , Modifiers, typename enable_if<traits::is_string<State> >::type>
+    {
+        typedef typename add_const<State>::type const_string;
+        typedef state_switcher<const_string> result_type;
+
+        template <typename Terminal>
+        result_type operator()(Terminal const& term, unused_type) const
+        {
+            return result_type(traits::get_c_string(fusion::at_c<0>(term.args)));
+        }
+    };
+
+    template <typename State, typename Subject, typename Modifiers>
+    struct make_directive<terminal_ex<tag::in_state, fusion::vector1<State> >
+      , Subject, Modifiers>
+    {
+        typedef typename add_const<State>::type const_string;
+        typedef state_switcher_context<Subject, const_string> result_type;
+
+        template <typename Terminal>
+        result_type operator()(Terminal const& term, Subject const& subject
+          , unused_type) const
+        {
+            return result_type(subject, fusion::at_c<0>(term.args));
+        }
+    };
+
+}}}
+
+#endif
Added: trunk/boost/spirit/home/lex/reference.hpp
==============================================================================
--- (empty file)
+++ trunk/boost/spirit/home/lex/reference.hpp	2009-04-26 10:42:24 EDT (Sun, 26 Apr 2009)
@@ -0,0 +1,58 @@
+//  Copyright (c) 2001-2009 Hartmut Kaiser
+//  Copyright (c) 2001-2009 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_LEX_REFERENCE_APR_20_2009_0827AM)
+#define BOOST_SPIRIT_LEX_REFERENCE_APR_20_2009_0827AM
+
+#if defined(_MSC_VER)
+#pragma once
+#endif
+
+#include <boost/spirit/home/lex/meta_compiler.hpp>
+#include <boost/spirit/home/lex/lexer_type.hpp>
+#include <boost/spirit/home/qi/reference.hpp>
+#include <boost/spirit/home/support/info.hpp>
+#include <boost/ref.hpp>
+
+namespace boost { namespace spirit { namespace lex
+{
+    ///////////////////////////////////////////////////////////////////////////
+    // reference is a lexer that references another lexer (its Subject)
+    // all lexer components are at the same time
+    ///////////////////////////////////////////////////////////////////////////
+    template <typename Subject, typename IdType = unused_type>
+    struct reference; 
+
+    template <typename Subject>
+    struct reference<Subject, unused_type>
+      : qi::reference<Subject>
+      , lexer_type<reference<Subject> >
+    {
+        reference(Subject& subject)
+          : qi::reference<Subject>(subject) {}
+
+        template <typename LexerDef, typename String>
+        void collect(LexerDef& lexdef, String const& state) const
+        {
+            return ref.get().collect(lexdef, state);
+        }
+    };
+
+    template <typename Subject, typename IdType>
+    struct reference : reference<Subject>
+    {
+        reference(Subject& subject)
+          : reference<Subject>(subject) {}
+
+        IdType id() const 
+        { 
+            return ref.get().id(); 
+        }
+    };
+
+}}}
+
+#endif
Deleted: trunk/boost/spirit/home/lex/set_state.hpp
==============================================================================
--- trunk/boost/spirit/home/lex/set_state.hpp	2009-04-26 10:42:24 EDT (Sun, 26 Apr 2009)
+++ (empty file)
@@ -1,60 +0,0 @@
-//  Copyright (c) 2001-2009 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_LEX_SET_STATE_FEB_13_2008_0719PM)
-#define BOOST_SPIRIT_LEX_SET_STATE_FEB_13_2008_0719PM
-
-#if defined(_MSC_VER) && (_MSC_VER >= 1020)
-#pragma once      // MS compatible compilers support #pragma once
-#endif
-
-#include <boost/proto/core.hpp>
-
-///////////////////////////////////////////////////////////////////////////////
-namespace boost { namespace spirit 
-{
-    namespace tag
-    {
-        ///////////////////////////////////////////////////////////////////////
-        // This is the tag returned by the set_state function
-        template <typename String>
-        struct set_state_tag 
-        {
-            String name;
-        };
-    }
-        
-    ///////////////////////////////////////////////////////////////////////////
-    // These are the different overloads allowed for the set_state(...) 
-    // construct, which is used by qi and by lex for lexer state switching 
-    // from inside a (parser or lexer) semantic action
-    ///////////////////////////////////////////////////////////////////////////
-    inline proto::terminal<tag::set_state_tag<char const*> >::type
-    set_state(char const *s)
-    {
-        proto::terminal<tag::set_state_tag<char const*> >::type that = {{s}};
-        return that;
-    }
-    
-    inline proto::terminal<tag::set_state_tag<wchar_t const*> >::type
-    set_state(wchar_t const *s)
-    {
-        proto::terminal<tag::set_state_tag<wchar_t const*> >::type that = {{s}};
-        return that;
-    }
-    
-    template <typename Char, typename Traits, typename Allocator>
-    inline proto::terminal<tag::set_state_tag<char const*> >::type
-    set_state(std::basic_string<Char, Traits, Allocator> const& s)
-    {
-        typename proto::terminal<tag::set_state_tag<Char const*> >::type that = 
-            {{s.c_str()}};
-        return that;
-    }
-
-///////////////////////////////////////////////////////////////////////////////
-}}
-
-#endif
Modified: trunk/boost/spirit/home/lex/tokenize_and_parse.hpp
==============================================================================
--- trunk/boost/spirit/home/lex/tokenize_and_parse.hpp	(original)
+++ trunk/boost/spirit/home/lex/tokenize_and_parse.hpp	2009-04-26 10:42:24 EDT (Sun, 26 Apr 2009)
@@ -1,14 +1,12 @@
-/*=============================================================================
-    Copyright (c) 2001-2009 Hartmut Kaiser
+//  Copyright (c) 2001-2009 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)
 
-    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_LEXER_PARSE_NOV_17_2007_0246PM)
 #define BOOST_SPIRIT_LEXER_PARSE_NOV_17_2007_0246PM
 
-#include <boost/spirit/home/qi/meta_grammar.hpp>
-#include <boost/spirit/home/qi/skip.hpp>
+#include <boost/spirit/home/qi/skip_over.hpp>
 #include <boost/spirit/home/qi/nonterminal/grammar.hpp>
 #include <boost/spirit/home/support/unused.hpp>
 #include <boost/spirit/home/lex/lexer.hpp>
@@ -57,54 +55,34 @@
     //                  to the matched input sequence.
     //
     ///////////////////////////////////////////////////////////////////////////
-    template <typename Iterator, typename LexerExpr, typename ParserExpr>
+    template <typename Iterator, typename Lexer, typename ParserExpr>
     inline bool
-    tokenize_and_parse(Iterator& first, Iterator last, LexerExpr const& lex,
+    tokenize_and_parse(Iterator& first, Iterator last, Lexer const& lex,
         ParserExpr const& xpr)
     {
-        typedef typename LexerExpr::iterator_type iterator_type;
-        typedef spirit::traits::is_component<qi::domain, ParserExpr> 
-            is_component;
-
-        // report invalid expression error as early as possible
-        BOOST_MPL_ASSERT_MSG(
-            is_component::value,
-            xpr_is_not_convertible_to_a_parser, (iterator_type, ParserExpr));
-
-        typedef typename 
-            result_of::as_component<qi::domain, ParserExpr>::type 
-        component;
-        typedef typename component::director director;
-        component c = spirit::as_component(qi::domain(), xpr);
+        // Report invalid expression error as early as possible.
+        // If you got an error_invalid_expression error message here,
+        // then the expression (expr) is not a valid spirit qi expression.
+        BOOST_SPIRIT_ASSERT_MATCH(qi::domain, ParserExpr)
 
-        iterator_type iter = lex.begin(first, last);
-        return director::parse(c, iter, lex.end(), unused, unused, unused);
+        typename Lexer::iterator_type iter = lex.begin(first, last);
+        return compile<qi::domain>(xpr).parse(iter, lex.end(), unused, unused, unused);
     }
 
     ///////////////////////////////////////////////////////////////////////////
-    template <typename Iterator, typename LexerExpr, typename ParserExpr,
-        typename Attribute>
+    template <typename Iterator, typename Lexer, typename ParserExpr
+      , typename Attribute>
     inline bool
-    tokenize_and_parse(Iterator& first, Iterator last, LexerExpr const& lex,
-        ParserExpr const& xpr, Attribute& attr)
+    tokenize_and_parse(Iterator& first, Iterator last, Lexer const& lex
+      , ParserExpr const& xpr, Attribute& attr)
     {
-        typedef typename LexerExpr::iterator_type iterator_type;
-        typedef spirit::traits::is_component<qi::domain, ParserExpr> 
-            is_component;
-
-        // report invalid expression error as early as possible
-        BOOST_MPL_ASSERT_MSG(
-            is_component::value,
-            xpr_is_not_convertible_to_a_parser, (iterator_type, ParserExpr));
-
-        typedef typename 
-            result_of::as_component<qi::domain, ParserExpr>::type 
-        component;
-        typedef typename component::director director;
-        component c = spirit::as_component(qi::domain(), xpr);
+        // Report invalid expression error as early as possible.
+        // If you got an error_invalid_expression error message here,
+        // then the expression (expr) is not a valid spirit qi expression.
+        BOOST_SPIRIT_ASSERT_MATCH(qi::domain, ParserExpr)
 
-        iterator_type iter = lex.begin(first, last);
-        return director::parse(c, iter, lex.end(), unused, unused, attr);
+        typename Lexer::iterator_type iter = lex.begin(first, last);
+        return compile<qi::domain>(xpr).parse(iter, lex.end(), unused, unused, attr);
     }
 
     ///////////////////////////////////////////////////////////////////////////
@@ -154,91 +132,59 @@
     //                  'xpr'.
     //
     ///////////////////////////////////////////////////////////////////////////
-    template <
-        typename Iterator, typename LexerExpr, typename ParserExpr, 
-        typename Skipper
-    >
+    template <typename Iterator, typename Lexer, typename ParserExpr
+      , typename Skipper>
     inline bool
-    tokenize_and_phrase_parse(Iterator& first, Iterator last, 
-        LexerExpr const& lex, ParserExpr const& xpr, Skipper const& skipper_)
+    tokenize_and_phrase_parse(Iterator& first, Iterator last
+      , Lexer const& lex, ParserExpr const& xpr, Skipper const& skipper)
     {
-        typedef typename LexerExpr::iterator_type iterator_type;
-        typedef spirit::traits::is_component<qi::domain, ParserExpr> 
-            expr_is_component;
-        typedef spirit::traits::is_component<qi::domain, Skipper> 
-            skipper_is_component;
-
-        // report invalid expressions error as early as possible
-        BOOST_MPL_ASSERT_MSG(
-            expr_is_component::value,
-            xpr_is_not_convertible_to_a_parser, 
-            (iterator_type, ParserExpr, Skipper));
-
-        BOOST_MPL_ASSERT_MSG(
-            skipper_is_component::value,
-            skipper_is_not_convertible_to_a_parser, 
-            (iterator_type, ParserExpr, Skipper));
-
-        typedef typename 
-            result_of::as_component<qi::domain, ParserExpr>::type 
-        component;
-        typedef typename component::director director;
-        component c = spirit::as_component(qi::domain(), xpr);
-
-        typename result_of::as_component<qi::domain, Skipper>::type
-            skipper = spirit::as_component(qi::domain(), skipper_);
-
-        iterator_type iter = lex.begin(first, last);
-        if (!director::parse(c, iter, lex.end(), unused, skipper, unused))
+        // Report invalid expression error as early as possible.
+        // If you got an error_invalid_expression error message here,
+        // then the expression (expr) is not a valid spirit qi expression.
+        BOOST_SPIRIT_ASSERT_MATCH(qi::domain, ParserExpr)
+        BOOST_SPIRIT_ASSERT_MATCH(qi::domain, Skipper)
+
+        typedef
+            typename result_of::compile<qi::domain, Skipper>::type
+        skipper_type;
+        skipper_type const skipper_ = compile<qi::domain>(skipper);
+
+        typename Lexer::iterator_type iter = lex.begin(first, last);
+        if (!compile<qi::domain>(xpr).parse(
+                iter, lex.end(), unused, skipper_, unused))
             return false;
 
         // do a final post-skip
-        skip(iter, lex.end(), skipper);
+        qi::skip_over(iter, lex.end(), skipper_);
         return true;
     }
 
     ///////////////////////////////////////////////////////////////////////////
-    template <
-        typename Iterator, typename LexerExpr, typename ParserExpr, 
-        typename Attribute, typename Skipper
-    >
+    template <typename Iterator, typename Lexer, typename ParserExpr
+      , typename Skipper, typename Attribute>
     inline bool
-    tokenize_and_phrase_parse(Iterator& first, Iterator last, 
-        LexerExpr const& lex, ParserExpr const& xpr, Attribute& attr,
-        Skipper const& skipper_)
+    tokenize_and_phrase_parse(Iterator& first, Iterator last
+      , Lexer const& lex, ParserExpr const& xpr, Skipper const& skipper_
+      , Attribute& attr)
     {
-        typedef typename LexerExpr::iterator_type iterator_type;
-        typedef spirit::traits::is_component<qi::domain, ParserExpr> 
-            expr_is_component;
-        typedef spirit::traits::is_component<qi::domain, Skipper> 
-            skipper_is_component;
-
-        // report invalid expressions error as early as possible
-        BOOST_MPL_ASSERT_MSG(
-            expr_is_component::value,
-            xpr_is_not_convertible_to_a_parser, 
-            (iterator_type, ParserExpr, Skipper));
-
-        BOOST_MPL_ASSERT_MSG(
-            skipper_is_component::value,
-            skipper_is_not_convertible_to_a_parser, 
-            (iterator_type, ParserExpr, Skipper));
-
-        typedef typename 
-            result_of::as_component<qi::domain, ParserExpr>::type 
-        component;
-        typedef typename component::director director;
-        component c = spirit::as_component(qi::domain(), xpr);
-
-        typename result_of::as_component<qi::domain, Skipper>::type
-            skipper = spirit::as_component(qi::domain(), skipper_);
-
-        iterator_type iter = lex.begin(first, last);
-        if (!director::parse(c, iter, lex.end(), unused, skipper, attr))
+        // Report invalid expression error as early as possible.
+        // If you got an error_invalid_expression error message here,
+        // then the expression (expr) is not a valid spirit qi expression.
+        BOOST_SPIRIT_ASSERT_MATCH(qi::domain, ParserExpr)
+        BOOST_SPIRIT_ASSERT_MATCH(qi::domain, Skipper)
+
+        typedef
+            typename result_of::compile<qi::domain, Skipper>::type
+        skipper_type;
+        skipper_type const skipper_ = compile<qi::domain>(skipper);
+
+        typename Lexer::iterator_type iter = lex.begin(first, last);
+        if (!compile<qi::domain>(xpr).parse(
+                iter, lex.end(), unused, skipper_, attr))
             return false;
 
         // do a final post-skip
-        skip(iter, lex.end(), skipper);
+        qi::skip_over(iter, lex.end(), skipper_);
         return true;
     }
 
@@ -247,7 +193,7 @@
     //  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
     //  purpose is to use the lexer to tokenize all the input. 
-    
+
     //  The second version below discards all generated tokens afterwards. 
     //  This is useful whenever all the needed functionality has been 
     //  implemented directly inside the lexer semantic actions, which are being 
@@ -278,11 +224,11 @@
     //                  the tokenization should be canceled.
     //
     ///////////////////////////////////////////////////////////////////////////
-    template <typename Iterator, typename LexerExpr, typename F>
+    template <typename Iterator, typename Lexer, typename F>
     inline bool
-    tokenize(Iterator& first, Iterator last, LexerExpr const& lex, F f)
+    tokenize(Iterator& first, Iterator last, Lexer const& lex, F f)
     {
-        typedef typename LexerExpr::iterator_type iterator_type;
+        typedef typename Lexer::iterator_type iterator_type;
 
         iterator_type end = lex.end();
         for (iterator_type iter = lex.begin(first, last); iter != end; ++iter) 
@@ -294,18 +240,18 @@
     }
 
     ///////////////////////////////////////////////////////////////////////////
-    template <typename Iterator, typename LexerExpr>
+    template <typename Iterator, typename Lexer>
     inline bool
-    tokenize(Iterator& first, Iterator last, LexerExpr const& lex)
+    tokenize(Iterator& first, Iterator last, Lexer const& lex)
     {
-        typedef typename LexerExpr::iterator_type iterator_type;
+        typedef typename Lexer::iterator_type iterator_type;
 
         iterator_type iter = lex.begin(first, last);
         iterator_type end = lex.end();
 
         while (iter != end && token_is_valid(*iter))
             ++iter;
-            
+
         return (iter == end) ? true : false;
     }
 
Modified: trunk/boost/spirit/home/qi.hpp
==============================================================================
--- trunk/boost/spirit/home/qi.hpp	(original)
+++ trunk/boost/spirit/home/qi.hpp	2009-04-26 10:42:24 EDT (Sun, 26 Apr 2009)
@@ -1,5 +1,5 @@
 /*=============================================================================
-    Copyright (c) 2001-2007 Joel de Guzman
+    Copyright (c) 2001-2009 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)
@@ -7,16 +7,24 @@
 #if !defined(BOOST_SPIRIT_QI_MARCH_04_2007_0852PM)
 #define BOOST_SPIRIT_QI_MARCH_04_2007_0852PM
 
+#if defined(_MSC_VER)
+#pragma once
+#endif
+
+#include <boost/spirit/home/qi/action.hpp>
+#include <boost/spirit/home/qi/auxiliary.hpp>
 #include <boost/spirit/home/qi/char.hpp>
-#include <boost/spirit/home/qi/string.hpp>
+#include <boost/spirit/home/qi/binary.hpp>
+#include <boost/spirit/home/qi/directive.hpp>
+#include <boost/spirit/home/qi/nonterminal.hpp>
 #include <boost/spirit/home/qi/numeric.hpp>
 #include <boost/spirit/home/qi/operator.hpp>
-#include <boost/spirit/home/qi/auxiliary.hpp>
-#include <boost/spirit/home/qi/action.hpp>
-#include <boost/spirit/home/qi/nonterminal.hpp>
-#include <boost/spirit/home/qi/directive.hpp>
 #include <boost/spirit/home/qi/parse.hpp>
-#include <boost/spirit/home/qi/debug.hpp>
+#include <boost/spirit/home/qi/parse_attr.hpp>
+#include <boost/spirit/home/qi/parser.hpp>
+#include <boost/spirit/home/qi/skip_over.hpp>
+#include <boost/spirit/home/qi/string.hpp>
 #include <boost/spirit/home/qi/what.hpp>
+#include <boost/spirit/home/qi/stream.hpp>
 
 #endif
Modified: trunk/boost/spirit/home/qi/action.hpp
==============================================================================
--- trunk/boost/spirit/home/qi/action.hpp	(original)
+++ trunk/boost/spirit/home/qi/action.hpp	2009-04-26 10:42:24 EDT (Sun, 26 Apr 2009)
@@ -1,13 +1,16 @@
 /*=============================================================================
-    Copyright (c) 2001-2007 Joel de Guzman
+    Copyright (c) 2001-2009 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(SPIRIT_ACTION_JAN_07_2007_1233PM)
-#define SPIRIT_ACTION_JAN_07_2007_1233PM
+#if !defined(SPIRIT_ACTION_JANUARY_07_2007_1233PM)
+#define SPIRIT_ACTION_JANUARY_07_2007_1233PM
+
+#if defined(_MSC_VER)
+#pragma once
+#endif
 
 #include <boost/spirit/home/qi/action/action.hpp>
-#include <boost/spirit/home/qi/action/meta_grammar.hpp>
 
 #endif
Modified: trunk/boost/spirit/home/qi/action/action.hpp
==============================================================================
--- trunk/boost/spirit/home/qi/action/action.hpp	(original)
+++ trunk/boost/spirit/home/qi/action/action.hpp	2009-04-26 10:42:24 EDT (Sun, 26 Apr 2009)
@@ -1,96 +1,112 @@
 /*=============================================================================
-    Copyright (c) 2001-2007 Joel de Guzman
+    Copyright (c) 2001-2009 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(SPIRIT_ACTION_JAN_07_2007_1128AM)
-#define SPIRIT_ACTION_JAN_07_2007_1128AM
+#if !defined(SPIRIT_ACTION_JANUARY_07_2007_1128AM)
+#define SPIRIT_ACTION_JANUARY_07_2007_1128AM
+
+#if defined(_MSC_VER)
+#pragma once
+#endif
+
+#include <boost/spirit/home/qi/meta_compiler.hpp>
+#include <boost/spirit/home/qi/parser.hpp>
+#include <boost/spirit/home/support/attributes.hpp>
+#include <boost/spirit/home/support/argument.hpp>
+#include <boost/spirit/home/support/context.hpp>
+#include <boost/spirit/home/support/unused.hpp>
+#include <boost/spirit/home/support/info.hpp>
+#include <boost/spirit/home/support/action_dispatch.hpp>
 
-#include <boost/spirit/home/qi/domain.hpp>
-#include <boost/spirit/home/support/component.hpp>
-#include <boost/spirit/home/support/attribute_of.hpp>
-#include <boost/spirit/home/support/detail/action_dispatch.hpp>
 #include <boost/mpl/if.hpp>
-#include <boost/mpl/bool.hpp>
-#include <boost/mpl/identity.hpp>
 #include <boost/type_traits/remove_const.hpp>
 #include <boost/type_traits/is_same.hpp>
-#include <vector>
 
 namespace boost { namespace spirit { namespace qi
 {
-    struct action
+    BOOST_PP_REPEAT(SPIRIT_ARGUMENTS_LIMIT, SPIRIT_USING_ARGUMENT, _)
+
+    template <typename Subject, typename Action>
+    struct action : unary_parser<action<Subject, Action> >
     {
-        template <typename Component, typename Context, typename Iterator>
+        typedef Subject subject_type;
+        typedef Action action_type;
+
+        template <typename Context, typename Iterator>
         struct attribute
-          : traits::attribute_of<
-                qi::domain
-              , typename result_of::left<Component>::type
-              , Context
-              , Iterator
-            >
-        {
-        };
+          : traits::attribute_of<Subject, Context, Iterator>
+        {};
 
-        template <typename F, typename Attribute, typename Context>
-        static bool const_action_dispatch(
-            F const& f, Attribute const& attr, Context& context)
-        {
-            // This function makes Attribute a const reference
-            // before calling detail::action_dispatch whereby
-            // disallowing mutability of the attribute in semantic
-            // actions.
-            return spirit::detail::action_dispatch(f, attr, context, 
-                mpl::true_());
-        }
+        action(Subject const& subject, Action f)
+          : subject(subject), f(f) {}
 
-        template <
-            typename Component
-          , typename Iterator, typename Context
+        template <typename Iterator, typename Context
           , typename Skipper, typename Attribute>
-        static bool parse(
-            Component const& component
-          , Iterator& first, Iterator const& last
+        bool parse(Iterator& first, Iterator const& last
           , Context& context, Skipper const& skipper
-          , Attribute& attr_)
+          , Attribute& attr_) const
         {
-            typedef typename
-                result_of::left<Component>::type::director
-            director;
-
-            typedef typename
-                attribute<Component, Context, Iterator>::type
-            attr_type;
+            typedef typename attribute<Context, Iterator>::type attr_type;
+            typedef traits::make_attribute<attr_type, Attribute> make_attribute;
 
             // create an attribute if one is not supplied
-            typename mpl::if_<
-                is_same<typename remove_const<Attribute>::type, unused_type>
-              , typename remove_const<attr_type>::type
-              , Attribute&>::type
-            attr = spirit::detail::make_value<attr_type>::call(attr_);
+            typename make_attribute::type attr = make_attribute::call(attr_);
 
-            if (director::parse(
-                spirit::left(component), first, last, context, skipper, attr))
+            if (subject.parse(first, last, context, skipper, attr))
             {
                 // call the function, passing the attribute, the context.
                 // The client can return false to fail parsing.
-                return const_action_dispatch(
-                    spirit::right(component), attr, context);
+                return traits::action_dispatch<Subject>()(f, attr, context);
             }
             return false;
         }
 
-        template <typename Component, typename Context>
-        static std::string what(Component const& component, Context const& ctx)
+        template <typename Context>
+        info what(Context& context) const
+        {
+            // the action is transparent (does not add any info)
+            return subject.what(context);
+        }
+
+        Subject subject;
+        Action f;
+    };
+}}}
+
+namespace boost { namespace spirit
+{
+    // Qi action meta-compiler
+    template <>
+    struct make_component<qi::domain, tag::action>
+    {
+        template <typename Sig>
+        struct result;
+
+        template <typename This, typename Elements, typename Modifiers>
+        struct result<This(Elements, Modifiers)>
         {
             typedef typename
-                result_of::left<Component>::type::director
-            director;
+                remove_const<typename Elements::car_type>::type
+            subject_type;
 
-            return director::what(spirit::left(component), ctx);
+            typedef typename
+                remove_const<typename Elements::cdr_type::car_type>::type
+            action_type;
+
+            typedef qi::action<subject_type, action_type> type;
+        };
+
+        template <typename Elements>
+        typename result<make_component(Elements, unused_type)>::type
+        operator()(Elements const& elements, unused_type) const
+        {
+            typename result<make_component(Elements, unused_type)>::type
+                result(elements.car, elements.cdr.car);
+            return result;
         }
     };
-}}}
+}}
 
 #endif
Deleted: trunk/boost/spirit/home/qi/action/meta_grammar.hpp
==============================================================================
--- trunk/boost/spirit/home/qi/action/meta_grammar.hpp	2009-04-26 10:42:24 EDT (Sun, 26 Apr 2009)
+++ (empty file)
@@ -1,58 +0,0 @@
-/*=============================================================================
-    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_META_GRAMMAR_FEB_07_2007_1100AM)
-#define BOOST_SPIRIT_META_GRAMMAR_FEB_07_2007_1100AM
-
-#include <boost/spirit/home/qi/domain.hpp>
-#include <boost/spirit/home/support/meta_grammar.hpp>
-#include <boost/utility/enable_if.hpp>
-
-namespace boost { namespace spirit { namespace qi
-{
-    ///////////////////////////////////////////////////////////////////////////
-    // forwards
-    /////////////////////////////////////////////////////////////////////////// 
-    struct action;
-    struct main_meta_grammar;
-
-    template <typename Expr, typename Enable>
-    struct is_valid_expr;
-
-    template <typename Expr, typename Enable>
-    struct expr_transform;
-
-    ///////////////////////////////////////////////////////////////////////////
-    // action meta-grammar
-    ///////////////////////////////////////////////////////////////////////////
-    struct action_meta_grammar : 
-        meta_grammar::binary_rule<
-            qi::domain, proto::tag::subscript, action
-          , main_meta_grammar, proto::when<proto::_, proto::_child>
-        >
-    {
-    };
-
-    ///////////////////////////////////////////////////////////////////////////
-    //  These specializations non-intrusively hooks into the RD meta-grammar.
-    //  (see qi/meta_grammar.hpp)
-    ///////////////////////////////////////////////////////////////////////////
-    template <typename Expr>
-    struct is_valid_expr<Expr
-      , typename enable_if<proto::matches<Expr, action_meta_grammar> >::type>
-      : mpl::true_
-    {
-    };
-
-    template <typename Expr>
-    struct expr_transform<Expr
-      , typename enable_if<proto::matches<Expr, action_meta_grammar> >::type>
-      : mpl::identity<action_meta_grammar>
-    {
-    };
-}}}
-
-#endif
Modified: trunk/boost/spirit/home/qi/auxiliary.hpp
==============================================================================
--- trunk/boost/spirit/home/qi/auxiliary.hpp	(original)
+++ trunk/boost/spirit/home/qi/auxiliary.hpp	2009-04-26 10:42:24 EDT (Sun, 26 Apr 2009)
@@ -1,20 +1,20 @@
 /*=============================================================================
-    Copyright (c) 2001-2007 Joel de Guzman
+    Copyright (c) 2001-2009 Joel de Guzman
     Copyright (c) 2001-2009 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_AUXILIARY_FEB_03_2007_0355PM)
-#define BOOST_SPIRIT_STRING_FEB_03_2007_0355PM
+#if !defined(BOOST_SPIRIT_AUXILIARY_FEBRUARY_03_2007_0355PM)
+#define BOOST_SPIRIT_AUXILIARY_FEBRUARY_03_2007_0355PM
+
+#if defined(_MSC_VER)
+#pragma once
+#endif
 
-#include <boost/spirit/home/qi/auxiliary/none.hpp>
-#include <boost/spirit/home/qi/auxiliary/confix.hpp>
 #include <boost/spirit/home/qi/auxiliary/eps.hpp>
 #include <boost/spirit/home/qi/auxiliary/lazy.hpp>
-#include <boost/spirit/home/qi/auxiliary/functor.hpp>
-#include <boost/spirit/home/qi/auxiliary/functor_director.hpp>
-#include <boost/spirit/home/qi/auxiliary/primitives.hpp>
-#include <boost/spirit/home/qi/auxiliary/meta_grammar.hpp>
+#include <boost/spirit/home/qi/auxiliary/eol.hpp>
+#include <boost/spirit/home/qi/auxiliary/eoi.hpp>
 
 #endif
Deleted: trunk/boost/spirit/home/qi/auxiliary/confix.hpp
==============================================================================
--- trunk/boost/spirit/home/qi/auxiliary/confix.hpp	2009-04-26 10:42:24 EDT (Sun, 26 Apr 2009)
+++ (empty file)
@@ -1,127 +0,0 @@
-//  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_QI_CONFIX_AUG_26_2008_1012AM)
-#define BOOST_SPIRIT_QI_CONFIX_AUG_26_2008_1012AM
-
-#include <boost/spirit/home/qi/domain.hpp>
-#include <boost/spirit/home/qi/skip.hpp>
-#include <boost/spirit/home/support/component.hpp>
-#include <boost/spirit/home/support/attribute_of.hpp>
-#include <boost/spirit/home/support/unused.hpp>
-#include <boost/spirit/home/support/auxiliary/confix.hpp>
-
-///////////////////////////////////////////////////////////////////////////////
-namespace boost { namespace spirit { namespace qi
-{
-    ///////////////////////////////////////////////////////////////////////////
-    // the director for a confix() generated parser
-    struct confix_director
-    {
-        template <typename Component, typename Context, typename Iterator>
-        struct attribute
-        {
-            typedef typename
-                result_of::subject<Component>::type
-            subject_type;
-
-            typedef typename
-                traits::attribute_of<
-                    qi::domain, subject_type, Context, Iterator>::type
-            type;
-        };
-
-    private:
-        ///////////////////////////////////////////////////////////////////////
-        template <
-            typename Iterator, typename Context
-          , typename Skipper, typename Expr>
-        static void parse_helper(
-            Iterator& first, Iterator const& last
-          , Context& context, Skipper const& skipper, Expr const& e)
-        {
-            BOOST_MPL_ASSERT_MSG(
-                (spirit::traits::is_component<qi::domain, Expr>::value), 
-                expression_is_not_convertible_to_a_parser, (Context, Expr));
-
-            typedef 
-                typename result_of::as_component<qi::domain, Expr>::type 
-            expr;
-
-            expr eg = spirit::as_component(qi::domain(), e);
-            typedef typename expr::director director;
-            director::parse(eg, first, last, context, skipper, unused);
-        }
-
-        template <typename Context, typename Expr>
-        static std::string what_helper(Expr const& e, Context& ctx)
-        {
-            typedef 
-                typename result_of::as_component<qi::domain, Expr>::type 
-            expr;
-
-            expr eg = spirit::as_component(qi::domain(), e);
-            typedef typename expr::director director;
-            return director::what(eg, ctx);
-        }
-
-    public:
-        ///////////////////////////////////////////////////////////////////////
-        template <
-            typename Component
-          , typename Iterator, typename Context
-          , typename Skipper, typename Attribute>
-        static bool parse(
-            Component const& component
-          , Iterator& first, Iterator const& last
-          , Context& context, Skipper const& skipper
-          , Attribute& attr)
-        {
-            // parse the prefix
-            parse_helper(first, last, context, skipper, 
-                spirit::detail::confix_extractor::prefix(
-                    proto::child_c<0>(spirit::argument1(component))));
-
-            // generate the embedded items
-            typedef typename
-                spirit::result_of::subject<Component>::type::director
-            director;
-            bool result = director::parse(spirit::subject(component), 
-                first, last, context, skipper, attr);
-
-            // append the suffix 
-            parse_helper(first, last, context, skipper, 
-                spirit::detail::confix_extractor::suffix(
-                    proto::child_c<0>(spirit::argument1(component))));
-
-            return result;
-        }
-
-        template <typename Component, typename Context>
-        static std::string what(Component const& component, Context const& ctx)
-        {
-            std::string result = "confix(";
-
-            result += what_helper(spirit::detail::confix_extractor::prefix(
-                    proto::child_c<0>(spirit::argument1(component))), ctx);
-            result += ", ";
-
-            result += what_helper(spirit::detail::confix_extractor::suffix(
-                    proto::child_c<0>(spirit::argument1(component))), ctx);
-            result += ")[";
-
-            typedef typename
-                spirit::result_of::subject<Component>::type::director
-            director;
-            result += director::what(spirit::subject(component), ctx);
-            result += "]";
-
-            return result;
-        }
-    };
-
-}}}
-
-#endif
Added: trunk/boost/spirit/home/qi/auxiliary/eoi.hpp
==============================================================================
--- (empty file)
+++ trunk/boost/spirit/home/qi/auxiliary/eoi.hpp	2009-04-26 10:42:24 EDT (Sun, 26 Apr 2009)
@@ -0,0 +1,72 @@
+/*=============================================================================
+    Copyright (c) 2001-2009 Hartmut Kaiser
+    Copyright (c) 2001-2009 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_EOI_APRIL_18_2008_0751PM)
+#define BOOST_SPIRIT_EOI_APRIL_18_2008_0751PM
+
+#include <boost/mpl/bool.hpp>
+#include <boost/spirit/home/qi/domain.hpp>
+#include <boost/spirit/home/qi/parser.hpp>
+#include <boost/spirit/home/qi/meta_compiler.hpp>
+#include <boost/spirit/home/support/common_terminals.hpp>
+
+namespace boost { namespace spirit
+{
+    ///////////////////////////////////////////////////////////////////////////
+    // Enablers
+    ///////////////////////////////////////////////////////////////////////////
+    template <>
+    struct use_terminal<qi::domain, tag::eoi>       // enables eoi
+      : mpl::true_ {};
+}}
+
+namespace boost { namespace spirit { namespace qi
+{
+    using spirit::eoi;
+
+    struct eoi_parser : primitive_parser<eoi_parser>
+    {
+        template <typename Context, typename Iterator>
+        struct attribute
+        {
+            typedef unused_type type;
+        };
+
+        template <typename Iterator, typename Context
+          , typename Skipper, typename Attribute>
+        bool parse(Iterator& first, Iterator const& last
+          , Context& context, Skipper const& skipper
+          , Attribute& attr) const
+        {
+            qi::skip_over(first, last, skipper);
+            return first == last;
+        }
+
+        template <typename Context>
+        info what(Context& context) const
+        {
+            return info("eoi");
+        }
+    };
+
+    ///////////////////////////////////////////////////////////////////////////
+    // Parser generators: make_xxx function (objects)
+    ///////////////////////////////////////////////////////////////////////////
+    template <typename Modifiers>
+    struct make_primitive<tag::eoi, Modifiers>
+    {
+        typedef eoi_parser result_type;
+        result_type operator()(unused_type, unused_type) const
+        {
+            return result_type();
+        }
+    };
+}}}
+
+#endif
+
+
Added: trunk/boost/spirit/home/qi/auxiliary/eol.hpp
==============================================================================
--- (empty file)
+++ trunk/boost/spirit/home/qi/auxiliary/eol.hpp	2009-04-26 10:42:24 EDT (Sun, 26 Apr 2009)
@@ -0,0 +1,90 @@
+/*=============================================================================
+    Copyright (c) 2001-2009 Hartmut Kaiser
+    Copyright (c) 2001-2009 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_EOL_APRIL_18_2008_0751PM)
+#define BOOST_SPIRIT_EOL_APRIL_18_2008_0751PM
+
+#include <boost/mpl/bool.hpp>
+#include <boost/spirit/home/qi/domain.hpp>
+#include <boost/spirit/home/qi/parser.hpp>
+#include <boost/spirit/home/qi/meta_compiler.hpp>
+#include <boost/spirit/home/support/common_terminals.hpp>
+
+namespace boost { namespace spirit
+{
+    ///////////////////////////////////////////////////////////////////////////
+    // Enablers
+    ///////////////////////////////////////////////////////////////////////////
+    template <>
+    struct use_terminal<qi::domain, tag::eol>       // enables eol
+      : mpl::true_ {};
+}}
+
+namespace boost { namespace spirit { namespace qi
+{
+    using spirit::eol;
+
+    struct eol_parser : primitive_parser<eol_parser>
+    {
+        template <typename Context, typename Iterator>
+        struct attribute
+        {
+            typedef unused_type type;
+        };
+
+        template <typename Iterator, typename Context
+          , typename Skipper, typename Attribute>
+        bool parse(Iterator& first, Iterator const& last
+          , Context& context, Skipper const& skipper
+          , Attribute& attr) const
+        {
+            qi::skip_over(first, last, skipper);
+
+            Iterator it = first;
+            bool matched = false;
+            if (it != last && *it == '\r')  // CR
+            {
+                matched = true;
+                ++it;
+            }
+            if (it != last && *it == '\n')  // LF
+            {
+                matched = true;
+                ++it;
+            }
+
+            if (!matched)
+                return false;
+
+            first = it;
+            return true;
+        }
+
+        template <typename Context>
+        info what(Context& context) const
+        {
+            return info("eol");
+        }
+    };
+
+    ///////////////////////////////////////////////////////////////////////////
+    // Parser generators: make_xxx function (objects)
+    ///////////////////////////////////////////////////////////////////////////
+    template <typename Modifiers>
+    struct make_primitive<tag::eol, Modifiers>
+    {
+        typedef eol_parser result_type;
+        result_type operator()(unused_type, unused_type) const
+        {
+            return result_type();
+        }
+    };
+}}}
+
+#endif
+
+
Modified: trunk/boost/spirit/home/qi/auxiliary/eps.hpp
==============================================================================
--- trunk/boost/spirit/home/qi/auxiliary/eps.hpp	(original)
+++ trunk/boost/spirit/home/qi/auxiliary/eps.hpp	2009-04-26 10:42:24 EDT (Sun, 26 Apr 2009)
@@ -1,5 +1,5 @@
 /*=============================================================================
-    Copyright (c) 2001-2007 Joel de Guzman
+    Copyright (c) 2001-2009 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)
@@ -8,67 +8,117 @@
 #define BOOST_SPIRIT_EPS_MARCH_23_2007_0454PM
 
 #include <boost/spirit/home/qi/domain.hpp>
-#include <boost/spirit/home/qi/skip.hpp>
+#include <boost/spirit/home/qi/skip_over.hpp>
+#include <boost/spirit/home/qi/meta_compiler.hpp>
 #include <boost/spirit/home/support/unused.hpp>
+#include <boost/spirit/home/support/info.hpp>
+#include <boost/spirit/home/support/common_terminals.hpp>
 #include <boost/fusion/include/at.hpp>
+#include <boost/type_traits/is_convertible.hpp>
+
+namespace boost { namespace spirit
+{
+    ///////////////////////////////////////////////////////////////////////////
+    // Enablers
+    ///////////////////////////////////////////////////////////////////////////
+    template <>
+    struct use_terminal<qi::domain, tag::eps>       // enables eps
+      : mpl::true_ {};
+
+    template <typename A0>
+    struct use_terminal<qi::domain
+      , terminal_ex<tag::eps, fusion::vector1<A0> > // enables eps(bool-condition)
+    > : is_convertible<A0, bool> {};
+
+    template <>                                     // enables eps(f)
+    struct use_lazy_terminal<
+        qi::domain, tag::eps, 1 /*arity*/
+    > : mpl::true_ {};
+}}
 
 namespace boost { namespace spirit { namespace qi
 {
-    struct eps_parser
+    using spirit::eps;
+    using spirit::eps_type;
+
+    struct eps_parser : primitive_parser<eps_parser>
     {
-        template <typename Component, typename Context, typename Iterator>
+        template <typename Context, typename Iterator>
         struct attribute
         {
             typedef unused_type type;
         };
 
-        template <
-            typename Component
-          , typename Iterator, typename Context
+        template <typename Iterator, typename Context
           , typename Skipper, typename Attribute>
-        static bool parse(
-            Component const& /*component*/
-          , Iterator& first, Iterator const& last
-          , Context& /*context*/, Skipper const& skipper
-          , Attribute& /*attr*/)
+        bool parse(Iterator& first, Iterator const& last
+          , Context& context, Skipper const& skipper
+          , Attribute& attr) const
         {
-            qi::skip(first, last, skipper);
+            qi::skip_over(first, last, skipper);
             return true;
         }
 
-        template <typename Component, typename Context>
-        static std::string what(Component const& component, Context const& ctx)
+        template <typename Context>
+        info what(Context& context) const
         {
-            return "eps";
+            return info("eps");
         }
     };
 
-    struct semantic_predicate
+    struct semantic_predicate : primitive_parser<semantic_predicate>
     {
-        template <typename Component, typename Context, typename Iterator>
+        template <typename Context, typename Iterator>
         struct attribute
         {
             typedef unused_type type;
         };
 
-        template <
-            typename Component
-          , typename Iterator, typename Context
+        semantic_predicate(bool predicate)
+          : predicate(predicate) {}
+
+        template <typename Iterator, typename Context
           , typename Skipper, typename Attribute>
-        static bool parse(
-            Component const& component
-          , Iterator& first, Iterator const& last
+        bool parse(Iterator& first, Iterator const& last
           , Context& context, Skipper const& skipper
-          , Attribute& /*attr*/)
+          , Attribute& attr) const
+        {
+            qi::skip_over(first, last, skipper);
+            return predicate;
+        }
+
+        template <typename Context>
+        info what(Context& context) const
         {
-            qi::skip(first, last, skipper);
-            return fusion::at_c<0>(component.elements)(unused, context);
+            return info("semantic-predicate");
         }
 
-        template <typename Component, typename Context>
-        static std::string what(Component const& component, Context const& ctx)
+        bool predicate;
+    };
+
+    ///////////////////////////////////////////////////////////////////////////
+    // Parser generators: make_xxx function (objects)
+    ///////////////////////////////////////////////////////////////////////////
+    template <typename Modifiers>
+    struct make_primitive<tag::eps, Modifiers>
+    {
+        typedef eps_parser result_type;
+        result_type operator()(unused_type, unused_type) const
+        {
+            return result_type();
+        }
+    };
+
+    template <typename Modifiers, typename A0>
+    struct make_primitive<
+        terminal_ex<tag::eps, fusion::vector1<A0> >
+      , Modifiers>
+    {
+        typedef semantic_predicate result_type;
+        template <typename Terminal>
+        result_type operator()(Terminal const& term, unused_type) const
         {
-            return "semantic-predicate";
+            return result_type(fusion::at_c<0>(term.args) ? true : false);
         }
     };
 }}}
Deleted: trunk/boost/spirit/home/qi/auxiliary/functor.hpp
==============================================================================
--- trunk/boost/spirit/home/qi/auxiliary/functor.hpp	2009-04-26 10:42:24 EDT (Sun, 26 Apr 2009)
+++ (empty file)
@@ -1,210 +0,0 @@
-//  Copyright (c) 2001-2009 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_FUNCTOR_APR_01_2007_0817AM)
-#define BOOST_SPIRIT_FUNCTOR_APR_01_2007_0817AM
-
-#if defined(_MSC_VER) && (_MSC_VER >= 1020)
-#pragma once      // MS compatible compilers support #pragma once
-#endif
-
-#include <boost/spirit/home/support/component.hpp>
-#include <boost/spirit/home/support/unused.hpp>
-#include <boost/spirit/home/support/detail/values.hpp>
-#include <boost/spirit/home/support/auxiliary/functor_holder.hpp>
-#include <boost/spirit/home/support/auxiliary/meta_function_holder.hpp>
-#include <boost/spirit/home/qi/skip.hpp>
-#include <boost/mpl/if.hpp>
-#include <boost/type_traits/is_same.hpp>
-#include <boost/type_traits/remove_const.hpp>
-
-///////////////////////////////////////////////////////////////////////////////
-namespace boost { namespace spirit 
-{ 
-    namespace qi
-    {
-        template <typename Functor, typename ParameterMF = Functor>
-        class functor_parser;
-    }
-    
-    namespace result_of
-    {
-        template <typename Functor>
-        struct as_parser
-        {
-            typedef qi::functor_parser<Functor> type;
-        };
-
-        template <typename ParameterMF, typename Functor>
-        struct as_parser_mf
-        {
-            typedef qi::functor_parser<Functor, ParameterMF> type;
-        };
-    }
-        
-}}  // boost::spirit
-
-///////////////////////////////////////////////////////////////////////////////
-namespace boost { namespace spirit { namespace qi
-{
-    ///////////////////////////////////////////////////////////////////////////
-    //  This struct may be used as a base class for a user defined functor
-    ///////////////////////////////////////////////////////////////////////////
-    struct functor_base
-    {
-        ///////////////////////////////////////////////////////////////////////
-        //  The return value of a qi functor is always bool
-        ///////////////////////////////////////////////////////////////////////
-        template <typename Attribute, typename Iterator, typename Context>
-        struct result
-        {
-            typedef bool type;
-        };
-
-// FIXME: It will be possible to specify the return value as a typedef, but for 
-//        that Phoenix will have to be fixed.
-//         typedef bool result_type;
-        
-        ///////////////////////////////////////////////////////////////////////
-        //  The expected parameter type of a functor has to be defined using a
-        //  embedded apply metafunction. Normally this will be overloaded by 
-        //  the derived class, but the default is unused type.
-        ///////////////////////////////////////////////////////////////////////
-        template <typename Iterator, typename Context>
-        struct apply
-        {
-            typedef spirit::unused_type type;
-        };
-    };
-
-    ///////////////////////////////////////////////////////////////////////////
-    template <typename Functor, typename ParameterMF>
-    class functor_parser
-      : public proto::extends<
-            typename make_functor_holder<
-                functor_parser<Functor, ParameterMF> const*, 
-                functor_parser<Functor, ParameterMF>
-            >::type,
-            functor_parser<Functor, ParameterMF>
-        >
-    {
-    private:
-        typedef functor_parser<Functor, ParameterMF> self_type;
-        typedef typename
-            make_functor_holder<self_type const*, self_type>::type
-        functor_tag;
-        typedef proto::extends<functor_tag, self_type> base_type;
-
-    public:
-        template <typename Iterator, typename Context>
-        struct result 
-          : mpl::apply<ParameterMF, Iterator, Context>
-        {};
-
-    private:
-        // parse function just delegates to the functor supplied function
-        template <typename Iterator, typename Context, typename Attribute>
-        bool
-        parse (Iterator& first, Iterator const& last, Context& ctx,
-            Attribute& attr_) const
-        {
-            // create an attribute if none is supplied
-            typedef typename result<Iterator, Context>::type attr_type;
-            typename mpl::if_<
-                is_same<typename remove_const<Attribute>::type, unused_type>,
-                attr_type,
-                Attribute&
-            >::type
-            attr = spirit::detail::make_value<attr_type>::call(attr_);
-
-            return functor(attr, ctx, first, last);
-        }
-
-        friend struct functor_director;
-
-    public:
-        explicit functor_parser()
-          : base_type(make_tag())
-        {
-        }
-
-        functor_parser(Functor const& functor_)
-          : base_type(make_tag()), functor(functor_)
-        {
-        }
-
-        functor_parser(Functor const& functor_, ParameterMF const& mf)
-          : base_type(make_tag()), functor(functor_), mf_(mf)
-        {
-        }
-
-    private:
-        functor_tag make_tag() const
-        {
-            functor_tag xpr = {{ this }};
-            return xpr;
-        }
-        
-        Functor functor;
-        meta_function_holder<Functor, ParameterMF> mf_;
-    };
-
-    ///////////////////////////////////////////////////////////////////////////
-    //  The as_parser generator function may be used to create a functor 
-    //  parser from a function object (some callable item).
-    //  The supplied functor needs to expose
-    // 
-    //    - an embedded result meta function: 
-    //
-    //          template <typename Attribute, typename Iterator, typename Context>
-    //          struct result
-    //          {
-    //              typedef bool type;
-    //          };
-    //
-    //      which declares 'bool' as the result type of the defined function
-    //      operator and
-    //
-    //    - an embedded apply meta function:
-    //
-    //          template <typename Iterator, typename Context>
-    //          struct apply
-    //          {
-    //              typedef unspecified type;
-    //          };
-    //
-    //      which declares the given type as the expected attribute type for 
-    //      the parser to create.
-    ///////////////////////////////////////////////////////////////////////////
-    template <typename Functor>
-    inline typename result_of::as_parser<Functor>::type
-    as_parser(Functor const& func)
-    {
-        return functor_parser<Functor>(func);
-    }
-    
-    ///////////////////////////////////////////////////////////////////////////
-    //  The as_parser_mf generator function is equivalent to the function
-    //  as_parser above except that the user has to explicitly specify a
-    //  type exposing an embedded apply meta function declaring the expected
-    //  parameter type for the generator to create.
-    ///////////////////////////////////////////////////////////////////////////
-    template <typename ParameterMF, typename Functor>
-    inline typename result_of::as_parser_mf<ParameterMF, Functor>::type
-    as_parser_mf(Functor const& func, ParameterMF const& mf)
-    {
-        return functor_parser<Functor, ParameterMF>(func, mf);
-    }
-    
-    template <typename ParameterMF, typename Functor>
-    inline typename result_of::as_parser_mf<ParameterMF, Functor>::type
-    as_parser_mf(Functor const& func)
-    {
-        return functor_parser<Functor, ParameterMF>(func, ParameterMF());
-    }
-    
-}}}
-
-#endif
Deleted: trunk/boost/spirit/home/qi/auxiliary/functor_director.hpp
==============================================================================
--- trunk/boost/spirit/home/qi/auxiliary/functor_director.hpp	2009-04-26 10:42:24 EDT (Sun, 26 Apr 2009)
+++ (empty file)
@@ -1,52 +0,0 @@
-//  Copyright (c) 2001-2009 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_FUNCTOR_DIRECTOR_APR_01_2007_0847AM)
-#define BOOST_SPIRIT_FUNCTOR_DIRECTOR_APR_01_2007_0847AM
-
-#include <boost/spirit/home/support/auxiliary/functor_holder.hpp>
-#include <boost/spirit/home/support/component.hpp>
-#include <boost/spirit/home/qi/domain.hpp>
-
-namespace boost { namespace spirit { namespace qi
-{
-    // this is the director for all functor parsers
-    struct functor_director
-    {
-        // return value of the parser
-        template <typename Component, typename Context, typename Iterator>
-        struct attribute
-        {
-            typedef typename
-                result_of::subject<Component>::type::functor_type
-            functor_type;
-
-            typedef typename
-                functor_type::template result<Iterator, Context>::type
-            type;
-        };
-
-        // parse functionality, delegates back to the corresponding functor
-        template <typename Component, typename Iterator, typename Context,
-            typename Skipper, typename Attribute>
-        static bool parse(Component const& component,
-            Iterator& first, Iterator const& last, Context& context,
-            Skipper const& skipper, Attribute& attr)
-        {
-            // main entry point, just forward to the functor parse function
-            qi::skip(first, last, skipper);         // always do a pre-skip
-            return subject(component).held->parse(first, last, context, attr);
-        }
-
-        template <typename Component, typename Context>
-        static std::string what(Component const& component, Context const& ctx)
-        {
-            return "functor";
-        }
-    };
-
-}}}
-
-#endif
Modified: trunk/boost/spirit/home/qi/auxiliary/lazy.hpp
==============================================================================
--- trunk/boost/spirit/home/qi/auxiliary/lazy.hpp	(original)
+++ trunk/boost/spirit/home/qi/auxiliary/lazy.hpp	2009-04-26 10:42:24 EDT (Sun, 26 Apr 2009)
@@ -1,5 +1,5 @@
 /*=============================================================================
-    Copyright (c) 2001-2007 Joel de Guzman
+    Copyright (c) 2001-2009 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)
@@ -7,98 +7,196 @@
 #if !defined(BOOST_SPIRIT_LAZY_MARCH_27_2007_1002AM)
 #define BOOST_SPIRIT_LAZY_MARCH_27_2007_1002AM
 
+#if defined(_MSC_VER)
+#pragma once
+#endif
+
 #include <boost/spirit/home/qi/domain.hpp>
-#include <boost/spirit/home/qi/skip.hpp>
-#include <boost/spirit/home/support/attribute_of.hpp>
+#include <boost/spirit/home/qi/skip_over.hpp>
+#include <boost/spirit/home/qi/meta_compiler.hpp>
+#include <boost/spirit/home/support/attributes.hpp>
 #include <boost/spirit/home/support/unused.hpp>
+#include <boost/spirit/home/support/info.hpp>
+#include <boost/spirit/home/support/lazy.hpp>
+#include <boost/spirit/home/phoenix/core/actor.hpp>
 #include <boost/fusion/include/at.hpp>
 #include <boost/utility/result_of.hpp>
 #include <boost/type_traits/remove_reference.hpp>
+#include <boost/mpl/not.hpp>
+
+namespace boost { namespace spirit
+{
+    ///////////////////////////////////////////////////////////////////////////
+    // Enablers
+    ///////////////////////////////////////////////////////////////////////////
+    template <typename Eval>
+    struct use_terminal<qi::domain, phoenix::actor<Eval> >  // enables phoenix actors
+        : mpl::true_ {};
+
+    // forward declaration
+    template <typename Terminal, typename Actor, int Arity>
+    struct lazy_terminal;
+}}
 
 namespace boost { namespace spirit { namespace qi
 {
-    struct lazy_parser
+    using spirit::lazy;
+
+    template <typename Function>
+    struct lazy_parser : parser<lazy_parser<Function> >
     {
-        template <typename Component, typename Context, typename Iterator>
+        template <typename Context, typename Iterator>
         struct attribute
         {
             typedef typename
-                result_of::subject<Component>::type
-            subject_type;
-
-            typedef typename
                 remove_reference<
-                    typename boost::result_of<subject_type(unused_type, Context)>::type
+                    typename boost::result_of<Function(unused_type, Context)>::type
                 >::type
             expr_type;
 
+            // If you got an error_invalid_expression error message here,
+            // then the expression (expr_type) is not a valid spirit qi
+            // expression.
+            BOOST_SPIRIT_ASSERT_MATCH(qi::domain, expr_type)
+
             typedef typename
-                result_of::as_component<qi::domain, expr_type>::type
-            component_type;
+                result_of::compile<qi::domain, expr_type, tag::lazy_eval>::type
+            parser_type;
 
             typedef typename
-                traits::attribute_of<
-                    qi::domain, component_type, Context, Iterator>::type
+                traits::attribute_of<parser_type, Context, Iterator>::type
             type;
         };
 
-        template <
-            typename Component
-          , typename Iterator, typename Context
+        lazy_parser(Function const& function)
+          : function(function) {}
+
+        template <typename Iterator, typename Context
           , typename Skipper, typename Attribute>
-        static bool parse(
-            Component const& component
-          , Iterator& first, Iterator const& last
+        bool parse(Iterator& first, Iterator const& last
           , Context& context, Skipper const& skipper
-          , Attribute& attr)
+          , Attribute& attr) const
         {
-            typedef typename
-                result_of::subject<Component>::type
-            subject_type;
+            return compile<qi::domain>(function(unused, context), tag::lazy_eval())
+                .parse(first, last, context, skipper, attr);
+        }
+
+        template <typename Context>
+        info what(Context& context) const
+        {
+            return info("lazy"
+              , compile<qi::domain>(function(unused, context), tag::lazy_eval())
+                    .what(context)
+            );
+        }
+
+        Function function;
+    };
+
 
+    template <typename Function, typename Subject>
+    struct lazy_directive : unary_parser<lazy_directive<Function, Subject> >
+    {
+        typedef Subject subject_type;
+
+        template <typename Context, typename Iterator>
+        struct attribute
+        {
             typedef typename
                 remove_reference<
-                    typename boost::result_of<subject_type(unused_type, Context)>::type
+                    typename boost::result_of<Function(unused_type, Context)>::type
+                >::type
+            directive_expr_type;
+
+            typedef typename
+                proto::result_of::make_expr<
+                    proto::tag::subscript
+                  , directive_expr_type
+                  , Subject
                 >::type
             expr_type;
 
+            // If you got an error_invalid_expression error message here,
+            // then the expression (expr_type) is not a valid spirit qi
+            // expression.
+            BOOST_SPIRIT_ASSERT_MATCH(qi::domain, expr_type)
+
+            typedef typename
+                result_of::compile<qi::domain, expr_type, tag::lazy_eval>::type
+            parser_type;
+
             typedef typename
-                result_of::as_component<qi::domain, expr_type>::type
-            component_type;
+                traits::attribute_of<parser_type, Context, Iterator>::type
+            type;
+        };
+
+        lazy_directive(Function const& function, Subject const& subject)
+          : function(function), subject(subject) {}
+
+        template <typename Iterator, typename Context
+          , typename Skipper, typename Attribute>
+        bool parse(Iterator& first, Iterator const& last
+          , Context& context, Skipper const& skipper
+          , Attribute& attr) const
+        {
+            return compile<qi::domain>(
+                proto::make_expr<proto::tag::subscript>(
+                    function(unused, context)
+                  , subject
+                ), tag::lazy_eval())
+                .parse(first, last, context, skipper, attr);
+        }
+
+        template <typename Context>
+        info what(Context& context) const
+        {
+            return info("lazy-directive"
+              , compile<qi::domain>(
+                    proto::make_expr<proto::tag::subscript>(
+                        function(unused, context)
+                      , subject
+                    ), tag::lazy_eval())
+                    .what(context)
+            );
+        }
+
+        Function function;
+        Subject subject;
+    };
 
-            component_type subject
-                = spirit::as_component(
-                    qi::domain(), fusion::at_c<0>(component.elements)(unused, context));
-
-            return component_type::director::
-                parse(subject, first, last, context, skipper, attr);
-        }
-
-        template <typename Component, typename Context>
-        static std::string what(Component const& component, Context const& ctx)
-        {
-            //~ typedef typename
-                //~ result_of::subject<Component>::type
-            //~ subject_type;
-
-            //~ typedef typename
-                //~ remove_reference<
-                    //~ typename boost::result_of<subject_type(unused_type, unused_type)>::type
-                //~ >::type
-            //~ expr_type;
-
-            //~ typedef typename
-                //~ result_of::as_component<qi::domain, expr_type>::type
-            //~ component_type;
-
-            //~ component_type subject
-                //~ = spirit::as_component(
-                    //~ qi::domain(), fusion::at_c<0>(component.elements)(unused, unused));
-
-            std::string result = "lazy[";
-            //~ result += component_type::director::what(subject, ctx);
-            result += "]";
-            return result;
+    ///////////////////////////////////////////////////////////////////////////
+    // Parser generators: make_xxx function (objects)
+    ///////////////////////////////////////////////////////////////////////////
+    template <typename Eval, typename Modifiers>
+    struct make_primitive<phoenix::actor<Eval>, Modifiers>
+    {
+        typedef lazy_parser<phoenix::actor<Eval> > result_type;
+        result_type operator()(phoenix::actor<Eval> const& f, unused_type) const
+        {
+            return result_type(f);
+        }
+    };
+
+    template <typename Terminal, typename Actor, int Arity, typename Modifiers>
+    struct make_primitive<lazy_terminal<Terminal, Actor, Arity>, Modifiers>
+    {
+        typedef lazy_parser<Actor> result_type;
+        result_type operator()(
+            lazy_terminal<Terminal, Actor, Arity> const& lt, unused_type) const
+        {
+            return result_type(lt.actor);
+        }
+    };
+
+    template <typename Terminal, typename Actor, int Arity, typename Subject, typename Modifiers>
+    struct make_directive<lazy_terminal<Terminal, Actor, Arity>, Subject, Modifiers>
+    {
+        typedef lazy_directive<Actor, Subject> result_type;
+        result_type operator()(
+            lazy_terminal<Terminal, Actor, Arity> const& lt
+          , Subject const& subject, unused_type) const
+        {
+            return result_type(lt.actor, subject);
         }
     };
 }}}
Deleted: trunk/boost/spirit/home/qi/auxiliary/meta_grammar.hpp
==============================================================================
--- trunk/boost/spirit/home/qi/auxiliary/meta_grammar.hpp	2009-04-26 10:42:24 EDT (Sun, 26 Apr 2009)
+++ (empty file)
@@ -1,134 +0,0 @@
-/*=============================================================================
-    Copyright (c) 2001-2007 Joel de Guzman
-    Copyright (c) 2001-2009 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_META_GRAMMAR_MARCH_23_2007_0537PM)
-#define BOOST_SPIRIT_META_GRAMMAR_MARCH_23_2007_0537PM
-
-#include <boost/spirit/home/qi/domain.hpp>
-#include <boost/spirit/home/support/placeholders.hpp>
-#include <boost/spirit/home/support/meta_grammar.hpp>
-#include <boost/utility/enable_if.hpp>
-
-namespace boost { namespace spirit
-{
-    template <typename T, typename Functor>
-    struct functor_holder;
-}}
-
-namespace boost { namespace spirit { namespace qi
-{
-    ///////////////////////////////////////////////////////////////////////////
-    // forwards
-    ///////////////////////////////////////////////////////////////////////////
-    struct main_meta_grammar;
-
-    struct none;
-    struct eps_parser;
-    struct semantic_predicate;
-    struct lazy_parser;
-    struct functor_director;
-    struct confix_director;
-
-    struct eol_director;
-    struct eoi_director;
-
-    template <typename Positive>
-    struct negated_end_director;
-
-    ///////////////////////////////////////////////////////////////////////////
-    template <typename Expr, typename Enable>
-    struct is_valid_expr;
-
-    template <typename Expr, typename Enable>
-    struct expr_transform;
-
-    ///////////////////////////////////////////////////////////////////////////
-    // auxiliary parsers meta-grammar
-    ///////////////////////////////////////////////////////////////////////////
-
-    // none, eps and eps(f)
-    struct auxiliary_meta_grammar1
-      : proto::or_<
-        // none
-            meta_grammar::empty_terminal_rule<
-                qi::domain, tag::none, none>
-        // eps
-          , meta_grammar::empty_terminal_rule<
-                qi::domain, tag::eps, eps_parser>
-        // eps()
-          , meta_grammar::function1_rule<
-                qi::domain, tag::eps, semantic_predicate>
-        // lazy()
-          , meta_grammar::function1_rule<
-                qi::domain, tag::lazy, lazy_parser>
-        // functor parser
-          , meta_grammar::terminal_rule<
-                qi::domain
-              , functor_holder<proto::_, proto::_>
-              , functor_director
-            >
-        // confix(..., ...)[...]
-          , meta_grammar::subscript_rule<
-                qi::domain, tag::confix_tag<proto::_, proto::_>, 
-                confix_director, main_meta_grammar
-            >
-        >
-    {
-    };
-
-    // eol, eoi
-    struct auxiliary_end_meta_grammar
-      : proto::or_<
-            meta_grammar::terminal_rule<qi::domain, tag::eol, eol_director>
-          , meta_grammar::terminal_rule<qi::domain, tag::eoi, eoi_director>
-        >
-    {
-    };
-
-    struct negated_auxiliary_end_meta_grammar
-      : proto::or_<
-            auxiliary_end_meta_grammar
-          , meta_grammar::compose_single<
-                proto::unary_expr<
-                    proto::tag::complement
-                  , negated_auxiliary_end_meta_grammar
-                >
-              , qi::domain
-              , negated_end_director<mpl::_>
-            >
-        >
-    {
-    };
-
-    struct auxiliary_meta_grammar
-      : proto::or_<
-            auxiliary_meta_grammar1
-          , negated_auxiliary_end_meta_grammar
-        >
-    {
-    };
-
-    ///////////////////////////////////////////////////////////////////////////
-    //  These specializations non-intrusively hooks into the RD meta-grammar.
-    //  (see qi/meta_grammar.hpp)
-    ///////////////////////////////////////////////////////////////////////////
-    template <typename Expr>
-    struct is_valid_expr<Expr
-      , typename enable_if<proto::matches<Expr, auxiliary_meta_grammar> >::type>
-      : mpl::true_
-    {
-    };
-
-    template <typename Expr>
-    struct expr_transform<Expr
-      , typename enable_if<proto::matches<Expr, auxiliary_meta_grammar> >::type>
-      : mpl::identity<auxiliary_meta_grammar>
-    {
-    };
-}}}
-
-#endif
Deleted: trunk/boost/spirit/home/qi/auxiliary/none.hpp
==============================================================================
--- trunk/boost/spirit/home/qi/auxiliary/none.hpp	2009-04-26 10:42:24 EDT (Sun, 26 Apr 2009)
+++ (empty file)
@@ -1,46 +0,0 @@
-/*=============================================================================
-    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_NONE_MARCH_23_2007_0454PM)
-#define BOOST_SPIRIT_NONE_MARCH_23_2007_0454PM
-
-#include <boost/spirit/home/qi/domain.hpp>
-#include <boost/spirit/home/qi/skip.hpp>
-#include <boost/spirit/home/support/unused.hpp>
-
-namespace boost { namespace spirit { namespace qi
-{
-    struct none
-    {
-        template <typename Component, typename Context, typename Iterator>
-        struct attribute
-        {
-            typedef unused_type type;
-        };
-
-        template <
-            typename Component
-          , typename Iterator, typename Context
-          , typename Skipper, typename Attribute>
-        static bool parse(
-            Component const& /*component*/
-          , Iterator& first, Iterator const& last
-          , Context& /*context*/, Skipper const& skipper
-          , Attribute& /*attr*/)
-        {
-            qi::skip(first, last, skipper);
-            return false;
-        }
-
-        template <typename Component, typename Context>
-        static std::string what(Component const& component, Context const& ctx)
-        {
-            return "none";
-        }
-    };
-}}}
-
-#endif
Deleted: trunk/boost/spirit/home/qi/auxiliary/primitives.hpp
==============================================================================
--- trunk/boost/spirit/home/qi/auxiliary/primitives.hpp	2009-04-26 10:42:24 EDT (Sun, 26 Apr 2009)
+++ (empty file)
@@ -1,165 +0,0 @@
-/*=============================================================================
-    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_PRIMITIVES_APR_18_2008_0751PM)
-#define BOOST_SPIRIT_PRIMITIVES_APR_18_2008_0751PM
-
-#include <boost/mpl/bool.hpp>
-
-///////////////////////////////////////////////////////////////////////////////
-namespace boost { namespace spirit { namespace qi
-{
-    ///////////////////////////////////////////////////////////////////////////
-    //  the end_director_base is a base class for various end parsers
-    ///////////////////////////////////////////////////////////////////////////
-    template <typename Parser, typename StoreIterator = mpl::false_>
-    struct end_director_base
-    {
-        typedef mpl::false_ stores_iterator;
-
-        template <typename Component, typename Context, typename Iterator>
-        struct attribute
-        {
-            typedef unused_type type;
-        };
-
-        template <
-            typename Component
-          , typename Iterator, typename Context
-          , typename Skipper, typename Attribute>
-        static bool parse(
-            Component const& /*component*/
-          , Iterator& first, Iterator const& last
-          , Context& /*context*/, Skipper const& skipper
-          , Attribute& /*attr*/)
-        {
-            qi::skip(first, last, skipper);
-            return Parser::test(first, last);
-        }
-
-        // subclasses are required to implement test:
-
-        template <typename Iterator>
-        bool test(Iterator& first, Iterator const& last);
-    };
-
-    ///////////////////////////////////////////////////////////////////////////
-    //  same as end_director_base above, but stores iterator
-    ///////////////////////////////////////////////////////////////////////////
-    template <typename Parser>
-    struct end_director_base<Parser, mpl::true_>
-    {
-        typedef mpl::true_ stores_iterator;
-
-        template <typename Component, typename Context, typename Iterator>
-        struct attribute
-        {
-            typedef unused_type type;
-        };
-
-        template <
-            typename Component
-          , typename Iterator, typename Context
-          , typename Skipper, typename Attribute>
-        static bool parse(
-            Component const& /*component*/
-          , Iterator& first, Iterator const& last
-          , Context& /*context*/, Skipper const& skipper
-          , Attribute& /*attr*/)
-        {
-            qi::skip(first, last, skipper);
-
-            Iterator it = first;
-            if (!Parser::test(it, last))
-                return false;
-
-            first = it;
-            return true;
-        }
-
-        // subclasses are required to implement test:
-
-        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
-      : end_director_base<
-            negated_end_director<Positive>,
-            typename Positive::director::stores_iterator
-        >
-    {
-        template <typename Iterator>
-        static bool test (Iterator& first, Iterator const& last)
-        {
-            return !Positive::director::test(first, last);
-        }
-
-        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), ctx);
-        }
-    };
-
-    ///////////////////////////////////////////////////////////////////////////
-    //  eoi: end of input
-    struct eoi_director : end_director_base<eoi_director>
-    {
-        template <typename Iterator>
-        static bool test (Iterator& first, Iterator const& last)
-        {
-            return first == last;
-        }
-
-        template <typename Component, typename Context>
-        static std::string what(Component const& component, Context const& ctx)
-        {
-            return "eoi";
-        }
-    };
-
-
-    ///////////////////////////////////////////////////////////////////////////
-    //  the eol_director matches line endings
-    ///////////////////////////////////////////////////////////////////////////
-    struct eol_director : end_director_base<eol_director, mpl::true_>
-    {
-        template <typename Iterator>
-        static bool test (Iterator& first, Iterator const& last)
-        {
-            bool matched = false;
-            if (first != last && *first == '\r')    // CR
-            {
-                matched = true;
-                ++first;
-            }
-            if (first != last && *first == '\n')    // LF
-            {
-                matched = true;
-                ++first;
-            }
-            return matched;
-        }
-
-        template <typename Component, typename Context>
-        static std::string what(Component const& component, Context const& ctx)
-        {
-            return "eol";
-        }
-    };
-
-///////////////////////////////////////////////////////////////////////////////
-}}}
-
-#endif
-
-
Modified: trunk/boost/spirit/home/qi/binary.hpp
==============================================================================
--- trunk/boost/spirit/home/qi/binary.hpp	(original)
+++ trunk/boost/spirit/home/qi/binary.hpp	2009-04-26 10:42:24 EDT (Sun, 26 Apr 2009)
@@ -1,16 +1,16 @@
-//  Copyright (c) 2001-2009 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)
+/*=============================================================================
+    Copyright (c) 2001-2009 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_BINARY_MAY_08_2007_0906AM)
 #define BOOST_SPIRIT_BINARY_MAY_08_2007_0906AM
 
-#if defined(_MSC_VER) && (_MSC_VER >= 1020)
-#pragma once      // MS compatible compilers support #pragma once
+#if defined(_MSC_VER)
+#pragma once
 #endif
 
 #include <boost/spirit/home/qi/binary/binary.hpp>
-#include <boost/spirit/home/qi/binary/meta_grammar.hpp>
 
 #endif
Modified: trunk/boost/spirit/home/qi/binary/binary.hpp
==============================================================================
--- trunk/boost/spirit/home/qi/binary/binary.hpp	(original)
+++ trunk/boost/spirit/home/qi/binary/binary.hpp	2009-04-26 10:42:24 EDT (Sun, 26 Apr 2009)
@@ -1,24 +1,82 @@
-//  Copyright (c) 2001-2009 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)
-
+/*=============================================================================
+    Copyright (c) 2001-2009 Hartmut Kaiser
+    Copyright (c) 2001-2009 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_BINARY_MAY_08_2007_0808AM)
 #define BOOST_SPIRIT_BINARY_MAY_08_2007_0808AM
 
-#if defined(_MSC_VER) && (_MSC_VER >= 1020)
-#pragma once      // MS compatible compilers support #pragma once
+#if defined(_MSC_VER)
+#pragma once
 #endif
 
-#include <boost/spirit/home/support/component.hpp>
-#include <boost/spirit/home/support/detail/integer/endian.hpp>
-#include <boost/spirit/home/support/attribute_of.hpp>
+#include <boost/spirit/home/support/common_terminals.hpp>
+#include <boost/spirit/home/support/detail/endian.hpp>
+#include <boost/spirit/home/support/attributes.hpp>
+#include <boost/spirit/home/qi/parser.hpp>
+#include <boost/spirit/home/qi/meta_compiler.hpp>
 #include <boost/spirit/home/qi/domain.hpp>
 #include <boost/spirit/home/qi/detail/assign_to.hpp>
-#include <boost/spirit/home/qi/skip.hpp>
+#include <boost/spirit/home/qi/skip_over.hpp>
+#include <boost/spirit/home/support/common_terminals.hpp>
+#include <boost/fusion/include/at.hpp>
+#include <boost/mpl/or.hpp>
+#include <boost/type_traits/is_integral.hpp>
+#include <boost/type_traits/is_enum.hpp>
+
+#define BOOST_SPIRIT_ENABLE_BINARY(name)                                        \
+    template <>                                                                 \
+    struct use_terminal<qi::domain, tag::name>                                  \
+      : mpl::true_ {};                                                          \
+                                                                                \
+    template <typename A0>                                                      \
+    struct use_terminal<qi::domain                                              \
+        , terminal_ex<tag::name, fusion::vector1<A0> > >                        \
+      : mpl::or_<is_integral<A0>, is_enum<A0> > {};                             \
+                                                                                \
+    template <>                                                                 \
+    struct use_lazy_terminal<qi::domain, tag::name, 1> : mpl::true_ {};         \
+                                                                                \
+/***/
+
+namespace boost { namespace spirit
+{
+    ///////////////////////////////////////////////////////////////////////////
+    // Enablers
+    ///////////////////////////////////////////////////////////////////////////
+    BOOST_SPIRIT_ENABLE_BINARY(byte_)                   // enables byte_
+    BOOST_SPIRIT_ENABLE_BINARY(word)                    // enables word
+    BOOST_SPIRIT_ENABLE_BINARY(dword)                   // enables dword
+    BOOST_SPIRIT_ENABLE_BINARY(big_word)                // enables big_word
+    BOOST_SPIRIT_ENABLE_BINARY(big_dword)               // enables big_dword
+    BOOST_SPIRIT_ENABLE_BINARY(little_word)             // enables little_word
+    BOOST_SPIRIT_ENABLE_BINARY(little_dword)            // enables little_dword
+#ifdef BOOST_HAS_LONG_LONG
+    BOOST_SPIRIT_ENABLE_BINARY(qword)                   // enables qword
+    BOOST_SPIRIT_ENABLE_BINARY(big_qword)               // enables big_qword
+    BOOST_SPIRIT_ENABLE_BINARY(little_qword)            // enables little_qword
+#endif
+}}
+
+#undef BOOST_SPIRIT_ENABLE_BINARY
 
 namespace boost { namespace spirit { namespace qi
 {
+    using boost::spirit::byte_;
+    using boost::spirit::word;
+    using boost::spirit::dword;
+    using boost::spirit::big_word;
+    using boost::spirit::big_dword;
+    using boost::spirit::little_word;
+    using boost::spirit::little_dword;
+#ifdef BOOST_HAS_LONG_LONG
+    using boost::spirit::qword;
+    using boost::spirit::big_qword;
+    using boost::spirit::little_qword;
+#endif
+
     namespace detail
     {
         template <int bits>
@@ -62,11 +120,11 @@
 #endif
 
         ///////////////////////////////////////////////////////////////////////
-        template <boost::integer::endianness bits>
+        template <BOOST_SCOPED_ENUM(boost::integer::endianness) bits>
         struct what;
 
         template <>
-        struct what<boost::integer::native>
+        struct what<boost::integer::endianness::native>
         {
             static std::string is()
             {
@@ -75,7 +133,7 @@
         };
 
         template <>
-        struct what<boost::integer::little>
+        struct what<boost::integer::endianness::little>
         {
             static char const* is()
             {
@@ -84,7 +142,7 @@
         };
 
         template <>
-        struct what<boost::integer::big>
+        struct what<boost::integer::endianness::big>
         {
             static char const* is()
             {
@@ -94,10 +152,10 @@
     }
 
     ///////////////////////////////////////////////////////////////////////////
-    template <integer::endianness endian, int bits>
-    struct any_binary_director
+    template <BOOST_SCOPED_ENUM(boost::integer::endianness) endian, int bits>
+    struct any_binary_parser : primitive_parser<any_binary_parser<endian, bits> >
     {
-        template <typename Component, typename Context, typename Iterator>
+        template <typename Context, typename Iterator>
         struct attribute
         {
             typedef boost::integer::endian<
@@ -105,22 +163,15 @@
             > type;
         };
 
-        template <
-            typename Component
-          , typename Iterator, typename Context
+        template <typename Iterator, typename Context
           , typename Skipper, typename Attribute>
-        static bool parse(
-            Component const&
-          , Iterator& first, Iterator const& last
-          , Context&, Skipper const& skipper
-          , Attribute& attr)
-        {
-            qi::skip(first, last, skipper);
-
-            typename
-                traits::attribute_of<
-                    qi::domain, Component, Context, Iterator>::type
-            attr_;
+        bool parse(Iterator& first, Iterator const& last
+          , Context& context, Skipper const& skipper
+          , Attribute& attr) const
+        {
+            qi::skip_over(first, last, skipper);
+
+            typename attribute<Context, Iterator>::type attr_;
             unsigned char* bytes = reinterpret_cast<unsigned char*>(&attr_);
 
             Iterator it = first;
@@ -136,38 +187,43 @@
             return true;
         }
 
-        template <typename Component, typename Context>
-        static std::string what(Component const& component, Context const& ctx)
+        template <typename Context>
+        info what(Context& context) const
         {
-            return qi::detail::what<endian>::is();
+            return info(qi::detail::what<endian>::is());
         }
     };
 
     ///////////////////////////////////////////////////////////////////////////
-    template <integer::endianness endian, int bits>
-    struct binary_lit_director
+    template <typename Int
+      , BOOST_SCOPED_ENUM(boost::integer::endianness) endian, int bits>
+    struct binary_lit_parser
+      : primitive_parser<binary_lit_parser<Int, endian, bits> >
     {
-        template <typename Component, typename Context, typename Iterator>
+        template <typename Context, typename Iterator>
         struct attribute
         {
             typedef unused_type type;
         };
 
-        template <
-            typename Component
-          , typename Iterator, typename Context
-          , typename Skipper, typename Attribute>
-        static bool parse(
-            Component const& component
-          , Iterator& first, Iterator const& last
-          , Context&, Skipper const& skipper
-          , Attribute& attr)
-        {
-            qi::skip(first, last, skipper);
+        binary_lit_parser(Int n)
+          : n(n) {}
 
+        template <typename Iterator, typename Context
+          , typename Skipper, typename Attribute>
+        bool parse(Iterator& first, Iterator const& last
+          , Context& context, Skipper const& skipper
+          , Attribute& attr) const
+        {
+            qi::skip_over(first, last, skipper);
+
+            // Even if the endian types are not pod's (at least not in the
+            // definition of C++03) it seems to be safe to assume they are
+            // (but in C++0x the endian types _are_ PODs).
+            // This allows us to treat them as a sequence of consecutive bytes.
             boost::integer::endian<
-                endian, typename qi::detail::integer<bits>::type, bits
-            > attr_ (fusion::at_c<0>(component.elements));
+                endian, typename qi::detail::integer<bits>::type, bits> attr_;
+            attr_ = n;
             unsigned char* bytes = reinterpret_cast<unsigned char*>(&attr_);
 
             Iterator it = first;
@@ -182,13 +238,67 @@
             return true;
         }
 
-        template <typename Component, typename Context>
-        static std::string what(Component const& component, Context const& ctx)
+        template <typename Context>
+        info what(Context& context) const
         {
-            return qi::detail::what<endian>::is();
+            return info(qi::detail::what<endian>::is());
         }
+
+        Int n;
     };
 
+    ///////////////////////////////////////////////////////////////////////////
+    // Parser generators: make_xxx function (objects)
+    ///////////////////////////////////////////////////////////////////////////
+    template <BOOST_SCOPED_ENUM(boost::integer::endianness) endian, int bits>
+    struct make_binary_parser
+    {
+        typedef any_binary_parser<endian, bits> result_type;
+        result_type operator()(unused_type, unused_type) const
+        {
+            return result_type();
+        }
+    };
+
+    template <typename Int
+      , BOOST_SCOPED_ENUM(boost::integer::endianness) endian, int bits>
+    struct make_binary_lit_parser
+    {
+        typedef binary_lit_parser<Int, endian, bits> result_type;
+        template <typename Terminal>
+        result_type operator()(Terminal const& term, unused_type) const
+        {
+            return result_type(fusion::at_c<0>(term.args));
+        }
+    };
+
+#define BOOST_SPIRIT_MAKE_BINARY_PRIMITIVE(name, endian, bits)                  \
+    template <typename Modifiers>                                               \
+    struct make_primitive<tag::name, Modifiers>                                 \
+      : make_binary_parser<boost::integer::endianness::endian, bits> {};        \
+                                                                                \
+    template <typename Modifiers, typename A0>                                  \
+    struct make_primitive<                                                      \
+        terminal_ex<tag::name, fusion::vector1<A0> > , Modifiers>               \
+      : make_binary_lit_parser<A0, boost::integer::endianness::endian, bits> {};\
+                                                                                \
+    /***/
+
+    BOOST_SPIRIT_MAKE_BINARY_PRIMITIVE(byte_, native, 8)
+    BOOST_SPIRIT_MAKE_BINARY_PRIMITIVE(word, native, 16)
+    BOOST_SPIRIT_MAKE_BINARY_PRIMITIVE(dword, native, 32)
+    BOOST_SPIRIT_MAKE_BINARY_PRIMITIVE(big_word, big, 16)
+    BOOST_SPIRIT_MAKE_BINARY_PRIMITIVE(big_dword, big, 32)
+    BOOST_SPIRIT_MAKE_BINARY_PRIMITIVE(little_word, little, 16)
+    BOOST_SPIRIT_MAKE_BINARY_PRIMITIVE(little_dword, little, 32)
+#ifdef BOOST_HAS_LONG_LONG
+    BOOST_SPIRIT_MAKE_BINARY_PRIMITIVE(qword, native, 64)
+    BOOST_SPIRIT_MAKE_BINARY_PRIMITIVE(big_qword, big, 64)
+    BOOST_SPIRIT_MAKE_BINARY_PRIMITIVE(little_qword, little, 64)
+#endif
+
+#undef BOOST_SPIRIT_MAKE_BINARY_PRIMITIVE
+
 }}}
 
 #endif
Deleted: trunk/boost/spirit/home/qi/binary/meta_grammar.hpp
==============================================================================
--- trunk/boost/spirit/home/qi/binary/meta_grammar.hpp	2009-04-26 10:42:24 EDT (Sun, 26 Apr 2009)
+++ (empty file)
@@ -1,259 +0,0 @@
-//  Copyright (c) 2001-2009 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_META_GRAMMAR_MAY_08_2007_0824AM)
-#define BOOST_SPIRIT_META_GRAMMAR_MAY_08_2007_0824AM
-
-#if defined(_MSC_VER) && (_MSC_VER >= 1020)
-#pragma once      // MS compatible compilers support #pragma once
-#endif
-
-#include <boost/spirit/home/qi/domain.hpp>
-#include <boost/spirit/home/support/placeholders.hpp>
-#include <boost/spirit/home/support/meta_grammar.hpp>
-#include <boost/spirit/home/support/detail/integer/endian.hpp>
-#include <boost/mpl/identity.hpp>
-#include <boost/mpl/bool.hpp>
-#include <boost/utility/enable_if.hpp>
-
-namespace boost { namespace spirit { namespace qi
-{
-    ///////////////////////////////////////////////////////////////////////////
-    // forwards
-    /////////////////////////////////////////////////////////////////////////// 
-    template <integer::endianness endian, int bits>
-    struct any_binary_director;
-    
-    template <integer::endianness endian, int bits>
-    struct binary_lit_director;
-
-    struct main_meta_grammar;
-
-    template <typename Expr, typename Enable>
-    struct is_valid_expr;
-
-    template <typename Expr, typename Enable>
-    struct expr_transform;
-
-    ///////////////////////////////////////////////////////////////////////////
-    // get the director of an integer based binary literal type
-    ///////////////////////////////////////////////////////////////////////////
-    template <typename T>
-    struct extract_literal_bin_director
-    {
-        typedef binary_lit_director<
-            boost::integer::native, sizeof(T)*CHAR_BIT
-        > type;
-    };
-
-    ///////////////////////////////////////////////////////////////////////////
-    // get the director of a binary tag
-    ///////////////////////////////////////////////////////////////////////////
-    template <typename Tag>
-    struct extract_binary_director;
-
-    // native endian binaries
-    template <>
-    struct extract_binary_director<tag::byte>    
-    {
-        typedef any_binary_director<boost::integer::native, 8> type;
-    };
-
-    template <>
-    struct extract_binary_director<tag::word>    
-    {
-        typedef any_binary_director<boost::integer::native, 16> type;
-    };
-
-    template <>
-    struct extract_binary_director<tag::dword>    
-    {
-        typedef any_binary_director<boost::integer::native, 32> type;
-    };
-
-    // big endian binaries
-    template <>
-    struct extract_binary_director<tag::big_word>    
-    {
-        typedef any_binary_director<boost::integer::big, 16> type;
-    };
-
-    template <>
-    struct extract_binary_director<tag::big_dword>    
-    {
-        typedef any_binary_director<boost::integer::big, 32> type;
-    };
-
-    // little endian binaries
-    template <>
-    struct extract_binary_director<tag::little_word>    
-    {
-        typedef any_binary_director<boost::integer::little, 16> type;
-    };
-
-    template <>
-    struct extract_binary_director<tag::little_dword>    
-    {
-        typedef any_binary_director<boost::integer::little, 32> type;
-    };
-
-#ifdef BOOST_HAS_LONG_LONG
-    template <>
-    struct extract_binary_director<tag::qword>    
-    {
-        typedef any_binary_director<boost::integer::native, 64> type;
-    };
-
-    template <>
-    struct extract_binary_director<tag::big_qword>    
-    {
-        typedef any_binary_director<boost::integer::big, 64> type;
-    };
-
-    template <>
-    struct extract_binary_director<tag::little_qword>    
-    {
-        typedef any_binary_director<boost::integer::little, 64> type;
-    };
-#endif
-
-    ///////////////////////////////////////////////////////////////////////////
-    // get the director of a binary literal tag
-    ///////////////////////////////////////////////////////////////////////////
-    template <typename Tag, typename T>
-    struct extract_binary_lit_director;
-
-    // native endian binaries
-    template <typename T>
-    struct extract_binary_lit_director<tag::byte, T>    
-    {
-        typedef binary_lit_director<boost::integer::native, 8> type;
-    };
-
-    template <typename T>
-    struct extract_binary_lit_director<tag::word, T>    
-    {
-        typedef binary_lit_director<boost::integer::native, 16> type;
-    };
-
-    template <typename T>
-    struct extract_binary_lit_director<tag::dword, T>    
-    {
-        typedef binary_lit_director<boost::integer::native, 32> type;
-    };
-
-    // big endian binaries
-    template <typename T>
-    struct extract_binary_lit_director<tag::big_word, T>    
-    {
-        typedef binary_lit_director<boost::integer::big, 16> type;
-    };
-
-    template <typename T>
-    struct extract_binary_lit_director<tag::big_dword, T>    
-    {
-        typedef binary_lit_director<boost::integer::big, 32> type;
-    };
-
-    // little endian binaries
-    template <typename T>
-    struct extract_binary_lit_director<tag::little_word, T>    
-    {
-        typedef binary_lit_director<boost::integer::little, 16> type;
-    };
-
-    template <typename T>
-    struct extract_binary_lit_director<tag::little_dword, T>    
-    {
-        typedef binary_lit_director<boost::integer::little, 32> type;
-    };
-
-#ifdef BOOST_HAS_LONG_LONG
-    template <typename T>
-    struct extract_binary_lit_director<tag::qword, T>    
-    {
-        typedef binary_lit_director<boost::integer::native, 64> type;
-    };
-
-    template <typename T>
-    struct extract_binary_lit_director<tag::big_qword, T>    
-    {
-        typedef binary_lit_director<boost::integer::big, 64> type;
-    };
-
-    template <typename T>
-    struct extract_binary_lit_director<tag::little_qword, T>    
-    {
-        typedef binary_lit_director<boost::integer::little, 64> type;
-    };
-#endif
-
-    ///////////////////////////////////////////////////////////////////////////
-    // binary meta-grammar
-    ///////////////////////////////////////////////////////////////////////////
-    // literals: 10, 10L, 10LL
-    struct int_binary_meta_grammar
-      : meta_grammar::compose_empty<
-            proto::if_<
-                is_int_lit_tag<proto::_child, qi::domain>()
-            >,
-            qi::domain,
-            mpl::identity<extract_literal_bin_director<mpl::_> >
-        >
-    {
-    };
-
-    struct binary_meta_grammar  
-      : proto::or_<
-            meta_grammar::compose_empty<
-                proto::if_<
-                    is_binary_tag<proto::_child, qi::domain>()
-                >,
-                qi::domain, 
-                mpl::identity<extract_binary_director<mpl::_> > 
-            >,
-            meta_grammar::compose_function1_eval<
-                proto::function<
-                    proto::if_<
-                        is_binary_tag<proto::_child, qi::domain>()
-                    >,
-                    int_binary_meta_grammar
-                >,
-                qi::domain,
-                mpl::identity<extract_binary_lit_director<mpl::_, mpl::_> >
-            >
-        >
-    {
-    };
-
-    ///////////////////////////////////////////////////////////////////////////
-    //  These specializations non-intrusively hooks into the Qi meta-grammar.
-    //  (see qi/meta_grammar.hpp)
-    ///////////////////////////////////////////////////////////////////////////
-    template <typename Expr>
-    struct is_valid_expr<
-            Expr,
-            typename enable_if<
-                proto::matches<Expr, binary_meta_grammar> 
-            >::type
-        >
-      : mpl::true_
-    {
-    };
-
-    template <typename Expr>
-    struct expr_transform<
-            Expr,
-            typename enable_if<
-                proto::matches<Expr, binary_meta_grammar> 
-            >::type
-        >
-      : mpl::identity<binary_meta_grammar>
-    {
-    };
-    
-}}}
-
-#endif
Modified: trunk/boost/spirit/home/qi/char.hpp
==============================================================================
--- trunk/boost/spirit/home/qi/char.hpp	(original)
+++ trunk/boost/spirit/home/qi/char.hpp	2009-04-26 10:42:24 EDT (Sun, 26 Apr 2009)
@@ -1,15 +1,18 @@
 /*=============================================================================
-    Copyright (c) 2001-2007 Joel de Guzman
+    Copyright (c) 2001-2009 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_CHAR_FEB_02_2007_0921AM)
-#define BOOST_SPIRIT_CHAR_FEB_02_2007_0921AM
+#if !defined(BOOST_SPIRIT_CHAR_FEBRUARY_02_2007_0921AM)
+#define BOOST_SPIRIT_CHAR_FEBRUARY_02_2007_0921AM
+
+#if defined(_MSC_VER)
+#pragma once
+#endif
 
 #include <boost/spirit/home/qi/char/char_parser.hpp>
 #include <boost/spirit/home/qi/char/char.hpp>
 #include <boost/spirit/home/qi/char/char_class.hpp>
-#include <boost/spirit/home/qi/char/meta_grammar.hpp>
 
 #endif
Modified: trunk/boost/spirit/home/qi/char/char.hpp
==============================================================================
--- trunk/boost/spirit/home/qi/char/char.hpp	(original)
+++ trunk/boost/spirit/home/qi/char/char.hpp	2009-04-26 10:42:24 EDT (Sun, 26 Apr 2009)
@@ -1,367 +1,514 @@
 /*=============================================================================
-    Copyright (c) 2001-2007 Joel de Guzman
+    Copyright (c) 2001-2009 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_CHAR_APR_16_2006_1051AM)
-#define BOOST_SPIRIT_CHAR_APR_16_2006_1051AM
+#if !defined(BOOST_SPIRIT_CHAR_APRIL_16_2006_1051AM)
+#define BOOST_SPIRIT_CHAR_APRIL_16_2006_1051AM
 
+#if defined(_MSC_VER)
+#pragma once
+#endif
+
+#include <boost/spirit/home/support/common_terminals.hpp>
+#include <boost/spirit/home/support/string_traits.hpp>
+#include <boost/spirit/home/support/info.hpp>
+#include <boost/spirit/home/support/detail/get_encoding.hpp>
 #include <boost/spirit/home/qi/char/char_parser.hpp>
-#include <boost/spirit/home/qi/char/detail/get_char.hpp>
-#include <boost/spirit/home/qi/domain.hpp>
+#include <boost/spirit/home/qi/char/char_class.hpp>
+#include <boost/spirit/home/qi/char/detail/basic_chset.hpp>
+#include <boost/spirit/home/qi/meta_compiler.hpp>
+#include <boost/spirit/home/qi/auxiliary/lazy.hpp>
 #include <boost/fusion/include/at.hpp>
-#include <boost/fusion/include/value_at.hpp>
-#include <boost/fusion/include/vector.hpp>
-#include <boost/spirit/home/support/modifier.hpp>
-#include <boost/spirit/home/support/char_class.hpp>
-#include <boost/spirit/home/support/detail/to_narrow.hpp>
+#include <boost/mpl/if.hpp>
+#include <boost/mpl/assert.hpp>
 #include <boost/utility/enable_if.hpp>
-#include <boost/type_traits/remove_reference.hpp>
-#include <boost/foreach.hpp>
-#include <boost/mpl/print.hpp>
+#include <string>
 
-namespace boost { namespace spirit { namespace qi
+#if defined(_MSC_VER)
+#pragma once
+#endif
+
+namespace boost { namespace spirit
 {
     ///////////////////////////////////////////////////////////////////////////
-    // parse any character
+    // Enablers
     ///////////////////////////////////////////////////////////////////////////
-    template <typename Char>
-    struct any_char : char_parser<any_char<Char>, Char>
-    {
-        template <typename Component, typename CharParam, typename Context>
-        static bool test(Component const&, CharParam, Context&)
-        {
-            return true;
-        }
+    template <typename CharEncoding>
+    struct use_terminal<qi::domain
+      , terminal<
+            tag::char_code<tag::char_, CharEncoding>    // enables char_
+        >
+    > : mpl::true_ {};
+
+    template <typename CharEncoding, typename A0>
+    struct use_terminal<qi::domain
+      , terminal_ex<
+            tag::char_code<tag::char_, CharEncoding>    // enables char_('x'), char_("x")
+          , fusion::vector1<A0>                         // and char_("a-z0-9")
+        >
+    > : mpl::true_ {};
+
+    template <typename CharEncoding, typename A0, typename A1>
+    struct use_terminal<qi::domain
+      , terminal_ex<
+            tag::char_code<tag::char_, CharEncoding>    // enables char_('a','z')
+          , fusion::vector2<A0, A1>
+        >
+    > : mpl::true_ {};
+
+    template <typename CharEncoding>                    // enables *lazy* char_('x'), char_("x")
+    struct use_lazy_terminal<                           // and char_("a-z0-9")
+        qi::domain
+      , tag::char_code<tag::char_, CharEncoding>
+      , 1 // arity
+    > : mpl::true_ {};
+
+    template <typename CharEncoding>                    // enables *lazy* char_('a','z')
+    struct use_lazy_terminal<
+        qi::domain
+      , tag::char_code<tag::char_, CharEncoding>
+      , 2 // arity
+    > : mpl::true_ {};
+
+    template <>
+    struct use_terminal<qi::domain, char>               // enables 'x'
+      : mpl::true_ {};
+
+    template <>
+    struct use_terminal<qi::domain, char[2]>            // enables "x"
+      : mpl::true_ {};
+
+    template <>
+    struct use_terminal<qi::domain, wchar_t>            // enables wchar_t
+      : mpl::true_ {};
+
+    template <>
+    struct use_terminal<qi::domain, wchar_t[2]>         // enables L"x"
+      : mpl::true_ {};
+}}
 
-        template <typename Component, typename Context>
-        static std::string what(Component const& component, Context const& ctx)
-        {
-            return "any-char";
-        }
-    };
+namespace boost { namespace spirit { namespace qi
+{
+    using spirit::lit; // lit('x') is equivalent to 'x'
 
     ///////////////////////////////////////////////////////////////////////////
-    // parse a single character
+    // Parser for a single character
     ///////////////////////////////////////////////////////////////////////////
-    template <typename Char>
-    struct literal_char : char_parser<literal_char<Char>, Char>
+    template <typename CharEncoding, bool no_attribute, bool no_case = false>
+    struct literal_char
+      : char_parser<
+            literal_char<CharEncoding, no_attribute, false>
+          , typename CharEncoding::char_type
+          , typename mpl::if_c<no_attribute, unused_type
+              , typename CharEncoding::char_type>::type>
     {
-        template <typename Component, typename Context, typename Iterator>
+        typedef typename CharEncoding::char_type char_type;
+        typedef CharEncoding char_encoding;
+
+        literal_char(char_type ch)
+          : ch(ch) {}
+
+        template <typename Context, typename Iterator>
         struct attribute
         {
-            typedef unused_type type;   // literal parsers have no attribute
+            typedef typename mpl::if_c<
+                no_attribute, unused_type, char_type>::type
+            type;
         };
 
-        template <typename Component, typename CharParam, typename Context>
-        static bool test(Component const& component, CharParam ch, Context&)
+        template <typename CharParam, typename Context>
+        bool test(CharParam ch, Context&) const
         {
-            return detail::get_char(fusion::at_c<0>(component.elements)) == ch;
+            return this->ch == char_type(ch);
         }
 
-        template <typename Component, typename Context>
-        static std::string what(Component const& component, Context const& ctx)
+        template <typename Context>
+        info what(Context& /*context*/) const
         {
-            return std::string("'")
-                + spirit::detail::to_narrow_char(
-                    detail::get_char(fusion::at_c<0>(component.elements)))
-                + '\'';
+            return info("literal-char", char_encoding::toucs4(ch));
         }
+
+        char_type ch;
     };
 
-    ///////////////////////////////////////////////////////////////////////////
-    // parse a character set
-    ///////////////////////////////////////////////////////////////////////////
-    template <typename Char>
-    struct char_set : char_parser<char_set<Char>, Char>
+    template <typename CharEncoding, bool no_attribute>
+    struct literal_char<CharEncoding, no_attribute, true> // case insensitive
+      : char_parser<
+            literal_char<CharEncoding, no_attribute, true>
+          , typename mpl::if_c<no_attribute, unused_type
+              , typename CharEncoding::char_type>::type>
     {
-        template <typename Component, typename CharParam, typename Context>
-        static bool test(Component const& component, CharParam ch, Context&)
-        {
-            return component.ptr->test(ch);
-        }
+        typedef typename CharEncoding::char_type char_type;
+        typedef CharEncoding char_encoding;
 
-        template <typename Component, typename Context>
-        static std::string what(Component const& component, Context const& ctx)
-        {
-            return "char-set";
-        }
-    };
+        literal_char(char_type ch)
+          : lo(char_encoding::tolower(ch))
+          , hi(char_encoding::toupper(ch)) {}
 
-    ///////////////////////////////////////////////////////////////////////////
-    // parse a lazy character
-    ///////////////////////////////////////////////////////////////////////////
-    struct lazy_char : char_parser<lazy_char>
-    {
-        template <typename Component, typename Context, typename Iterator>
+        template <typename Context, typename Iterator>
         struct attribute
         {
-            typedef typename
-                result_of::subject<Component>::type
-            subject_type;
-
-            typedef typename
-                remove_reference<
-                    typename boost::result_of<subject_type(unused_type, Context)>::type
-                >::type
+            typedef typename mpl::if_c<
+                no_attribute, unused_type, char_type>::type
             type;
         };
 
-        template <typename Component, typename CharParam, typename Context>
-        static bool test(Component const& component, CharParam ch, Context& context)
+        template <typename CharParam, typename Context>
+        bool test(CharParam ch, Context&) const
         {
-            return fusion::at_c<0>(component.elements)(unused, context) == ch;
+            return this->lo == char_type(ch) || this->hi == char_type(ch);
         }
 
-        template <typename Component, typename Context>
-        static std::string what(Component const& component, Context const& ctx)
+        template <typename Context>
+        info what(Context& /*context*/) const
         {
-            return std::string("'")
-                + spirit::detail::to_narrow_char(
-                    fusion::at_c<0>(component.elements)(unused, ctx))
-                + '\'';
+            return info("no-case-literal-char", char_encoding::toucs4(lo));
         }
+
+        char_type lo, hi;
     };
 
     ///////////////////////////////////////////////////////////////////////////
-    // parse a character range
+    // Parser for a character range
     ///////////////////////////////////////////////////////////////////////////
-    template <typename Char>
-    struct char_range : char_parser<char_range<Char>, Char>
+    template <typename CharEncoding, bool no_case = false>
+    struct char_range
+      : char_parser<char_range<CharEncoding, false>, typename CharEncoding::char_type>
     {
-        template <typename Component, typename CharParam, typename Context>
-        static bool test(Component const& component, CharParam ch, Context&)
+        typedef typename CharEncoding::char_type char_type;
+        typedef CharEncoding char_encoding;
+
+        char_range(char_type from, char_type to)
+          : from(from), to(to) {}
+
+        template <typename CharParam, typename Context>
+        bool test(CharParam ch, Context&) const
         {
-            return
-                !(ch < fusion::at_c<0>(component.elements)) &&
-                !(fusion::at_c<1>(component.elements) < ch);
+            return !(char_type(ch) < from) && !(to < char_type(ch));
         }
 
-        template <typename Component, typename Context>
-        static std::string what(Component const& component, Context const& ctx)
+        template <typename Context>
+        info what(Context& /*context*/) const
         {
-            std::string result;
-            result += std::string("'") + fusion::at_c<0>(component.elements) + '\'';
-            result += "...";
-            result += std::string("'") + fusion::at_c<1>(component.elements) + '\'';
+            info result("char-range", char_encoding::toucs4(from));
+            boost::get<std::string&>(result.value) += '-';
+            boost::get<std::string&>(result.value) += to_utf8(char_encoding::toucs4(to));
             return result;
         }
+
+        char_type from, to;
     };
 
-    ///////////////////////////////////////////////////////////////////////////
-    // parse a lazy character range
-    ///////////////////////////////////////////////////////////////////////////
-    struct lazy_char_range : char_parser<lazy_char_range>
+    template <typename CharEncoding>
+    struct char_range<CharEncoding, true> // case insensitive
+      : char_parser<char_range<CharEncoding, true>, typename CharEncoding::char_type>
     {
-        template <typename Component, typename Context, typename Iterator>
-        struct attribute
-        {
-            typedef typename
-                result_of::subject<Component>::type
-            subject_type;
-
-            typedef typename
-                remove_reference<
-                    typename boost::result_of<subject_type(unused_type, Context)>::type
-                >::type
-            type;
-        };
+        typedef typename CharEncoding::char_type char_type;
+        typedef CharEncoding char_encoding;
+
+        char_range(char_type from, char_type to)
+          : from_lo(char_encoding::tolower(from))
+          , to_lo(char_encoding::tolower(to))
+          , from_hi(char_encoding::toupper(from))
+          , to_hi(char_encoding::toupper(to))
+        {}
 
-        template <typename Component, typename CharParam, typename Context>
-        static bool test(Component const& component, CharParam ch, Context& context)
+        template <typename CharParam, typename Context>
+        bool test(CharParam ch, Context&) const
         {
-            return
-                !(ch < fusion::at_c<0>(component.elements)(unused, context)) &&
-                !(fusion::at_c<1>(component.elements)(unused, context) < ch);
+            return (!(char_type(ch) < from_lo) && !(to_lo < char_type(ch)))
+                || (!(char_type(ch) < from_hi) && !(to_hi < char_type(ch)))
+            ;
         }
 
-        template <typename Component, typename Context>
-        static std::string what(Component const& component, Context const& ctx)
+        template <typename Context>
+        info what(Context& /*context*/) const
         {
-            return "char-range";
+            info result("no-case-char-range", char_encoding::toucs4(from_lo));
+            boost::get<std::string&>(result.value) += '-';
+            boost::get<std::string&>(result.value) += to_utf8(char_encoding::toucs4(to_lo));
+            return result;
         }
+
+        char_type from_lo, to_lo, from_hi, to_hi;
     };
 
     ///////////////////////////////////////////////////////////////////////////
-    // no_case literal_char version
+    // Parser for a character set
     ///////////////////////////////////////////////////////////////////////////
-    template <typename Char>
-    struct no_case_literal_char : char_parser<no_case_literal_char<Char>, Char>
+    template <typename CharEncoding, bool no_case = false>
+    struct char_set
+      : char_parser<char_set<CharEncoding, false>, typename CharEncoding::char_type>
     {
-        template <typename Component, typename Context, typename Iterator>
-        struct attribute
+        typedef typename CharEncoding::char_type char_type;
+        typedef CharEncoding char_encoding;
+
+        template <typename String>
+        char_set(String const& str)
         {
-            typedef unused_type type;   // literal parsers have no attribute
-        };
+            typedef typename traits::char_type_of<String>::type in_type;
+
+            BOOST_MPL_ASSERT_MSG((
+                (sizeof(char_type) == sizeof(in_type))
+            ), cannot_convert_string, (String));
+
+            char_type const* definition =
+                (char_type const*)traits::get_c_string(str);
+            char_type ch = *definition++;
+            while (ch)
+            {
+                char_type next = *definition++;
+                if (next == '-')
+                {
+                    next = *definition++;
+                    if (next == 0)
+                    {
+                        chset.set(ch);
+                        chset.set('-');
+                        break;
+                    }
+                    chset.set(ch, next);
+                }
+                else
+                {
+                    chset.set(ch);
+                }
+                ch = next;
+            }
+        }
 
-        template <typename Component, typename CharParam, typename Context>
-        static bool test(Component const& component, CharParam ch, Context&)
+        template <typename CharParam, typename Context>
+        bool test(CharParam ch, Context&) const
         {
-            return detail::get_char(fusion::at_c<0>(component.elements)) == ch
-                || detail::get_char(fusion::at_c<1>(component.elements)) == ch
-            ;
+            return chset.test(char_type(ch));
         }
 
-        template <typename Component, typename Context>
-        static std::string what(Component const& component, Context const& ctx)
+        template <typename Context>
+        info what(Context& /*context*/) const
         {
-            std::string result;
-            result += std::string("'")
-                + spirit::detail::to_narrow_char(
-                    detail::get_char(fusion::at_c<0>(component.elements))) + '\'';
-            result += " or ";
-            result += std::string("'") +
-                spirit::detail::to_narrow_char(
-                    detail::get_char(fusion::at_c<1>(component.elements))) + '\'';
-            return result;
+            return info("char-set");
         }
+
+        detail::basic_chset<char_type> chset;
     };
 
-    ///////////////////////////////////////////////////////////////////////////
-    // no_case char_range version
-    ///////////////////////////////////////////////////////////////////////////
-    template <typename Char>
-    struct no_case_char_range : char_parser<no_case_char_range<Char>, Char>
+    template <typename CharEncoding>
+    struct char_set<CharEncoding, true> // case insensitive
+      : char_parser<char_set<CharEncoding, true>, typename CharEncoding::char_type>
     {
-        template <typename Component, typename CharParam, typename Context>
-        static bool test(Component const& component, CharParam ch, Context&)
+        typedef typename CharEncoding::char_type char_type;
+        typedef CharEncoding char_encoding;
+
+        template <typename String>
+        char_set(String const& str)
         {
-            return
-                (!(ch < fusion::at_c<0>(component.elements)) &&
-                 !(fusion::at_c<1>(component.elements) < ch))
-            ||  (!(ch < fusion::at_c<2>(component.elements)) &&
-                 !(fusion::at_c<3>(component.elements) < ch))
-            ;
+            typedef typename traits::char_type_of<String>::type in_type;
+
+            BOOST_MPL_ASSERT_MSG((
+                (sizeof(char_type) == sizeof(in_type))
+            ), cannot_convert_string, (String));
+
+            char_type const* definition =
+                (char_type const*)traits::get_c_string(str);
+            char_type ch = *definition++;
+            while (ch)
+            {
+                char_type next = *definition++;
+                if (next == '-')
+                {
+                    next = *definition++;
+                    if (next == 0)
+                    {
+                        chset.set(CharEncoding::tolower(ch));
+                        chset.set(CharEncoding::toupper(ch));
+                        chset.set('-');
+                        break;
+                    }
+                    chset.set(CharEncoding::tolower(ch), CharEncoding::tolower(next));
+                    chset.set(CharEncoding::toupper(ch), CharEncoding::toupper(next));
+                }
+                else
+                {
+                    chset.set(CharEncoding::tolower(ch));
+                    chset.set(CharEncoding::toupper(ch));
+                }
+                ch = next;
+            }
         }
 
-        template <typename Component, typename Context>
-        static std::string what(Component const& component, Context const& ctx)
+        template <typename CharParam, typename Context>
+        bool test(CharParam ch, Context&) const
         {
-            std::string result;
-            result += std::string("'") + fusion::at_c<0>(component.elements) + '\'';
-            result += "...";
-            result += std::string("'") + fusion::at_c<1>(component.elements) + '\'';
-            result += " or ";
-            result += std::string("'") + fusion::at_c<2>(component.elements) + '\'';
-            result += "...";
-            result += std::string("'") + fusion::at_c<3>(component.elements) + '\'';
-            return result;
+            return chset.test(char_type(char_type(ch)));
         }
-    };
 
-    template <typename Char, typename Elements>
-    struct char_set_component;
-}}}
+        template <typename Context>
+        info what(Context& /*context*/) const
+        {
+            return info("no-case-char-set");
+        }
+
+        detail::basic_chset<char_type> chset;
+    };
 
-namespace boost { namespace spirit { namespace traits
-{
     ///////////////////////////////////////////////////////////////////////////
-    // char_set_component generator
+    // Parser generators: make_xxx function (objects)
     ///////////////////////////////////////////////////////////////////////////
-    template <typename Char, typename Elements, typename Modifier>
-    struct make_component<qi::domain, qi::char_set<Char>, Elements, Modifier
-      , typename disable_if<
-            is_member_of_modifier<Modifier, spirit::char_class::no_case_base_tag>
-        >::type
-    > : mpl::identity<qi::char_set_component<Char, Elements> >
+    namespace detail
     {
-        static qi::char_set_component<Char, Elements>
-        call(Elements const& elements)
+        template <typename Modifiers, typename Encoding>
+        struct basic_literal
         {
-            return qi::char_set_component<Char, Elements>(
-                fusion::at_c<0>(elements));
+            static bool const no_case =
+                has_modifier<
+                    Modifiers
+                  , tag::char_code_base<tag::no_case>
+                >::value;
+
+            static bool const no_attr =
+                !has_modifier<
+                    Modifiers
+                  , tag::lazy_eval
+                >::value;
+
+            typedef literal_char<
+                typename spirit::detail::get_encoding<
+                    Modifiers, Encoding, no_case>::type
+              , no_attr
+              , no_case>
+            result_type;
+
+            template <typename Char>
+            result_type operator()(Char ch, unused_type) const
+            {
+                return result_type(ch);
+            }
+
+            template <typename Char>
+            result_type operator()(Char const* str, unused_type) const
+            {
+                return result_type(str[0]);
+            }
+        };
+    }
+
+    template <typename Modifiers>
+    struct make_primitive<char, Modifiers>
+      : detail::basic_literal<Modifiers, char_encoding::standard> {};
+
+    template <typename Modifiers>
+    struct make_primitive<char const(&)[2], Modifiers>
+      : detail::basic_literal<Modifiers, char_encoding::standard> {};
+
+    template <typename Modifiers>
+    struct make_primitive<wchar_t, Modifiers>
+      : detail::basic_literal<Modifiers, char_encoding::standard_wide> {};
+
+    template <typename Modifiers>
+    struct make_primitive<wchar_t const(&)[2], Modifiers>
+      : detail::basic_literal<Modifiers, char_encoding::standard_wide> {};
+
+    template <typename CharEncoding, typename Modifiers>
+    struct make_primitive<
+        terminal<tag::char_code<tag::char_, CharEncoding> >, Modifiers>
+    {
+        typedef tag::char_code<tag::char_, CharEncoding> tag;
+        typedef char_class<tag> result_type;
+        result_type operator()(unused_type, unused_type) const
+        {
+            return result_type();
         }
     };
 
-    ///////////////////////////////////////////////////////////////////////////
-    // no_case char_set_component generator
-    ///////////////////////////////////////////////////////////////////////////
-    template <
-        typename Domain, typename Elements, typename Modifier, typename Char
-    >
-    struct make_modified_component<
-        Domain, qi::char_set<Char>, Elements, Modifier
-      , typename enable_if<
-            is_member_of_modifier<Modifier, spirit::char_class::no_case_base_tag>
-        >::type
-    >
+    template <typename CharEncoding, typename Modifiers, typename A0>
+    struct make_primitive<
+        terminal_ex<
+            tag::char_code<tag::char_, CharEncoding>
+          , fusion::vector1<A0>
+        >
+      , Modifiers>
     {
-        typedef qi::char_set_component<Char, Elements> type;
-        typedef typename Modifier::char_set char_set;
+        static bool const no_case =
+            has_modifier<
+                Modifiers
+              , tag::char_code<tag::no_case, CharEncoding>
+            >::value;
+
+        static bool const no_attr =
+            !has_modifier<
+                Modifiers
+              , tag::lazy_eval
+            >::value;
+
+        typedef typename
+            mpl::if_<
+                traits::is_string<A0>
+              , char_set<CharEncoding, no_case>
+              , literal_char<CharEncoding, no_attr, no_case>
+            >::type
+        result_type;
 
-        static type
-        call(Elements const& elements)
+        template <typename Terminal>
+        result_type operator()(Terminal const& term, unused_type) const
         {
-            return qi::char_set_component<Char, Elements>(
-                fusion::at_c<0>(elements), char_set());
+            return result_type(fusion::at_c<0>(term.args));
         }
     };
 
-    ///////////////////////////////////////////////////////////////////////////
-    // no_case_literal_char generator
-    ///////////////////////////////////////////////////////////////////////////
-    template <
-        typename Domain, typename Elements, typename Modifier, typename Char
-    >
-    struct make_modified_component<
-        Domain, qi::literal_char<Char>, Elements, Modifier
-      , typename enable_if<
-            is_member_of_modifier<Modifier, spirit::char_class::no_case_base_tag>
-        >::type
-    >
-    {
-        typedef fusion::vector<Char, Char> vector_type;
-        typedef
-            component<qi::domain, qi::no_case_literal_char<Char>, vector_type>
-        type;
-
-        static type
-        call(Elements const& elements)
-        {
-            typedef typename Modifier::char_set char_set;
-
-            Char ch = qi::detail::get_char(fusion::at_c<0>(elements));
-            vector_type v(
-                char_set::tolower(ch)
-              , char_set::toupper(ch)
-            );
-            return type(v);
+    template <typename CharEncoding, typename Modifiers, typename Char>
+    struct make_primitive<
+        terminal_ex<
+            tag::char_code<tag::char_, CharEncoding>
+          , fusion::vector1<Char(&)[2]> // For single char strings
+        >
+      , Modifiers>
+    {
+        static bool const no_case =
+            has_modifier<
+                Modifiers
+              , tag::char_code<tag::no_case, CharEncoding>
+            >::value;
+
+        static bool const no_attr =
+            !has_modifier<
+                Modifiers
+              , tag::lazy_eval
+            >::value;
+
+        typedef literal_char<CharEncoding, no_attr, no_case> result_type;
+
+        template <typename Terminal>
+        result_type operator()(Terminal const& term, unused_type) const
+        {
+            return result_type(fusion::at_c<0>(term.args)[0]);
         }
     };
 
-    ///////////////////////////////////////////////////////////////////////////
-    // no_case_char_range generator
-    ///////////////////////////////////////////////////////////////////////////
-    template <
-        typename Domain, typename Elements, typename Modifier, typename Char
-    >
-    struct make_modified_component<
-        Domain, qi::char_range<Char>, Elements, Modifier
-      , typename enable_if<
-            is_member_of_modifier<Modifier, spirit::char_class::no_case_base_tag>
-        >::type
-    >
-    {
-        typedef fusion::vector<Char, Char, Char, Char> vector_type;
-        typedef
-            component<qi::domain, qi::no_case_char_range<Char>, vector_type>
-        type;
-
-        static type
-        call(Elements const& elements)
-        {
-            typedef typename Modifier::char_set char_set;
-
-            Char first = fusion::at_c<0>(elements);
-            Char last = fusion::at_c<1>(elements);
-            vector_type v(
-                char_set::tolower(first)
-              , char_set::tolower(last)
-              , char_set::toupper(first)
-              , char_set::toupper(last)
+    template <typename CharEncoding, typename Modifiers, typename A0, typename A1>
+    struct make_primitive<
+        terminal_ex<
+            tag::char_code<tag::char_, CharEncoding>
+          , fusion::vector2<A0, A1>
+        >
+      , Modifiers>
+    {
+        static bool const no_case =
+            has_modifier<
+                Modifiers
+              , tag::char_code<tag::no_case, CharEncoding>
+            >::value;
+
+        typedef char_range<CharEncoding, no_case> result_type;
+
+        template <typename Terminal>
+        result_type operator()(Terminal const& term, unused_type) const
+        {
+            return result_type(
+                fusion::at_c<0>(term.args)
+              , fusion::at_c<1>(term.args)
             );
-            return type(v);
         }
     };
 }}}
Modified: trunk/boost/spirit/home/qi/char/char_class.hpp
==============================================================================
--- trunk/boost/spirit/home/qi/char/char_class.hpp	(original)
+++ trunk/boost/spirit/home/qi/char/char_class.hpp	2009-04-26 10:42:24 EDT (Sun, 26 Apr 2009)
@@ -1,91 +1,91 @@
 /*=============================================================================
-    Copyright (c) 2001-2007 Joel de Guzman
+    Copyright (c) 2001-2009 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_CHAR_CLASS_APR_16_2006_1051AM)
-#define BOOST_SPIRIT_CHAR_CLASS_APR_16_2006_1051AM
+#if !defined(BOOST_SPIRIT_CHAR_CLASS_APRIL_16_2006_1051AM)
+#define BOOST_SPIRIT_CHAR_CLASS_APRIL_16_2006_1051AM
+
+#if defined(_MSC_VER)
+#pragma once
+#endif
 
 #include <boost/spirit/home/qi/char/char_parser.hpp>
 #include <boost/spirit/home/qi/domain.hpp>
-#include <boost/spirit/home/support/modifier.hpp>
-#include <boost/spirit/home/support/iso8859_1.hpp>
-#include <boost/spirit/home/support/ascii.hpp>
-#include <boost/spirit/home/support/standard.hpp>
-#include <boost/spirit/home/support/standard_wide.hpp>
-#include <boost/fusion/include/cons.hpp>
+#include <boost/spirit/home/support/char_class.hpp>
+#include <boost/spirit/home/support/common_terminals.hpp>
+#include <boost/spirit/home/support/info.hpp>
+#include <boost/spirit/home/support/modify.hpp>
+
+namespace boost { namespace spirit
+{
+    ///////////////////////////////////////////////////////////////////////////
+    // Enablers
+    ///////////////////////////////////////////////////////////////////////////
+    // enables alnum, alpha, graph, etc.
+    template <typename CharClass, typename CharEncoding>
+    struct use_terminal<qi::domain, tag::char_code<CharClass, CharEncoding> >
+      : mpl::true_ {};
+}}
 
 namespace boost { namespace spirit { namespace qi
 {
     ///////////////////////////////////////////////////////////////////////////
-    // generic isxxx parser (for alnum, alpha, graph, etc.)
+    // Generic char classification parser (for alnum, alpha, graph, etc.)
     ///////////////////////////////////////////////////////////////////////////
     template <typename Tag>
     struct char_class
-      : char_parser<char_class<Tag>, typename Tag::char_set::char_type>
+      : char_parser<char_class<Tag>, typename Tag::char_encoding::char_type>
     {
-        typedef typename Tag::char_set char_set;
-        typedef typename Tag::char_class char_class_;
+        typedef typename Tag::char_encoding char_encoding;
+        typedef typename Tag::char_class classification;
 
-        template <typename Component, typename CharParam, typename Context>
-        static bool test(Component const&, CharParam ch, Context&)
+        template <typename CharParam, typename Context>
+        bool test(CharParam ch, Context&) const
         {
             using spirit::char_class::classify;
-            return classify<char_set>::is(char_class_(), ch);
+            return classify<char_encoding>::is(classification(), ch);
         }
 
-        template <typename Component, typename Context>
-        static std::string what(Component const& component, Context const& ctx)
+        template <typename Context>
+        info what(Context& /*context*/) const
         {
-            typedef spirit::char_class::what<char_set> what_;
-            return what_::is(char_class_());
+            typedef spirit::char_class::what<char_encoding> what_;
+            return info(what_::is(classification()));
         }
     };
-}}}
 
-namespace boost { namespace spirit { namespace traits
-{
-    ///////////////////////////////////////////////////////////////////////////
-    // no_case char_class conversions
-    ///////////////////////////////////////////////////////////////////////////
     namespace detail
     {
-        using spirit::char_class::key;
-        using spirit::char_class::lower_case_tag;
-        using spirit::char_class::upper_case_tag;
-        using spirit::char_class::tag::alpha;
-
-        template <typename Tag>
-        struct make_no_case_char_class :
-            mpl::identity<qi::char_class<Tag> > {};
-
-        template <typename CharSet>
-        struct make_no_case_char_class<lower_case_tag<CharSet> >
-          : mpl::identity<qi::char_class<key<CharSet, alpha> > > {};
-
-        template <typename CharSet>
-        struct make_no_case_char_class<upper_case_tag<CharSet> >
-          : mpl::identity<qi::char_class<key<CharSet, alpha> > > {};
+        template <typename Tag, bool no_case = false>
+        struct make_char_class : mpl::identity<Tag> {};
+
+        template <>
+        struct make_char_class<tag::lower, true> : mpl::identity<tag::alpha> {};
+
+        template <>
+        struct make_char_class<tag::upper, true> : mpl::identity<tag::alpha> {};
     }
 
-    template <
-        typename Domain, typename Elements, typename Modifier, typename Tag
-    >
-    struct make_modified_component<
-        Domain, qi::char_class<Tag>, Elements, Modifier
-      , typename enable_if<
-            is_member_of_modifier<Modifier, spirit::char_class::no_case_base_tag>
-        >::type
-    >
+    ///////////////////////////////////////////////////////////////////////////
+    // Parser generators: make_xxx function (objects)
+    ///////////////////////////////////////////////////////////////////////////
+    template <typename CharClass, typename CharEncoding, typename Modifiers>
+    struct make_primitive<tag::char_code<CharClass, CharEncoding>, Modifiers>
     {
-        typedef typename detail::make_no_case_char_class<Tag>::type director;
-        typedef component<qi::domain, director, fusion::nil> type;
+        static bool const no_case =
+            has_modifier<Modifiers, tag::char_code_base<tag::no_case> >::value;
+
+        typedef tag::char_code<
+            typename detail::make_char_class<CharClass, no_case>::type
+          , CharEncoding>
+        tag;
 
-        static type
-        call(Elements const&)
+        typedef char_class<tag> result_type;
+        result_type operator()(unused_type, unused_type) const
         {
-            return type(fusion::nil());
+            return result_type();
         }
     };
 }}}
Modified: trunk/boost/spirit/home/qi/char/char_parser.hpp
==============================================================================
--- trunk/boost/spirit/home/qi/char/char_parser.hpp	(original)
+++ trunk/boost/spirit/home/qi/char/char_parser.hpp	2009-04-26 10:42:24 EDT (Sun, 26 Apr 2009)
@@ -1,5 +1,5 @@
 /*=============================================================================
-    Copyright (c) 2001-2007 Joel de Guzman
+    Copyright (c) 2001-2009 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)
@@ -7,41 +7,65 @@
 #if !defined(BOOST_SPIRIT_CHAR_PARSER_APR_16_2006_0906AM)
 #define BOOST_SPIRIT_CHAR_PARSER_APR_16_2006_0906AM
 
-#include <string>
-#include <boost/spirit/home/qi/skip.hpp>
+#if defined(_MSC_VER)
+#pragma once
+#endif
+
+#include <boost/spirit/home/qi/domain.hpp>
+#include <boost/spirit/home/qi/parser.hpp>
 #include <boost/spirit/home/qi/detail/assign_to.hpp>
+#include <boost/spirit/home/qi/meta_compiler.hpp>
+#include <boost/spirit/home/qi/skip_over.hpp>
 #include <boost/spirit/home/support/unused.hpp>
-#include <boost/fusion/include/at.hpp>
+#include <boost/spirit/home/support/info.hpp>
+
+namespace boost { namespace spirit
+{
+    ///////////////////////////////////////////////////////////////////////////
+    // Enablers
+    ///////////////////////////////////////////////////////////////////////////
+    template <>
+    struct use_operator<qi::domain, proto::tag::complement> // enables ~
+      : mpl::true_ {};
+}}
+
+namespace boost { namespace spirit { namespace traits // classification
+{
+    namespace detail
+    {
+        BOOST_MPL_HAS_XXX_TRAIT_DEF(char_parser_id)
+    }
 
-#include <boost/detail/iterator.hpp> // for boost::detail::iterator_traits
+    template <typename T>
+    struct is_char_parser : detail::has_char_parser_id<T> {};
+}}}
 
 namespace boost { namespace spirit { namespace qi
 {
-    template <typename Derived, typename Char = unused_type>
-    struct char_parser
+    ///////////////////////////////////////////////////////////////////////////
+    // The base char_parser
+    ///////////////////////////////////////////////////////////////////////////
+    template <typename Derived, typename Char, typename Attr = Char>
+    struct char_parser : primitive_parser<Derived>
     {
         typedef Char char_type;
+        struct char_parser_id;
 
-        // if Char is unused_type, Derived must supply its own attribute metafunction
-        template <typename Component, typename Context, typename Iterator>
+        // if Char is unused_type, Derived must supply its own attribute
+        // metafunction
+        template <typename Context, typename Iterator>
         struct attribute
         {
-            typedef Char type;
+            typedef Attr type;
         };
 
-        template <
-            typename Component
-          , typename Iterator, typename Context
-          , typename Skipper, typename Attribute>
-        static bool parse(
-            Component const& component
-          , Iterator& first, Iterator const& last
-          , Context& context, Skipper const& skipper
-          , Attribute& attr)
+        template <typename Iterator, typename Context, typename Skipper, typename Attribute>
+        bool parse(Iterator& first, Iterator const& last
+          , Context& context, Skipper const& skipper, Attribute& attr) const
         {
-            qi::skip(first, last, skipper);
+            qi::skip_over(first, last, skipper);
 
-            if (first != last && Derived::test(component, *first, context))
+            if (first != last && this->derived().test(*first, context))
             {
                 qi::detail::assign_to(*first, attr);
                 ++first;
@@ -50,31 +74,82 @@
             return false;
         }
 
-        // char_parser subclasses are required to
-        // implement test:
-
-        template <typename Component, typename CharParam, typename Context>
-        bool test(Component const& component, CharParam ch, Context& context);
+        // Requirement: p.test(ch, context) -> bool
+        //
+        //  ch:         character being parsed
+        //  context:    enclosing rule context
     };
 
+    ///////////////////////////////////////////////////////////////////////////
+    // negated_char_parser handles ~cp expressions (cp is a char_parser)
+    ///////////////////////////////////////////////////////////////////////////
     template <typename Positive>
     struct negated_char_parser :
-        char_parser<
-            negated_char_parser<Positive>, typename Positive::director::char_type
-        >
+        char_parser<negated_char_parser<Positive>, typename Positive::char_type>
     {
-        template <typename Component, typename CharParam, typename Context>
-        static bool test(Component const& component, CharParam ch, Context& context)
+        negated_char_parser(Positive const& positive)
+          : positive(positive) {}
+
+        template <typename CharParam, typename Context>
+        bool test(CharParam ch, Context& context) const
         {
-            return !Positive::director::test(
-                fusion::at_c<0>(component.elements), ch, context);
+            return !positive.test(ch, context);
         }
 
-        template <typename Component, typename Context>
-        static std::string what(Component const& component, Context const& ctx)
+        template <typename Context>
+        info what(Context& context) const
+        {
+            return info("not", positive.what(context));
+        }
+
+        Positive positive;
+    };
+
+    ///////////////////////////////////////////////////////////////////////////
+    // Parser generators: make_xxx function (objects)
+    ///////////////////////////////////////////////////////////////////////////
+    namespace detail
+    {
+        template <typename Positive>
+        struct make_negated_char_parser
+        {
+            typedef negated_char_parser<Positive> result_type;
+            result_type operator()(Positive const& positive) const
+            {
+                return result_type(positive);
+            }
+        };
+
+        template <typename Positive>
+        struct make_negated_char_parser<negated_char_parser<Positive> >
+        {
+            typedef Positive result_type;
+            result_type operator()(negated_char_parser<Positive> const& ncp) const
+            {
+                return ncp.positive;
+            }
+        };
+    }
+
+    template <typename Elements, typename Modifiers>
+    struct make_composite<proto::tag::complement, Elements, Modifiers>
+    {
+        typedef typename
+            fusion::result_of::value_at_c<Elements, 0>::type
+        subject;
+
+        BOOST_MPL_ASSERT_MSG((
+            traits::is_char_parser<subject>::value
+        ), subject_is_not_negatable, (subject));
+
+        typedef typename
+            detail::make_negated_char_parser<subject>::result_type
+        result_type;
+
+        result_type operator()(Elements const& elements, unused_type) const
         {
-            return std::string("not ")
-                + Positive::director::what(fusion::at_c<0>(component.elements), ctx);
+            return detail::make_negated_char_parser<subject>()(
+                fusion::at_c<0>(elements));
         }
     };
 }}}
Modified: trunk/boost/spirit/home/qi/char/detail/basic_chset.hpp
==============================================================================
--- trunk/boost/spirit/home/qi/char/detail/basic_chset.hpp	(original)
+++ trunk/boost/spirit/home/qi/char/detail/basic_chset.hpp	2009-04-26 10:42:24 EDT (Sun, 26 Apr 2009)
@@ -1,6 +1,6 @@
 /*=============================================================================
-    Copyright (c) 2001-2008 Joel de Guzman
-    Copyright (c) 2001-2003 Daniel Nuffer
+    Copyright (c) 2001-2009 Joel de Guzman
+    Copyright (c) 2001-2009 Daniel Nuffer
     http://spirit.sourceforge.net/
 
   Distributed under the Boost Software License, Version 1.0. (See accompanying
@@ -9,6 +9,10 @@
 #ifndef BOOST_SPIRIT_BASIC_CHSET_APRIL_17_2008
 #define BOOST_SPIRIT_BASIC_CHSET_APRIL_17_2008
 
+#if defined(_MSC_VER)
+#pragma once
+#endif
+
 ///////////////////////////////////////////////////////////////////////////////
 #include <bitset>
 #include <boost/spirit/home/qi/char/detail/range_run.hpp>
Deleted: trunk/boost/spirit/home/qi/char/detail/get_char.hpp
==============================================================================
--- trunk/boost/spirit/home/qi/char/detail/get_char.hpp	2009-04-26 10:42:24 EDT (Sun, 26 Apr 2009)
+++ (empty file)
@@ -1,36 +0,0 @@
-/*=============================================================================
-    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_GET_CHAR_APR_20_2008_0618_PM)
-#define BOOST_SPIRIT_GET_CHAR_APR_20_2008_0618_PM
-
-#include <string>
-
-namespace boost { namespace spirit { namespace qi { namespace detail
-{
-    // utility to get the (first) character from a primitive char,
-    // a null terminated string and a std::basic_string
-
-    template <typename Char>
-    static Char get_char(Char ch)
-    {
-        return ch;
-    }
-
-    template <typename Char>
-    static Char get_char(Char const* str)
-    {
-        return *str;
-    }
-
-    template <typename Char>
-    static Char get_char(std::basic_string<Char> const& str)
-    {
-        return str[0];
-    }
-}}}}
-
-#endif
Modified: trunk/boost/spirit/home/qi/char/detail/range.hpp
==============================================================================
--- trunk/boost/spirit/home/qi/char/detail/range.hpp	(original)
+++ trunk/boost/spirit/home/qi/char/detail/range.hpp	2009-04-26 10:42:24 EDT (Sun, 26 Apr 2009)
@@ -1,5 +1,5 @@
 /*=============================================================================
-    Copyright (c) 2001-2007 Joel de Guzman
+    Copyright (c) 2001-2009 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)
@@ -7,6 +7,10 @@
 #if !defined(BOOST_SPIRIT_RANGE_MAY_16_2006_0720_PM)
 #define BOOST_SPIRIT_RANGE_MAY_16_2006_0720_PM
 
+#if defined(_MSC_VER)
+#pragma once
+#endif
+
 namespace boost { namespace spirit { namespace qi { namespace detail
 {
     ///////////////////////////////////////////////////////////////////////////
@@ -17,15 +21,8 @@
     {
         typedef T value_type;
 
-        range()
-            : first(), last()
-        {
-        }
-
-        range(T first, T last)
-            : first(first), last(last)
-        {
-        }
+        range() : first(), last() {}
+        range(T first, T last) : first(first), last(last) {}
 
         T first;
         T last;
Modified: trunk/boost/spirit/home/qi/char/detail/range_functions.hpp
==============================================================================
--- trunk/boost/spirit/home/qi/char/detail/range_functions.hpp	(original)
+++ trunk/boost/spirit/home/qi/char/detail/range_functions.hpp	2009-04-26 10:42:24 EDT (Sun, 26 Apr 2009)
@@ -1,5 +1,5 @@
 /*=============================================================================
-    Copyright (c) 2001-2007 Joel de Guzman
+    Copyright (c) 2001-2009 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)
@@ -7,6 +7,10 @@
 #if !defined(BOOST_SPIRIT_RANGE_FUNCTIONS_MAY_16_2006_0720_PM)
 #define BOOST_SPIRIT_RANGE_FUNCTIONS_MAY_16_2006_0720_PM
 
+#if defined(_MSC_VER)
+#pragma once
+#endif
+
 #include <boost/integer_traits.hpp>
 
 namespace boost { namespace spirit { namespace qi { namespace detail
Modified: trunk/boost/spirit/home/qi/char/detail/range_run.hpp
==============================================================================
--- trunk/boost/spirit/home/qi/char/detail/range_run.hpp	(original)
+++ trunk/boost/spirit/home/qi/char/detail/range_run.hpp	2009-04-26 10:42:24 EDT (Sun, 26 Apr 2009)
@@ -1,5 +1,5 @@
 /*=============================================================================
-    Copyright (c) 2001-2007 Joel de Guzman
+    Copyright (c) 2001-2009 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)
@@ -7,6 +7,10 @@
 #if !defined(BOOST_SPIRIT_RANGE_RUN_MAY_16_2006_0801_PM)
 #define BOOST_SPIRIT_RANGE_RUN_MAY_16_2006_0801_PM
 
+#if defined(_MSC_VER)
+#pragma once
+#endif
+
 #include <boost/spirit/home/qi/char/detail/range.hpp>
 #include <vector>
 
Modified: trunk/boost/spirit/home/qi/char/detail/range_run_impl.hpp
==============================================================================
--- trunk/boost/spirit/home/qi/char/detail/range_run_impl.hpp	(original)
+++ trunk/boost/spirit/home/qi/char/detail/range_run_impl.hpp	2009-04-26 10:42:24 EDT (Sun, 26 Apr 2009)
@@ -1,5 +1,5 @@
 /*=============================================================================
-    Copyright (c) 2001-2007 Joel de Guzman
+    Copyright (c) 2001-2009 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)
@@ -7,6 +7,10 @@
 #if !defined(BOOST_SPIRIT_RANGE_RUN_MAY_16_2006_0807_PM)
 #define BOOST_SPIRIT_RANGE_RUN_MAY_16_2006_0807_PM
 
+#if defined(_MSC_VER)
+#pragma once
+#endif
+
 #include <boost/spirit/home/qi/char/detail/range_functions.hpp>
 #include <boost/assert.hpp>
 #include <boost/integer_traits.hpp>
Deleted: trunk/boost/spirit/home/qi/char/meta_grammar.hpp
==============================================================================
--- trunk/boost/spirit/home/qi/char/meta_grammar.hpp	2009-04-26 10:42:24 EDT (Sun, 26 Apr 2009)
+++ (empty file)
@@ -1,396 +0,0 @@
-/*=============================================================================
-    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_META_GRAMMAR_FEB_02_2007_0925AM)
-#define BOOST_SPIRIT_META_GRAMMAR_FEB_02_2007_0925AM
-
-#include <boost/spirit/home/qi/domain.hpp>
-#include <boost/spirit/home/support/placeholders.hpp>
-#include <boost/spirit/home/support/meta_grammar.hpp>
-#include <boost/spirit/home/support/char_class.hpp>
-#include <boost/spirit/home/qi/char/detail/basic_chset.hpp>
-#include <boost/utility/enable_if.hpp>
-#include <boost/type_traits/is_same.hpp>
-#include <boost/shared_ptr.hpp>
-
-namespace boost { namespace spirit { namespace qi
-{
-    ///////////////////////////////////////////////////////////////////////////
-    // forwards
-    ///////////////////////////////////////////////////////////////////////////
-    template <typename Char>
-    struct any_char;
-
-    template <typename Char>
-    struct literal_char;
-
-    struct lazy_char;
-
-    template <typename Char>
-    struct char_range;
-
-    struct lazy_char_range;
-
-    template <typename Positive>
-    struct negated_char_parser;
-
-    template <typename Tag>
-    struct char_class;
-
-    struct char_meta_grammar;
-
-    ///////////////////////////////////////////////////////////////////////////
-    template <typename Expr, typename Enable>
-    struct is_valid_expr;
-
-    template <typename Expr, typename Enable>
-    struct expr_transform;
-
-    ///////////////////////////////////////////////////////////////////////////
-    //  get the director of an any_char
-    ///////////////////////////////////////////////////////////////////////////
-    template <typename Tag>
-    struct extract_any_char_director;
-
-    template <>
-    struct extract_any_char_director<tag::char_>
-    {
-        typedef any_char<char> type;
-    };
-
-    template <>
-    struct extract_any_char_director<tag::wchar>
-    {
-        typedef any_char<wchar_t> type;
-    };
-
-    ///////////////////////////////////////////////////////////////////////////
-    // get the director of a character literal type
-    ///////////////////////////////////////////////////////////////////////////
-    template <typename Tag, typename T>
-    struct extract_literal_char_director;
-
-    template <typename T>
-    struct extract_literal_char_director<tag::char_, T>
-    {
-        typedef literal_char<T> type;
-    };
-
-    template <typename T>
-    struct extract_literal_char_director<tag::wchar, T>
-    {
-        typedef literal_char<wchar_t> type;
-    };
-
-    template <typename T>
-    struct extract_literal_char_director<tag::lit, T>
-    {
-        typedef literal_char<T> type;
-    };
-
-    template <typename T>
-    struct extract_literal_char_director<tag::wlit, T>
-    {
-        typedef literal_char<wchar_t> type;
-    };
-
-    ///////////////////////////////////////////////////////////////////////////
-    // get the director of a character range type
-    ///////////////////////////////////////////////////////////////////////////
-    template <typename Tag, typename T>
-    struct extract_char_range_director;
-
-    template <typename T>
-    struct extract_char_range_director<tag::char_, T>
-    {
-        typedef char_range<T> type;
-    };
-
-    template <typename T>
-    struct extract_char_range_director<tag::wchar, T>
-    {
-        typedef char_range<wchar_t> type;
-    };
-
-    ///////////////////////////////////////////////////////////////////////////
-    // char parser meta-grammars
-    ///////////////////////////////////////////////////////////////////////////
-
-    // literals: 'x', L'x'
-    struct basic_char_literal_meta_grammar
-      : proto::or_<
-            proto::terminal<char>
-          , proto::terminal<wchar_t>
-        >
-    {
-    };
-
-
-    // literals: 'x', L'x' and single char strings: "x", L"x"
-    struct single_char_literal_meta_grammar
-      : proto::or_<
-        // plain chars:
-            proto::terminal<char>
-          , proto::terminal<wchar_t>
-        // single char null terminates strings:
-          , proto::terminal<char[2]>
-          , proto::terminal<char(&)[2]>
-          , proto::terminal<wchar_t[2]>
-          , proto::terminal<wchar_t(&)[2]>
-        >
-    {
-    };
-
-    // literals: 'x', L'x'
-    struct char_literal_meta_grammar
-      : proto::or_<
-            meta_grammar::terminal_rule<
-                qi::domain, char, literal_char<char>
-            >
-          , meta_grammar::terminal_rule<
-                qi::domain, wchar_t, literal_char<wchar_t>
-            >
-        >
-    {
-    };
-
-    // literal strings: "hello" (defined in qi/string/meta_grammar.hpp)
-    struct basic_string_literal_meta_grammar;
-
-    // std::string(s) (defined in qi/string/meta_grammar.hpp)
-    struct basic_std_string_meta_grammar;
-
-    template <typename T>
-    struct extract_char; // (defined in qi/string/metagrammar.hpp)
-
-    template <typename Tag, typename T>
-    struct extract_chset_director;
-
-    template <typename T>
-    struct extract_chset_director<tag::char_, T>
-    {
-        typedef typename extract_char<T>::type char_type;
-        typedef char_set<char_type> type;
-    };
-
-    template <typename T>
-    struct extract_chset_director<tag::wchar, T>
-    {
-        typedef typename extract_char<T>::type char_type;
-        typedef char_set<char_type> type;
-    };
-
-    template <typename Char, typename Elements>
-    struct char_set_component
-    {
-        typedef qi::domain domain;
-        typedef char_set<Char> director;
-        typedef Elements elements_type;
-
-        char_set_component(Char const* definition)
-          : ptr(new detail::basic_chset<Char>())
-        {
-            Char ch = *definition++;
-            while (ch)
-            {
-                Char next = *definition++;
-                if (next == '-')
-                {
-                    next = *definition++;
-                    if (next == 0)
-                    {
-                        ptr->set(ch);
-                        ptr->set('-');
-                        break;
-                    }
-                    ptr->set(ch, next);
-                }
-                else
-                {
-                    ptr->set(ch);
-                }
-                ch = next;
-            }
-        }
-
-        template <typename CharSetClass> // no-case version
-        char_set_component(Char const* definition, CharSetClass)
-          : ptr(new detail::basic_chset<Char>())
-        {
-            Char ch = *definition++;
-            while (ch)
-            {
-                Char next = *definition++;
-                if (next == '-')
-                {
-                    next = *definition++;
-                    if (next == 0)
-                    {
-                        ptr->set(CharSetClass::tolower(ch));
-                        ptr->set(CharSetClass::tolower('-'));
-                        ptr->set(CharSetClass::toupper(ch));
-                        ptr->set(CharSetClass::toupper('-'));
-                        break;
-                    }
-                    ptr->set(CharSetClass::tolower(ch)
-                      , CharSetClass::tolower(next));
-                    ptr->set(CharSetClass::toupper(ch)
-                      , CharSetClass::toupper(next));
-                }
-                else
-                {
-                    ptr->set(CharSetClass::tolower(ch));
-                    ptr->set(CharSetClass::toupper(ch));
-                }
-                ch = next;
-            }
-        }
-
-        boost::shared_ptr<detail::basic_chset<Char> > ptr;
-    };
-
-    // char_, char_('x'), char_("x"), char_(f), char_('x', 'z'),
-    // char_(L'x'), char_(L'x', L'z'),
-    // wchar, wchar('x'), wchar("x"), wchar('x', 'z'),
-    // wchar(L'x'), wchar(L'x', L'z')
-    // char_("a-z"), wchar("a-z")
-    // [w]lit('x'), [w]lit(L'x')
-    struct char_meta_grammar1
-      : proto::or_<
-            // char_, wchar --> any_char
-            meta_grammar::compose_empty<
-                proto::if_<
-                    is_char_tag<proto::_child, qi::domain>()
-                >
-              , qi::domain
-              , mpl::identity<extract_any_char_director<mpl::_> >
-            >
-            // char_('x'), wchar(L'x'), char_("x"), wchar(L"x")--> literal_char
-          , meta_grammar::compose_function1_eval<
-                proto::function<
-                    proto::if_<
-                        is_char_tag<proto::_child, qi::domain>()
-                    >
-                  , single_char_literal_meta_grammar
-                >
-              , qi::domain
-              , mpl::identity<extract_literal_char_director<mpl::_, mpl::_> >
-            >
-            // lit("x"), wlit(L"x") --> literal_char
-          , meta_grammar::compose_function1_eval<
-                proto::function<
-                    proto::if_<
-                        is_lit_tag<proto::_child, qi::domain>()
-                    >
-                  , basic_char_literal_meta_grammar
-                >
-              , qi::domain
-              , mpl::identity<extract_literal_char_director<mpl::_, mpl::_> >
-            >
-            // char_("a-z"), char_(L"a-z"), wchar(L"a-z") --> char_set
-          , meta_grammar::compose_function1_eval<
-                proto::function<
-                    proto::if_<
-                        is_char_tag<proto::_child, qi::domain>()>
-                  , proto::or_<basic_string_literal_meta_grammar, basic_std_string_meta_grammar>
-                >
-              , qi::domain
-              , mpl::identity<extract_chset_director<mpl::_, mpl::_> >
-            >
-            // char_(F()) --> lazy_char
-          , meta_grammar::function1_rule<
-                qi::domain
-              , tag::char_
-              , lazy_char
-            >
-            // char_('x', 'z'), wchar(L'x', L'z') --> char_range
-          , meta_grammar::compose_function2_eval<
-                proto::function<
-                    proto::if_<
-                        is_char_tag<proto::_child, qi::domain>()
-                    >
-                  , basic_char_literal_meta_grammar
-                  , basic_char_literal_meta_grammar
-                >
-              , qi::domain
-              , mpl::identity<extract_char_range_director<mpl::_, mpl::_> >
-            >
-            // char_(F1(), F2()) --> lazy_char_range
-          , meta_grammar::function2_rule<
-                qi::domain
-              , tag::char_
-              , lazy_char_range
-            >
-        >
-    {
-    };
-
-    // char_classes: alnum, alpha, cntrl, ... etc.
-    struct char_class_meta_grammar
-      : proto::or_<
-            // alnum, alpha, cntrl, ... etc.
-            meta_grammar::compose_empty<
-                proto::terminal<spirit::char_class::key<proto::_, proto::_> >
-              , qi::domain
-              , char_class<mpl::_>
-            >
-          , meta_grammar::compose_empty<
-                proto::terminal<spirit::char_class::lower_case_tag<proto::_> >
-              , qi::domain
-              , char_class<mpl::_>
-            >
-          , meta_grammar::compose_empty<
-                proto::terminal<spirit::char_class::upper_case_tag<proto::_> >
-              , qi::domain
-              , char_class<mpl::_>
-            >
-        >
-    {};
-
-    // ~x (where x is a char_parser)
-    struct negated_char_meta_grammar
-      : meta_grammar::compose_single<
-            proto::unary_expr<
-                proto::tag::complement
-              , char_meta_grammar
-            >
-          , qi::domain
-          , negated_char_parser<mpl::_>
-        >
-    {
-    };
-
-    // main char_meta_grammar
-    struct char_meta_grammar
-      : proto::or_<
-            char_meta_grammar1
-          , char_class_meta_grammar
-          , char_literal_meta_grammar
-          , negated_char_meta_grammar
-        >
-    {
-    };
-
-    ///////////////////////////////////////////////////////////////////////////
-    //  These specializations non-intrusively hooks into the RD meta-grammar.
-    //  (see qi/meta_grammar.hpp)
-    ///////////////////////////////////////////////////////////////////////////
-    template <typename Expr>
-    struct is_valid_expr<Expr
-      , typename enable_if<proto::matches<Expr, char_meta_grammar> >::type>
-      : mpl::true_
-    {
-    };
-
-    template <typename Expr>
-    struct expr_transform<Expr
-      , typename enable_if<proto::matches<Expr, char_meta_grammar> >::type>
-      : mpl::identity<char_meta_grammar>
-    {
-    };
-}}}
-
-#endif
Deleted: trunk/boost/spirit/home/qi/debug.hpp
==============================================================================
--- trunk/boost/spirit/home/qi/debug.hpp	2009-04-26 10:42:24 EDT (Sun, 26 Apr 2009)
+++ (empty file)
@@ -1,17 +0,0 @@
-/*=============================================================================
-    Copyright (c) 2001-2009 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_DEBUG_NOV_12_2007_0827AM)
-#define BOOST_SPIRIT_DEBUG_NOV_12_2007_0827AM
-
-#if defined(BOOST_SPIRIT_DEBUG)
-#include <boost/spirit/home/qi/debug/simple_debug_macros.hpp>
-#include <boost/spirit/home/qi/debug/simple_debug.hpp>
-#else
-#include <boost/spirit/home/qi/debug/minimal_macros.hpp>
-#endif 
-
-#endif
Modified: trunk/boost/spirit/home/qi/detail/alternative_function.hpp
==============================================================================
--- trunk/boost/spirit/home/qi/detail/alternative_function.hpp	(original)
+++ trunk/boost/spirit/home/qi/detail/alternative_function.hpp	2009-04-26 10:42:24 EDT (Sun, 26 Apr 2009)
@@ -4,16 +4,29 @@
     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(SPIRIT_ALTERNATIVE_FUNCTION_APR_23_2007_1046AM)
-#define SPIRIT_ALTERNATIVE_FUNCTION_APR_23_2007_1046AM
+#if !defined(SPIRIT_ALTERNATIVE_FUNCTION_APRIL_23_2007_1046AM)
+#define SPIRIT_ALTERNATIVE_FUNCTION_APRIL_23_2007_1046AM
+
+#if defined(_MSC_VER)
+#pragma once
+#endif
 
 #include <boost/spirit/home/qi/domain.hpp>
 #include <boost/spirit/home/support/unused.hpp>
-#include <boost/spirit/home/support/attribute_of.hpp>
+#include <boost/spirit/home/support/attributes.hpp>
 #include <boost/variant.hpp>
+#include <boost/mpl/bool.hpp>
 
 namespace boost { namespace spirit { namespace qi { namespace detail
 {
+    template <typename T>
+    struct not_is_variant
+      : mpl::true_ {};
+
+    template <BOOST_VARIANT_ENUM_PARAMS(typename T)>
+    struct not_is_variant<boost::variant<BOOST_VARIANT_ENUM_PARAMS(T)> >
+      : mpl::false_ {};
+
     template <typename Iterator, typename Context, typename Skipper,
         typename Attribute>
     struct alternative_function
@@ -27,16 +40,19 @@
         }
 
         template <typename Component>
-        bool operator()(Component const& component)
+        bool call(Component const& component, mpl::true_) const
         {
-            // return true if the parser succeeds
-            typedef typename Component::director director;
-            typename
-                traits::attribute_of<
-                    qi::domain, Component, Context, Iterator>::type
-            val;
+            // if Attribute is not a variant, then pass it as-is
+            return component.parse(first, last, context, skipper, attr);
+        }
 
-            if (director::parse(component, first, last, context, skipper, val))
+        template <typename Component>
+        bool call(Component const& component, mpl::false_) const
+        {
+            // if Attribute is a variant, then create an attribute for
+            // the Component with its expected type.
+            typename traits::attribute_of<Component, Context, Iterator>::type val;
+            if (component.parse(first, last, context, skipper, val))
             {
                 attr = val;
                 return true;
@@ -44,6 +60,13 @@
             return false;
         }
 
+        template <typename Component>
+        bool operator()(Component const& component) const
+        {
+            // return true if the parser succeeds
+            return call(component, not_is_variant<Attribute>());
+        }
+
         Iterator& first;
         Iterator const& last;
         Context& context;
@@ -65,8 +88,7 @@
         bool operator()(Component const& component)
         {
             // return true if the parser succeeds
-            typedef typename Component::director director;
-            return director::parse(component, first, last, context, skipper,
+            return component.parse(first, last, context, skipper,
                 unused);
         }
 
Modified: trunk/boost/spirit/home/qi/detail/assign_to.hpp
==============================================================================
--- trunk/boost/spirit/home/qi/detail/assign_to.hpp	(original)
+++ trunk/boost/spirit/home/qi/detail/assign_to.hpp	2009-04-26 10:42:24 EDT (Sun, 26 Apr 2009)
@@ -1,5 +1,5 @@
 /*=============================================================================
-    Copyright (c) 2001-2007 Joel de Guzman
+    Copyright (c) 2001-2009 Joel de Guzman
     Copyright (c) 2001-2009 Hartmut Kaiser
     http://spirit.sourceforge.net/
 
@@ -9,54 +9,58 @@
 #if !defined(BOOST_SPIRIT_ASSIGN_TO_APR_16_2006_0812PM)
 #define BOOST_SPIRIT_ASSIGN_TO_APR_16_2006_0812PM
 
-#include <boost/spirit/home/qi/detail/construct_fwd.hpp>
+#if defined(_MSC_VER)
+#pragma once
+#endif
+
+#include <boost/spirit/home/qi/detail/construct.hpp>
 #include <boost/spirit/home/support/unused.hpp>
 #include <boost/ref.hpp>
 
 namespace boost { namespace spirit { namespace qi { namespace detail
 {
-    namespace construct_ 
+    namespace construct_
     {
         ///////////////////////////////////////////////////////////////////////
-        //  This is used to allow to overload of the attribute creation for 
+        //  This is used to allow to overload of the attribute creation for
         //  arbitrary types
         ///////////////////////////////////////////////////////////////////////
         template <typename Attribute, typename Iterator>
-        inline void 
+        inline void
         construct(Attribute& attr, Iterator const& first, Iterator const& last)
         {
             attr = Attribute(first, last);
         }
-        
+
         template <typename Attribute, typename T>
-        inline void 
+        inline void
         construct(Attribute& attr, T const& val)
         {
             attr = val;
         }
-        
+
         template <typename Attribute, typename T>
-        inline void 
+        inline void
         construct(Attribute& attr, T& val)
         {
             attr = val;
         }
 
         template <typename Attribute, typename T>
-        inline void 
+        inline void
         construct(reference_wrapper<Attribute> attr, T const& val)
         {
             attr = val;
         }
-        
+
         template <typename Attribute, typename T>
-        inline void 
+        inline void
         construct(reference_wrapper<Attribute> attr, T& val)
         {
             attr = val;
         }
     }
-    
+
     ///////////////////////////////////////////////////////////////////////////
     //  This file contains assignment utilities. The utilities provided also
     //  accept spirit's unused_type; all no-ops. Compiler optimization will
Modified: trunk/boost/spirit/home/qi/detail/construct.hpp
==============================================================================
--- trunk/boost/spirit/home/qi/detail/construct.hpp	(original)
+++ trunk/boost/spirit/home/qi/detail/construct.hpp	2009-04-26 10:42:24 EDT (Sun, 26 Apr 2009)
@@ -1,17 +1,25 @@
-//  Copyright (c) 2001-2009 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)
-
+/*=============================================================================
+    Copyright (c) 2001-2009 Hartmut Kaiser
+    http://spirit.sourceforge.net/
+
+    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_CONSTRUCT_MAR_24_2007_0629PM)
 #define BOOST_SPIRIT_CONSTRUCT_MAR_24_2007_0629PM
 
-#if defined(_MSC_VER) && (_MSC_VER >= 1020)
-#pragma once      // MS compatible compilers support #pragma once
+#if defined(_MSC_VER)
+#pragma once
 #endif
 
 #include <boost/spirit/home/qi/parse.hpp>
-#include <boost/spirit/home/qi/numeric.hpp>
+#include <boost/spirit/home/support/common_terminals.hpp>
+
+namespace boost { namespace spirit { namespace qi
+{
+    template <typename Iterator, typename Expr, typename Attr>
+    bool parse(Iterator& first, Iterator last, Expr const& expr, Attr& attr);
+}}}
 
 namespace boost { namespace spirit { namespace qi { namespace detail
 {
@@ -42,7 +50,7 @@
             Iterator const& last)
         {
             Iterator first_ = first;
-            parse(first_, last, ushort, attr);
+            parse(first_, last, ushort_, attr);
         }
 #else
         // is wchar_t is not an intrinsic type, treat wchar_t only
@@ -91,7 +99,7 @@
             Iterator const& last)
         {
             Iterator first_ = first;
-            parse(first_, last, ulong, attr);
+            parse(first_, last, ulong_, attr);
         }
 
 #ifdef BOOST_HAS_LONG_LONG
@@ -138,7 +146,7 @@
             parse(first_, last, long_double, attr);
         }
     }
-    
+
 }}}}
 
 #endif
Deleted: trunk/boost/spirit/home/qi/detail/construct_fwd.hpp
==============================================================================
--- trunk/boost/spirit/home/qi/detail/construct_fwd.hpp	2009-04-26 10:42:24 EDT (Sun, 26 Apr 2009)
+++ (empty file)
@@ -1,91 +0,0 @@
-//  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_CONSTRUCT_FWD_MAY_29_2008_0318PM)
-#define BOOST_SPIRIT_CONSTRUCT_FWD_MAR_29_2008_0318PM
-
-#if defined(_MSC_VER) && (_MSC_VER >= 1020)
-#pragma once      // MS compatible compilers support #pragma once
-#endif
-
-namespace boost { namespace spirit { namespace qi { namespace detail
-{
-    namespace construct_
-    {
-        ///////////////////////////////////////////////////////////////////////
-        //  Forward declarations of overloads for the construct customization 
-        //  point for all built in types
-        ///////////////////////////////////////////////////////////////////////
-        template <typename Iterator>
-        inline void
-        construct(char& attr, Iterator const& first, Iterator const& last);
-
-#if !defined(BOOST_NO_INTRINSIC_WCHAR_T)
-        // wchar_t is intrinsic
-        template <typename Iterator>
-        inline void
-        construct(wchar_t& attr, Iterator const& first, Iterator const& last);
-
-        template <typename Iterator>
-        inline void
-        construct(unsigned short& attr, Iterator const& first, Iterator const& last);
-#else
-        // is wchar_t is not an intrinsic type, treat wchar_t only
-        template <typename Iterator>
-        inline void
-        construct(wchar_t& attr, Iterator const& first, Iterator const& last);
-#endif
-
-        template <typename Iterator>
-        inline void
-        construct(short& attr, Iterator const& first, Iterator const& last);
-
-        template <typename Iterator>
-        inline void
-        construct(int& attr, Iterator const& first, Iterator const& last);
-
-        template <typename Iterator>
-        inline void
-        construct(unsigned int& attr, Iterator const& first, 
-            Iterator const& last);
-
-        template <typename Iterator>
-        inline void
-        construct(long& attr, Iterator const& first, Iterator const& last);
-
-        template <typename Iterator>
-        inline void
-        construct(unsigned long& attr, Iterator const& first, 
-            Iterator const& last);
-
-#ifdef BOOST_HAS_LONG_LONG
-        template <typename Iterator>
-        inline void
-        construct(boost::long_long_type& attr, Iterator const& first, 
-            Iterator const& last);
-
-        template <typename Iterator>
-        inline void
-        construct(boost::ulong_long_type& attr, Iterator const& first, 
-            Iterator const& last);
-#endif
-
-        template <typename Iterator>
-        inline void
-        construct(float& attr, Iterator const& first, Iterator const& last);
-
-        template <typename Iterator>
-        inline void
-        construct(double& attr, Iterator const& first, Iterator const& last);
-
-        template <typename Iterator>
-        inline void
-        construct(long double& attr, Iterator const& first, 
-            Iterator const& last);
-    }
-    
-}}}}
-
-#endif
Modified: trunk/boost/spirit/home/qi/detail/expect_function.hpp
==============================================================================
--- trunk/boost/spirit/home/qi/detail/expect_function.hpp	(original)
+++ trunk/boost/spirit/home/qi/detail/expect_function.hpp	2009-04-26 10:42:24 EDT (Sun, 26 Apr 2009)
@@ -1,5 +1,5 @@
 /*=============================================================================
-    Copyright (c) 2001-2007 Joel de Guzman
+    Copyright (c) 2001-2009 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)
@@ -16,6 +16,9 @@
       , typename Skipper, typename Exception>
     struct expect_function
     {
+        typedef Iterator iterator_type;
+        typedef Context context_type;
+
         expect_function(
             Iterator& first, Iterator const& last
           , Context& context, Skipper const& skipper)
@@ -28,20 +31,19 @@
         }
 
         template <typename Component, typename Attribute>
-        bool operator()(Component const& component, Attribute& attr)
+        bool operator()(Component const& component, Attribute& attr) const
         {
             // if we are testing the first component in the sequence,
             // return true if the parser fails, if this not the first
             // component, throw exception if the parser fails
-            typedef typename Component::director director;
-            if (!director::parse(component, first, last, context, skipper, attr))
+            if (!component.parse(first, last, context, skipper, attr))
             {
                 if (is_first)
                 {
                     is_first = false;
                     return true;
                 }
-                Exception x = {first, last, director::what(component, context) };
+                Exception x = { first, last, component.what(context) };
                 throw x;
             }
             is_first = false;
@@ -49,20 +51,19 @@
         }
 
         template <typename Component>
-        bool operator()(Component const& component)
+        bool operator()(Component const& component) const
         {
             // if we are testing the first component in the sequence,
             // return true if the parser fails, if this not the first
             // component, throw exception if the parser fails
-            typedef typename Component::director director;
-            if (!director::parse(component, first, last, context, skipper, unused))
+            if (!component.parse(first, last, context, skipper, unused))
             {
                 if (is_first)
                 {
                     is_first = false;
                     return true;
                 }
-                Exception x = {first, last, director::what(component, context) };
+                Exception x = { first, last, component.what(context) };
                 throw x;
             }
             is_first = false;
@@ -73,7 +74,7 @@
         Iterator const& last;
         Context& context;
         Skipper const& skipper;
-        bool is_first;
+        mutable bool is_first;
     };
 }}}}
 
Modified: trunk/boost/spirit/home/qi/detail/fail_function.hpp
==============================================================================
--- trunk/boost/spirit/home/qi/detail/fail_function.hpp	(original)
+++ trunk/boost/spirit/home/qi/detail/fail_function.hpp	2009-04-26 10:42:24 EDT (Sun, 26 Apr 2009)
@@ -1,11 +1,15 @@
 /*=============================================================================
-    Copyright (c) 2001-2007 Joel de Guzman
+    Copyright (c) 2001-2009 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(SPIRIT_FAIL_FUNCTION_APR_22_2006_0159PM)
-#define SPIRIT_FAIL_FUNCTION_APR_22_2006_0159PM
+#if !defined(SPIRIT_FAIL_FUNCTION_APRIL_22_2006_0159PM)
+#define SPIRIT_FAIL_FUNCTION_APRIL_22_2006_0159PM
+
+#if defined(_MSC_VER)
+#pragma once
+#endif
 
 #include <boost/spirit/home/support/unused.hpp>
 
@@ -14,6 +18,9 @@
     template <typename Iterator, typename Context, typename Skipper>
     struct fail_function
     {
+        typedef Iterator iterator_type;
+        typedef Context context_type;
+
         fail_function(
             Iterator& first, Iterator const& last
           , Context& context, Skipper const& skipper)
@@ -25,19 +32,17 @@
         }
 
         template <typename Component, typename Attribute>
-        bool operator()(Component const& component, Attribute& attr)
+        bool operator()(Component const& component, Attribute& attr) const
         {
             // return true if the parser fails
-            typedef typename Component::director director;
-            return !director::parse(component, first, last, context, skipper, attr);
+            return !component.parse(first, last, context, skipper, attr);
         }
 
         template <typename Component>
-        bool operator()(Component const& component)
+        bool operator()(Component const& component) const
         {
             // return true if the parser fails
-            typedef typename Component::director director;
-            return !director::parse(component, first, last, context, skipper, unused);
+            return !component.parse(first, last, context, skipper, unused);
         }
 
         Iterator& first;
Added: trunk/boost/spirit/home/qi/detail/pass_container.hpp
==============================================================================
--- (empty file)
+++ trunk/boost/spirit/home/qi/detail/pass_container.hpp	2009-04-26 10:42:24 EDT (Sun, 26 Apr 2009)
@@ -0,0 +1,123 @@
+/*=============================================================================
+    Copyright (c) 2001-2009 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(SPIRIT_PASS_CONTAINER_JANUARY_06_2009_0802PM)
+#define SPIRIT_PASS_CONTAINER_JANUARY_06_2009_0802PM
+
+#if defined(_MSC_VER)
+#pragma once
+#endif
+
+#include <boost/spirit/home/support/attributes.hpp>
+#include <boost/spirit/home/support/container.hpp>
+#include <boost/type_traits/is_base_of.hpp>
+#include <boost/type_traits/is_convertible.hpp>
+#include <boost/mpl/bool.hpp>
+
+namespace boost { namespace spirit { namespace qi { namespace detail
+{
+    // has_same_elements: utility to check if the RHS attribute
+    // is an STL container and that its value_type is convertible
+    // to the LHS.
+
+    template <typename LHS, typename RHSAttribute
+      , bool IsContainer = traits::is_container<RHSAttribute>::value>
+    struct has_same_elements : mpl::false_ {};
+
+    template <typename LHS, typename RHSAttribute>
+    struct has_same_elements<LHS, RHSAttribute, true>
+        : is_convertible<
+            typename RHSAttribute::value_type
+          , LHS> {};
+
+    // This function handles the case where the attribute (Attr) given
+    // the sequence is an STL container. This is a wrapper around F.
+    // The function F does the actual parsing.
+    template <typename F, typename Attr>
+    struct pass_container
+    {
+        pass_container(F const& f, Attr& attr)
+          : f(f), attr(attr) {}
+
+        // this is for the case when the current element exposes an attribute
+        // which is pushed back onto the container
+        template <typename Component>
+        bool dispatch_attribute(Component const& component, mpl::true_) const
+        {
+            typename traits::result_of::value<Attr>::type val;
+            bool r = f(component, val);
+            if (!r)
+            {
+                // push the parsed value into our attribute
+                traits::push_back(attr, val);
+            }
+            return r;
+        }
+
+        // this is for the case when the current element doesn't expect an 
+        // attribute
+        template <typename Component>
+        bool dispatch_attribute(Component const& component, mpl::false_) const
+        {
+            return f(component, unused);
+        }
+
+        // This handles the case where the attribute of the component
+        // is not an STL container or its element is not convertible
+        // to the target attribute's (Attr) value_type.
+        template <typename Component>
+        bool dispatch_main(Component const& component, mpl::false_) const
+        {
+            // we need to dispatch again depending on the type of the attribute
+            // of the current element (component). If this is has no attribute
+            // we shouldn't push an element into the container.
+            typedef typename F::context_type context_type;
+            typedef traits::is_not_unused<
+                typename traits::attribute_of<Component, context_type>::type
+            > predicate;
+
+            return dispatch_attribute(component, predicate());
+        }
+
+        // This handles the case where the attribute of the component is
+        // an STL container *and* its value_type is convertible to the
+        // target attribute's (Attr) value_type.
+        template <typename Component>
+        bool dispatch_main(Component const& component, mpl::true_) const
+        {
+            return f(component, attr);
+        }
+
+        // Dispachtes to dispatch_main depending on the attribute type
+        // of the Component
+        template <typename Component>
+        bool operator()(Component const& component) const
+        {
+            typedef typename traits::result_of::value<Attr>::type lhs;
+            typedef typename F::iterator_type iterator_type;
+            typedef typename F::context_type context_type;
+            typedef typename traits::attribute_of<
+                Component, context_type, iterator_type>::type
+            rhs_attribute;
+
+            return dispatch_main(component
+              , has_same_elements<lhs, rhs_attribute>());
+        }
+
+        F f;
+        Attr& attr;
+    };
+
+    // Utility function to make a pass_container
+    template <typename F, typename Attr>
+    pass_container<F, Attr>
+    inline make_pass_container(F const& f, Attr& attr)
+    {
+        return pass_container<F, Attr>(f, attr);
+    }
+}}}}
+
+#endif
Modified: trunk/boost/spirit/home/qi/detail/pass_function.hpp
==============================================================================
--- trunk/boost/spirit/home/qi/detail/pass_function.hpp	(original)
+++ trunk/boost/spirit/home/qi/detail/pass_function.hpp	2009-04-26 10:42:24 EDT (Sun, 26 Apr 2009)
@@ -1,11 +1,15 @@
 /*=============================================================================
-    Copyright (c) 2001-2007 Joel de Guzman
+    Copyright (c) 2001-2009 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(SPIRIT_PASS_FUNCTION_FEB_05_2007_1138AM)
-#define SPIRIT_PASS_FUNCTION_FEB_05_2007_1138AM
+#if !defined(SPIRIT_PASS_FUNCTION_FEBRUARY_05_2007_1138AM)
+#define SPIRIT_PASS_FUNCTION_FEBRUARY_05_2007_1138AM
+
+#if defined(_MSC_VER)
+#pragma once
+#endif
 
 #include <boost/spirit/home/support/unused.hpp>
 #include <boost/optional.hpp>
@@ -29,17 +33,15 @@
         bool operator()(Component const& component, Attribute& attr)
         {
             // return true if the parser succeeds
-            typedef typename Component::director director;
-            return director::parse(component, first, last, context, skipper, attr);
+            return component.parse(first, last, context, skipper, attr);
         }
 
         template <typename Component, typename Attribute>
         bool operator()(Component const& component, boost::optional<Attribute>& attr)
         {
             // return true if the parser succeeds
-            typedef typename Component::director director;
             Attribute val;
-            if (director::parse(component, first, last, context, skipper, val))
+            if (component.parse(first, last, context, skipper, val))
             {
                 attr = val;
                 return true;
@@ -51,8 +53,7 @@
         bool operator()(Component const& component)
         {
             // return true if the parser succeeds
-            typedef typename Component::director director;
-            return director::parse(component, first, last, context, skipper, unused);
+            return component.parse(first, last, context, skipper, unused);
         }
 
         Iterator& first;
Modified: trunk/boost/spirit/home/qi/detail/permute_function.hpp
==============================================================================
--- trunk/boost/spirit/home/qi/detail/permute_function.hpp	(original)
+++ trunk/boost/spirit/home/qi/detail/permute_function.hpp	2009-04-26 10:42:24 EDT (Sun, 26 Apr 2009)
@@ -1,5 +1,5 @@
 /*=============================================================================
-    Copyright (c) 2001-2007 Joel de Guzman
+    Copyright (c) 2001-2009 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)
@@ -7,6 +7,10 @@
 #if !defined(SPIRIT_PERMUTE_FUNCTION_MARCH_13_2007_1129AM)
 #define SPIRIT_PERMUTE_FUNCTION_MARCH_13_2007_1129AM
 
+#if defined(_MSC_VER)
+#pragma once
+#endif
+
 #include <boost/spirit/home/support/unused.hpp>
 #include <boost/optional.hpp>
 
@@ -29,9 +33,7 @@
         bool operator()(Component const& component, Attribute& attr)
         {
             // return true if the parser succeeds and the slot is not yet taken
-            typedef typename Component::director director;
-            if (!*taken
-                && director::parse(component, first, last, context, skipper, attr))
+            if (!*taken && component.parse(first, last, context, skipper, attr))
             {
                 *taken = true;
                 ++taken;
@@ -45,10 +47,8 @@
         bool operator()(Component const& component, boost::optional<Attribute>& attr)
         {
             // return true if the parser succeeds and the slot is not yet taken
-            typedef typename Component::director director;
             Attribute val;
-            if (!*taken
-                && director::parse(component, first, last, context, skipper, val))
+            if (!*taken && component.parse(first, last, context, skipper, val))
             {
                 attr = val;
                 *taken = true;
@@ -63,9 +63,7 @@
         bool operator()(Component const& component)
         {
             // return true if the parser succeeds and the slot is not yet taken
-            typedef typename Component::director director;
-            if (!*taken
-                && director::parse(component, first, last, context, skipper, unused))
+            if (!*taken && component.parse(first, last, context, skipper, unused))
             {
                 *taken = true;
                 ++taken;
Modified: trunk/boost/spirit/home/qi/detail/string_parse.hpp
==============================================================================
--- trunk/boost/spirit/home/qi/detail/string_parse.hpp	(original)
+++ trunk/boost/spirit/home/qi/detail/string_parse.hpp	2009-04-26 10:42:24 EDT (Sun, 26 Apr 2009)
@@ -1,5 +1,5 @@
 /*=============================================================================
-    Copyright (c) 2001-2007 Joel de Guzman
+    Copyright (c) 2001-2009 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)
@@ -7,6 +7,10 @@
 #if !defined(BOOST_SPIRIT_STRING_PARSE_APR_18_2006_1125PM)
 #define BOOST_SPIRIT_STRING_PARSE_APR_18_2006_1125PM
 
+#if defined(_MSC_VER)
+#pragma once
+#endif
+
 #include <boost/spirit/home/qi/detail/assign_to.hpp>
 
 namespace boost { namespace spirit { namespace qi { namespace detail
Modified: trunk/boost/spirit/home/qi/directive.hpp
==============================================================================
--- trunk/boost/spirit/home/qi/directive.hpp	(original)
+++ trunk/boost/spirit/home/qi/directive.hpp	2009-04-26 10:42:24 EDT (Sun, 26 Apr 2009)
@@ -1,15 +1,21 @@
 /*=============================================================================
-    Copyright (c) 2001-2007 Joel de Guzman
+    Copyright (c) 2001-2009 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_DIRECTIVE_FEB_05_2007_0313PM)
-#define BOOST_SPIRIT_DIRECTIVE_FEB_05_2007_0313PM
+#if !defined(BOOST_SPIRIT_DIRECTIVE_FEBRUARY_05_2007_0313PM)
+#define BOOST_SPIRIT_DIRECTIVE_FEBRUARY_05_2007_0313PM
+
+#if defined(_MSC_VER)
+#pragma once
+#endif
 
 #include <boost/spirit/home/qi/directive/lexeme.hpp>
 #include <boost/spirit/home/qi/directive/omit.hpp>
 #include <boost/spirit/home/qi/directive/raw.hpp>
-#include <boost/spirit/home/qi/directive/meta_grammar.hpp>
+#include <boost/spirit/home/qi/directive/no_case.hpp>
+#include <boost/spirit/home/qi/directive/repeat.hpp>
+#include <boost/spirit/home/qi/directive/skip.hpp>
 
 #endif
Modified: trunk/boost/spirit/home/qi/directive/lexeme.hpp
==============================================================================
--- trunk/boost/spirit/home/qi/directive/lexeme.hpp	(original)
+++ trunk/boost/spirit/home/qi/directive/lexeme.hpp	2009-04-26 10:42:24 EDT (Sun, 26 Apr 2009)
@@ -1,5 +1,5 @@
 /*=============================================================================
-    Copyright (c) 2001-2007 Joel de Guzman
+    Copyright (c) 2001-2009 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)
@@ -7,60 +7,87 @@
 #if !defined(SPIRIT_LEXEME_MARCH_24_2007_0802AM)
 #define SPIRIT_LEXEME_MARCH_24_2007_0802AM
 
-#include <boost/spirit/home/support/component.hpp>
+#if defined(_MSC_VER)
+#pragma once
+#endif
+
+#include <boost/spirit/home/qi/meta_compiler.hpp>
+#include <boost/spirit/home/qi/skip_over.hpp>
+#include <boost/spirit/home/qi/parser.hpp>
 #include <boost/spirit/home/support/unused.hpp>
-#include <boost/spirit/home/support/attribute_of.hpp>
-#include <boost/spirit/home/qi/domain.hpp>
-#include <boost/spirit/home/qi/skip.hpp>
+#include <boost/spirit/home/support/common_terminals.hpp>
+#include <boost/spirit/home/support/attributes.hpp>
+#include <boost/spirit/home/support/info.hpp>
+
+namespace boost { namespace spirit
+{
+    ///////////////////////////////////////////////////////////////////////////
+    // Enablers
+    ///////////////////////////////////////////////////////////////////////////
+    template <>
+    struct use_directive<qi::domain, tag::lexeme> // enables lexeme
+      : mpl::true_ {};
+}}
 
 namespace boost { namespace spirit { namespace qi
 {
-    struct lexeme_director
+    using spirit::lexeme;
+    using spirit::lexeme_type;
+
+    template <typename Skipper>
+    struct unused_skipper : unused_type
     {
-        template <typename Component, typename Context, typename Iterator>
+        unused_skipper(Skipper const& skipper)
+          : skipper(skipper) {}
+        Skipper const& skipper;
+    };
+
+    template <typename Subject>
+    struct lexeme_directive : unary_parser<lexeme_directive<Subject> >
+    {
+        typedef Subject subject_type;
+        lexeme_directive(Subject const& subject)
+          : subject(subject) {}
+
+        template <typename Context, typename Iterator>
         struct attribute
         {
             typedef typename
-                result_of::subject<Component>::type
-            subject_type;
-
-            typedef typename
-                traits::attribute_of<
-                    qi::domain, subject_type, Context, Iterator>::type
+                traits::attribute_of<subject_type, Context, Iterator>::type
             type;
         };
 
-        template <
-            typename Component
-          , typename Iterator, typename Context
+        template <typename Iterator, typename Context
           , typename Skipper, typename Attribute>
-        static bool parse(
-            Component const& component
-          , Iterator& first, Iterator const& last
+        bool parse(Iterator& first, Iterator const& last
           , Context& context, Skipper const& skipper
-          , Attribute& attr)
+          , Attribute& attr) const
         {
-            typedef typename
-                result_of::subject<Component>::type::director
-            director;
-
-            qi::skip(first, last, skipper);
-            return director::parse(
-                spirit::subject(component), first, last, context, unused, attr);
+            qi::skip_over(first, last, skipper);
+            return subject.parse(first, last, context
+              , unused_skipper<Skipper>(skipper), attr);
         }
 
-        template <typename Component, typename Context>
-        static std::string what(Component const& component, Context const& ctx)
+        template <typename Context>
+        info what(Context& context) const
         {
-            std::string result = "lexeme[";
+            return info("lexeme", subject.what(context));
 
-            typedef typename
-                result_of::subject<Component>::type::director
-            director;
+        }
 
-            result += director::what(subject(component), ctx);
-            result += "]";
-            return result;
+        Subject subject;
+    };
+
+    ///////////////////////////////////////////////////////////////////////////
+    // Parser generators: make_xxx function (objects)
+    ///////////////////////////////////////////////////////////////////////////
+    template <typename Subject, typename Modifiers>
+    struct make_directive<tag::lexeme, Subject, Modifiers>
+    {
+        typedef lexeme_directive<Subject> result_type;
+        result_type operator()(unused_type, Subject const& subject, unused_type) const
+        {
+            return result_type(subject);
         }
     };
 }}}
Deleted: trunk/boost/spirit/home/qi/directive/meta_grammar.hpp
==============================================================================
--- trunk/boost/spirit/home/qi/directive/meta_grammar.hpp	2009-04-26 10:42:24 EDT (Sun, 26 Apr 2009)
+++ (empty file)
@@ -1,79 +0,0 @@
-/*=============================================================================
-    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_META_GRAMMAR_FEB_05_2007_0320PM)
-#define BOOST_SPIRIT_META_GRAMMAR_FEB_05_2007_0320PM
-
-#include <boost/spirit/home/support/modifier.hpp>
-#include <boost/spirit/home/support/placeholders.hpp>
-#include <boost/spirit/home/support/meta_grammar.hpp>
-#include <boost/spirit/home/qi/domain.hpp>
-#include <boost/spirit/home/support/iso8859_1.hpp>
-#include <boost/spirit/home/support/ascii.hpp>
-#include <boost/spirit/home/support/standard.hpp>
-#include <boost/spirit/home/support/standard_wide.hpp>
-#include <boost/utility/enable_if.hpp>
-
-namespace boost { namespace spirit { namespace qi
-{
-    ///////////////////////////////////////////////////////////////////////////
-    // forwards
-    ///////////////////////////////////////////////////////////////////////////
-    struct lexeme_director;
-    struct omit_director;
-    struct raw_director;
-    struct main_meta_grammar;
-
-    template <typename Expr, typename Enable>
-    struct is_valid_expr;
-
-    template <typename Expr, typename Enable>
-    struct expr_transform;
-
-    ///////////////////////////////////////////////////////////////////////////
-    // directive meta-grammars
-    ///////////////////////////////////////////////////////////////////////////
-    struct directive_meta_grammar
-      : proto::or_<
-            meta_grammar::deep_directive_meta_grammar<
-                spirit::char_class::no_case_tag<proto::_>
-              , main_meta_grammar
-            >
-          , meta_grammar::binary_rule_rhs<
-                qi::domain, proto::tag::subscript, lexeme_director
-              , proto::terminal<tag::lexeme>, main_meta_grammar
-            >
-          , meta_grammar::binary_rule_rhs<
-                qi::domain, proto::tag::subscript, omit_director
-              , proto::terminal<tag::omit>, main_meta_grammar
-            >
-          , meta_grammar::binary_rule_rhs<
-                qi::domain, proto::tag::subscript, raw_director
-              , proto::terminal<tag::raw>, main_meta_grammar
-            >
-        >
-    {};
-
-    ///////////////////////////////////////////////////////////////////////////
-    //  These specializations non-intrusively hooks into the RD meta-grammar.
-    //  (see qi/meta_grammar.hpp)
-    ///////////////////////////////////////////////////////////////////////////
-    template <typename Expr>
-    struct is_valid_expr<Expr
-      , typename enable_if<proto::matches<Expr, directive_meta_grammar> >::type>
-      : mpl::true_
-    {
-    };
-
-    template <typename Expr>
-    struct expr_transform<Expr
-      , typename enable_if<proto::matches<Expr, directive_meta_grammar> >::type>
-      : mpl::identity<directive_meta_grammar>
-    {
-    };
-}}}
-
-#endif
Added: trunk/boost/spirit/home/qi/directive/no_case.hpp
==============================================================================
--- (empty file)
+++ trunk/boost/spirit/home/qi/directive/no_case.hpp	2009-04-26 10:42:24 EDT (Sun, 26 Apr 2009)
@@ -0,0 +1,32 @@
+/*=============================================================================
+    Copyright (c) 2001-2009 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(SPIRIT_NO_CASE_OCTOBER_25_2008_0424PM)
+#define SPIRIT_NO_CASE_OCTOBER_25_2008_0424PM
+
+#if defined(_MSC_VER)
+#pragma once
+#endif
+
+#include <boost/spirit/home/qi/meta_compiler.hpp>
+#include <boost/spirit/home/support/common_terminals.hpp>
+
+namespace boost { namespace spirit
+{
+    ///////////////////////////////////////////////////////////////////////////
+    // Enablers
+    ///////////////////////////////////////////////////////////////////////////
+    template <typename CharEncoding>
+    struct use_directive<
+        qi::domain, tag::char_code<tag::no_case, CharEncoding> > // enables no_case
+      : mpl::true_ {};
+
+    template <typename CharEncoding>
+    struct is_modifier_directive<qi::domain, tag::char_code<tag::no_case, CharEncoding> >
+      : mpl::true_ {};
+}}
+
+#endif
Modified: trunk/boost/spirit/home/qi/directive/omit.hpp
==============================================================================
--- trunk/boost/spirit/home/qi/directive/omit.hpp	(original)
+++ trunk/boost/spirit/home/qi/directive/omit.hpp	2009-04-26 10:42:24 EDT (Sun, 26 Apr 2009)
@@ -1,5 +1,5 @@
 /*=============================================================================
-    Copyright (c) 2001-2007 Joel de Guzman
+    Copyright (c) 2001-2009 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)
@@ -7,51 +7,77 @@
 #if !defined(SPIRIT_OMIT_MARCH_24_2007_0802AM)
 #define SPIRIT_OMIT_MARCH_24_2007_0802AM
 
-#include <boost/spirit/home/support/component.hpp>
+#if defined(_MSC_VER)
+#pragma once
+#endif
+
+#include <boost/spirit/home/qi/meta_compiler.hpp>
+#include <boost/spirit/home/qi/skip_over.hpp>
+#include <boost/spirit/home/qi/parser.hpp>
 #include <boost/spirit/home/support/unused.hpp>
-#include <boost/spirit/home/qi/skip.hpp>
+#include <boost/spirit/home/support/info.hpp>
+#include <boost/spirit/home/support/common_terminals.hpp>
+
+namespace boost { namespace spirit
+{
+    ///////////////////////////////////////////////////////////////////////////
+    // Enablers
+    ///////////////////////////////////////////////////////////////////////////
+    template <>
+    struct use_directive<qi::domain, tag::omit> // enables omit
+      : mpl::true_ {};
+}}
 
 namespace boost { namespace spirit { namespace qi
 {
-    struct omit_director
+    using spirit::omit;
+    using spirit::omit_type;
+
+    ///////////////////////////////////////////////////////////////////////////
+    // omit_directive forces the attribute of subject parser
+    // to be unused_type
+    ///////////////////////////////////////////////////////////////////////////
+    template <typename Subject>
+    struct omit_directive : unary_parser<omit_directive<Subject> >
     {
-        template <typename Component, typename Context, typename Iterator>
+        typedef Subject subject_type;
+        omit_directive(Subject const& subject)
+          : subject(subject) {}
+
+        template <typename Context, typename Iterator>
         struct attribute
         {
             typedef unused_type type;
         };
 
-        template <
-            typename Component
-          , typename Iterator, typename Context
+        template <typename Iterator, typename Context
           , typename Skipper, typename Attribute>
-        static bool parse(
-            Component const& component
-          , Iterator& first, Iterator const& last
-          , Context& context, Skipper const& skipper
-          , Attribute&)
+        bool parse(Iterator& first, Iterator const& last
+          , Context& context, Skipper const& skipper, Attribute& attr) const
         {
-            typedef typename
-                result_of::subject<Component>::type::director
-            director;
-
-            qi::skip(first, last, skipper);
-            return director::parse(
-                spirit::subject(component), first, last, context, skipper, unused);
+            return subject.parse(first, last, context, skipper, attr);
         }
 
-        template <typename Component, typename Context>
-        static std::string what(Component const& component, Context const& ctx)
+        template <typename Context>
+        info what(Context& context) const
         {
-            std::string result = "omit[";
+            return info("omit", subject.what(context));
 
-            typedef typename
-                result_of::subject<Component>::type::director
-            director;
-
-            result += director::what(subject(component), ctx);
-            result += "]";
-            return result;
+        }
+
+        Subject subject;
+    };
+
+    ///////////////////////////////////////////////////////////////////////////
+    // Parser generators: make_xxx function (objects)
+    ///////////////////////////////////////////////////////////////////////////
+    template <typename Subject, typename Modifiers>
+    struct make_directive<tag::omit, Subject, Modifiers>
+    {
+        typedef omit_directive<Subject> result_type;
+        result_type operator()(unused_type, Subject const& subject, unused_type) const
+        {
+            return result_type(subject);
         }
     };
 }}}
Modified: trunk/boost/spirit/home/qi/directive/raw.hpp
==============================================================================
--- trunk/boost/spirit/home/qi/directive/raw.hpp	(original)
+++ trunk/boost/spirit/home/qi/directive/raw.hpp	2009-04-26 10:42:24 EDT (Sun, 26 Apr 2009)
@@ -1,5 +1,5 @@
 /*=============================================================================
-    Copyright (c) 2001-2007 Joel de Guzman
+    Copyright (c) 2001-2009 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)
@@ -7,58 +7,84 @@
 #if !defined(SPIRIT_RAW_APRIL_9_2007_0912AM)
 #define SPIRIT_RAW_APRIL_9_2007_0912AM
 
-#include <boost/spirit/home/support/component.hpp>
+#if defined(_MSC_VER)
+#pragma once
+#endif
+
+#include <boost/spirit/home/qi/meta_compiler.hpp>
+#include <boost/spirit/home/qi/skip_over.hpp>
+#include <boost/spirit/home/qi/parser.hpp>
+#include <boost/spirit/home/qi/detail/assign_to.hpp>
+#include <boost/spirit/home/support/unused.hpp>
+#include <boost/spirit/home/support/info.hpp>
+#include <boost/spirit/home/support/common_terminals.hpp>
 #include <boost/spirit/home/support/unused.hpp>
 #include <boost/range/iterator_range.hpp>
 
+namespace boost { namespace spirit
+{
+    ///////////////////////////////////////////////////////////////////////////
+    // Enablers
+    ///////////////////////////////////////////////////////////////////////////
+    template <>
+    struct use_directive<qi::domain, tag::raw> // enables raw
+      : mpl::true_ {};
+}}
+
 namespace boost { namespace spirit { namespace qi
 {
-    struct raw_director
+    using spirit::raw;
+    using spirit::raw_type;
+
+    template <typename Subject>
+    struct raw_directive : unary_parser<raw_directive<Subject> >
     {
-        template <typename Component, typename Context, typename Iterator>
+        typedef Subject subject_type;
+        raw_directive(Subject const& subject)
+          : subject(subject) {}
+
+        template <typename Context, typename Iterator>
         struct attribute
         {
             typedef iterator_range<Iterator> type;
         };
 
-        template <
-            typename Component
-          , typename Iterator, typename Context
+        template <typename Iterator, typename Context
           , typename Skipper, typename Attribute>
-        static bool parse(
-            Component const& component
-          , Iterator& first, Iterator const& last
-          , Context& context, Skipper const& skipper
-          , Attribute& attr)
+        bool parse(Iterator& first, Iterator const& last
+          , Context& context, Skipper const& skipper, Attribute& attr) const
         {
-            typedef typename
-                result_of::subject<Component>::type::director
-            director;
-
-            qi::skip(first, last, skipper);
+            qi::skip_over(first, last, skipper);
             Iterator i = first;
-            if (director::parse(
-                spirit::subject(component), i, last, context, skipper, unused))
+            if (subject.parse(i, last, context, skipper, unused))
             {
-                attr = Attribute(first, i);
+                detail::assign_to(first, i, attr);
                 first = i;
                 return true;
             }
             return false;
         }
 
-        template <typename Component, typename Context>
-        static std::string what(Component const& component, Context const& ctx)
+        template <typename Context>
+        info what(Context& context) const
         {
-            std::string result = "raw[";
+            return info("raw", subject.what(context));
+
+        }
 
-            typedef typename
-                result_of::subject<Component>::type::director
-            director;
-
-            result += director::what(subject(component), ctx);
-            result += "]";
-            return result;
+        Subject subject;
+    };
+
+    ///////////////////////////////////////////////////////////////////////////
+    // Parser generators: make_xxx function (objects)
+    ///////////////////////////////////////////////////////////////////////////
+    template <typename Subject, typename Modifiers>
+    struct make_directive<tag::raw, Subject, Modifiers>
+    {
+        typedef raw_directive<Subject> result_type;
+        result_type operator()(unused_type, Subject const& subject, unused_type) const
+        {
+            return result_type(subject);
         }
     };
 }}}
Added: trunk/boost/spirit/home/qi/directive/repeat.hpp
==============================================================================
--- (empty file)
+++ trunk/boost/spirit/home/qi/directive/repeat.hpp	2009-04-26 10:42:24 EDT (Sun, 26 Apr 2009)
@@ -0,0 +1,253 @@
+/*=============================================================================
+    Copyright (c) 2001-2009 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(SPIRIT_REPEAT_NOVEMBER_14_2008_1148AM)
+#define SPIRIT_REPEAT_NOVEMBER_14_2008_1148AM
+
+#if defined(_MSC_VER)
+#pragma once
+#endif
+
+#include <boost/spirit/home/qi/meta_compiler.hpp>
+#include <boost/spirit/home/qi/parser.hpp>
+#include <boost/spirit/home/qi/auxiliary/lazy.hpp>
+#include <boost/spirit/home/qi/operator/kleene.hpp>
+#include <boost/spirit/home/support/container.hpp>
+#include <boost/spirit/home/support/common_terminals.hpp>
+#include <boost/spirit/home/support/attributes.hpp>
+#include <boost/spirit/home/support/info.hpp>
+#include <boost/fusion/include/at.hpp>
+
+namespace boost { namespace spirit
+{
+    ///////////////////////////////////////////////////////////////////////////
+    // Enablers
+    ///////////////////////////////////////////////////////////////////////////
+    template <>
+    struct use_directive<qi::domain, tag::repeat>   // enables repeat[p]
+      : mpl::true_ {};
+
+    template <typename T>
+    struct use_directive<qi::domain
+      , terminal_ex<tag::repeat                     // enables repeat(exact)[p]
+        , fusion::vector1<T> >
+    > : mpl::true_ {};
+
+    template <typename T>
+    struct use_directive<qi::domain
+      , terminal_ex<tag::repeat                     // enables repeat(min, max)[p]
+        , fusion::vector2<T, T> >
+    > : mpl::true_ {};
+
+    template <typename T>
+    struct use_directive<qi::domain
+      , terminal_ex<tag::repeat                     // enables repeat(min, inf)[p]
+        , fusion::vector2<T, inf_type> >
+    > : mpl::true_ {};
+
+    template <>                                     // enables *lazy* repeat(exact)[p]
+    struct use_lazy_directive<
+        qi::domain
+      , tag::repeat
+      , 1 // arity
+    > : mpl::true_ {};
+
+    template <>                                     // enables *lazy* repeat(min, max)[p]
+    struct use_lazy_directive<                      // and repeat(min, inf)[p]
+        qi::domain
+      , tag::repeat
+      , 2 // arity
+    > : mpl::true_ {};
+}}
+
+namespace boost { namespace spirit { namespace qi
+{
+    using spirit::repeat;
+    using spirit::repeat_type;
+    using spirit::inf;
+    using spirit::inf_type;
+
+    template <typename T>
+    struct exact_iterator // handles repeat(exact)[p]
+    {
+        exact_iterator(T const exact)
+          : exact(exact) {}
+
+        typedef T type;
+        T start() const { return 0; }
+        bool got_max(T i) const { return i >= exact; }
+        bool got_min(T i) const { return i >= exact; }
+
+        T const exact;
+    };
+
+    template <typename T>
+    struct finite_iterator // handles repeat(min, max)[p]
+    {
+        finite_iterator(T const min, T const max)
+          : min BOOST_PREVENT_MACRO_SUBSTITUTION (min)
+          , max BOOST_PREVENT_MACRO_SUBSTITUTION (max) {}
+
+        typedef T type;
+        T start() const { return 0; }
+        bool got_max(T i) const { return i >= max; }
+        bool got_min(T i) const { return i >= min; }
+
+        T const min;
+        T const max;
+    };
+
+    template <typename T>
+    struct infinite_iterator // handles repeat(min, inf)[p]
+    {
+        infinite_iterator(T const min)
+          : min BOOST_PREVENT_MACRO_SUBSTITUTION (min) {}
+
+        typedef T type;
+        T start() const { return 0; }
+        bool got_max(T i) const { return false; }
+        bool got_min(T i) const { return i >= min; }
+
+        T const min;
+    };
+
+    template <typename Subject, typename LoopIter>
+    struct repeat_parser : unary_parser<repeat_parser<Subject, LoopIter> >
+    {
+        typedef Subject subject_type;
+
+        template <typename Context, typename Iterator>
+        struct attribute
+        {
+            // Build a std::vector from the subject's attribute. Note
+            // that build_std_vector may return unused_type if the
+            // subject's attribute is an unused_type.
+            typedef typename
+                traits::build_std_vector<
+                    typename traits::attribute_of<
+                        Subject, Context, Iterator>::type
+                >::type
+            type;
+        };
+
+        repeat_parser(Subject const& subject, LoopIter const& iter)
+          : subject(subject), iter(iter) {}
+
+        template <typename Iterator, typename Context
+          , typename Skipper, typename Attribute>
+        bool parse(Iterator& first, Iterator const& last
+          , Context& context, Skipper const& skipper
+          , Attribute& attr) const
+        {
+            // create a local value if Attribute is not unused_type
+            typename traits::result_of::value<Attribute>::type val;
+            typename LoopIter::type i = iter.start();
+
+            // parse the minimum required
+            { // this scope allows save and save_attr to be reclaimed immediately
+              // after we're done with the required minimum iteration.
+                Iterator save = first;
+                Attribute save_attr; traits::swap_impl(save_attr, attr);
+                for (; !iter.got_min(i); ++i)
+                {
+                    if (!subject.parse(first, last, context, skipper, val))
+                    {
+                        // if we fail before reaching the minimum iteration
+                        // required, restore the iterator and the attribute
+                        // then return false
+                        first = save;
+                        traits::swap_impl(save_attr, attr);
+                        return false;
+                    }
+                    traits::push_back(attr, val);
+                }
+            }
+            // parse some more up to the maximum specified
+            for (; !iter.got_max(i); ++i)
+            {
+                if (!subject.parse(first, last, context, skipper, val))
+                    break;
+                traits::push_back(attr, val);
+            }
+            return true;
+        }
+
+        template <typename Context>
+        info what(Context& context) const
+        {
+            return info("repeat", subject.what(context));
+        }
+
+        Subject subject;
+        LoopIter iter;
+    };
+
+    ///////////////////////////////////////////////////////////////////////////
+    // Parser generators: make_xxx function (objects)
+    ///////////////////////////////////////////////////////////////////////////
+    template <typename Subject, typename Modifiers>
+    struct make_directive<tag::repeat, Subject, Modifiers>
+    {
+        typedef kleene<Subject> result_type;
+        result_type operator()(unused_type, Subject const& subject, unused_type) const
+        {
+            return result_type(subject);
+        }
+    };
+
+    template <typename T, typename Subject, typename Modifiers>
+    struct make_directive<
+        terminal_ex<tag::repeat, fusion::vector1<T> >, Subject, Modifiers>
+    {
+        typedef exact_iterator<T> iterator_type;
+        typedef repeat_parser<Subject, iterator_type> result_type;
+
+        template <typename Terminal>
+        result_type operator()(
+            Terminal const& term, Subject const& subject, unused_type) const
+        {
+            return result_type(subject, fusion::at_c<0>(term.args));
+        }
+    };
+
+    template <typename T, typename Subject, typename Modifiers>
+    struct make_directive<
+        terminal_ex<tag::repeat, fusion::vector2<T, T> >, Subject, Modifiers>
+    {
+        typedef finite_iterator<T> iterator_type;
+        typedef repeat_parser<Subject, iterator_type> result_type;
+
+        template <typename Terminal>
+        result_type operator()(
+            Terminal const& term, Subject const& subject, unused_type) const
+        {
+            return result_type(subject,
+                iterator_type(
+                    fusion::at_c<0>(term.args)
+                  , fusion::at_c<1>(term.args)
+                )
+            );
+        }
+    };
+
+    template <typename T, typename Subject, typename Modifiers>
+    struct make_directive<
+        terminal_ex<tag::repeat
+        , fusion::vector2<T, inf_type> >, Subject, Modifiers>
+    {
+        typedef infinite_iterator<T> iterator_type;
+        typedef repeat_parser<Subject, iterator_type> result_type;
+
+        template <typename Terminal>
+        result_type operator()(
+            Terminal const& term, Subject const& subject, unused_type) const
+        {
+            return result_type(subject, fusion::at_c<0>(term.args));
+        }
+    };
+}}}
+
+#endif
Added: trunk/boost/spirit/home/qi/directive/skip.hpp
==============================================================================
--- (empty file)
+++ trunk/boost/spirit/home/qi/directive/skip.hpp	2009-04-26 10:42:24 EDT (Sun, 26 Apr 2009)
@@ -0,0 +1,177 @@
+/*=============================================================================
+    Copyright (c) 2001-2009 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(SPIRIT_SKIP_JANUARY_26_2008_0422PM)
+#define SPIRIT_SKIP_JANUARY_26_2008_0422PM
+
+#if defined(_MSC_VER)
+#pragma once
+#endif
+
+#include <boost/spirit/home/qi/meta_compiler.hpp>
+#include <boost/spirit/home/qi/parser.hpp>
+#include <boost/spirit/home/qi/auxiliary/lazy.hpp>
+#include <boost/spirit/home/qi/operator/kleene.hpp>
+#include <boost/spirit/home/qi/directive/lexeme.hpp>
+#include <boost/spirit/home/qi/skip_over.hpp>
+#include <boost/spirit/home/support/container.hpp>
+#include <boost/spirit/home/support/common_terminals.hpp>
+#include <boost/spirit/home/support/attributes.hpp>
+#include <boost/spirit/home/support/info.hpp>
+#include <boost/fusion/include/at.hpp>
+#include <boost/fusion/include/vector.hpp>
+
+namespace boost { namespace spirit
+{
+    ///////////////////////////////////////////////////////////////////////////
+    // Enablers
+    ///////////////////////////////////////////////////////////////////////////
+    template <>
+    struct use_directive<qi::domain, tag::skip>     // enables skip[p]
+      : mpl::true_ {};
+
+    template <typename T>
+    struct use_directive<qi::domain
+      , terminal_ex<tag::skip                       // enables skip(s)[p]
+        , fusion::vector1<T> >
+    > : boost::spirit::traits::matches<qi::domain, T> {};
+
+    template <>                                     // enables *lazy* skip(s)[p]
+    struct use_lazy_directive<
+        qi::domain
+      , tag::skip
+      , 1 // arity
+    > : mpl::true_ {};
+}}
+
+namespace boost { namespace spirit { namespace qi
+{
+    using spirit::skip;
+    using spirit::skip_type;
+
+    template <typename Skipper>
+    struct unused_skipper;
+
+    namespace detail
+    {
+        template <typename Skipper>
+        inline Skipper const& get_skipper(unused_skipper<Skipper> const& u)
+        {
+            return u.skipper;
+        }
+
+        template <typename Skipper>
+        inline Skipper const& get_skipper(Skipper const& u)
+        {
+            return u;
+        }
+    }
+
+    template <typename Subject>
+    struct reskip_parser : unary_parser<reskip_parser<Subject> >
+    {
+        typedef Subject subject_type;
+
+        template <typename Context, typename Iterator>
+        struct attribute
+        {
+            typedef typename
+                traits::attribute_of<Subject, Context, Iterator>::type
+            type;
+        };
+
+        reskip_parser(Subject const& subject)
+          : subject(subject) {}
+
+        template <typename Iterator, typename Context
+          , typename Skipper, typename Attribute>
+        bool parse(Iterator& first, Iterator const& last
+          , Context& context, Skipper const& u // --> The skipper is reintroduced
+          , Attribute& attr) const
+        {
+            return subject.parse(first, last, context, detail::get_skipper(u), attr);
+        }
+
+        template <typename Context>
+        info what(Context& context) const
+        {
+            return info("skip", subject.what(context));
+        }
+
+        Subject subject;
+    };
+
+    template <typename Subject, typename Skipper>
+    struct skip_parser : unary_parser<skip_parser<Subject, Skipper> >
+    {
+        typedef Subject subject_type;
+        typedef Skipper skipper_type;
+
+        template <typename Context, typename Iterator>
+        struct attribute
+        {
+            typedef typename
+                traits::attribute_of<Subject, Context, Iterator>::type
+            type;
+        };
+
+        skip_parser(Subject const& subject, Skipper const& skipper)
+          : subject(subject), skipper(skipper) {}
+
+        template <typename Iterator, typename Context
+          , typename Skipper_, typename Attribute>
+        bool parse(Iterator& first, Iterator const& last
+          , Context& context, Skipper_ const& //skipper --> bypass the supplied skipper
+          , Attribute& attr) const
+        {
+            return subject.parse(first, last, context, skipper, attr);
+        }
+
+        template <typename Context>
+        info what(Context& context) const
+        {
+            return info("skip", subject.what(context));
+        }
+
+        Subject subject;
+        Skipper skipper;
+    };
+
+    ///////////////////////////////////////////////////////////////////////////
+    // Parser generators: make_xxx function (objects)
+    ///////////////////////////////////////////////////////////////////////////
+    template <typename Subject, typename Modifiers>
+    struct make_directive<tag::skip, Subject, Modifiers>
+    {
+        typedef reskip_parser<Subject> result_type;
+        result_type operator()(unused_type, Subject const& subject, unused_type) const
+        {
+            return result_type(subject);
+        }
+    };
+
+    template <typename Skipper, typename Subject, typename Modifiers>
+    struct make_directive<
+        terminal_ex<tag::skip, fusion::vector1<Skipper> >, Subject, Modifiers>
+    {
+        typedef typename
+            result_of::compile<qi::domain, Skipper, Modifiers>::type
+        skipper_type;
+
+        typedef skip_parser<Subject, skipper_type> result_type;
+
+        template <typename Terminal>
+        result_type operator()(
+            Terminal const& term, Subject const& subject, unused_type) const
+        {
+            return result_type(subject
+              , compile<qi::domain>(fusion::at_c<0>(term.args)));
+        }
+    };
+
+}}}
+
+#endif
Modified: trunk/boost/spirit/home/qi/domain.hpp
==============================================================================
--- trunk/boost/spirit/home/qi/domain.hpp	(original)
+++ trunk/boost/spirit/home/qi/domain.hpp	2009-04-26 10:42:24 EDT (Sun, 26 Apr 2009)
@@ -1,15 +1,54 @@
 /*=============================================================================
-    Copyright (c) 2001-2007 Joel de Guzman
+    Copyright (c) 2001-2009 Joel de Guzman
 
-    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_DOMAIN_JAN_29_2007_0954AM)
-#define BOOST_SPIRIT_DOMAIN_JAN_29_2007_0954AM
+#if !defined(BOOST_SPIRIT_DOMAIN_JANUARY_29_2007_0954AM)
+#define BOOST_SPIRIT_DOMAIN_JANUARY_29_2007_0954AM
+
+#if defined(_MSC_VER)
+#pragma once
+#endif
+
+#include <boost/spirit/home/support/unused.hpp>
+#include <boost/spirit/home/support/meta_compiler.hpp>
+#include <boost/spirit/home/support/info.hpp>
+#include <boost/spirit/home/support/argument.hpp>
+#include <boost/spirit/home/support/context.hpp>
+
+#include <boost/preprocessor/repeat.hpp>
+#include <boost/preprocessor/cat.hpp>
 
 namespace boost { namespace spirit { namespace qi
 {
+    // qi's domain
     struct domain {};
+
+    // bring in some of spirit parts into spirit::qi
+    using spirit::unused;
+    using spirit::unused_type;
+    using spirit::compile;
+    using spirit::info;
+
+    // You can bring these in with the using directive
+    // without worrying about bringing in too much.
+    namespace labels
+    {
+        BOOST_PP_REPEAT(SPIRIT_ARGUMENTS_LIMIT, SPIRIT_USING_ARGUMENT, _)
+        BOOST_PP_REPEAT(SPIRIT_ATTRIBUTES_LIMIT, SPIRIT_USING_ATTRIBUTE, _)
+        using spirit::_val;
+        using spirit::_a;
+        using spirit::_b;
+        using spirit::_c;
+        using spirit::_d;
+        using spirit::_e;
+        using spirit::_f;
+        using spirit::_g;
+        using spirit::_h;
+        using spirit::_i;
+        using spirit::_j;
+    }
 }}}
 
 #endif
Added: trunk/boost/spirit/home/qi/meta_compiler.hpp
==============================================================================
--- (empty file)
+++ trunk/boost/spirit/home/qi/meta_compiler.hpp	2009-04-26 10:42:24 EDT (Sun, 26 Apr 2009)
@@ -0,0 +1,177 @@
+/*=============================================================================
+    Copyright (c) 2001-2009 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_META_COMPILER_OCTOBER_16_2008_0347PM)
+#define BOOST_SPIRIT_META_COMPILER_OCTOBER_16_2008_0347PM
+
+#if defined(_MSC_VER)
+#pragma once
+#endif
+
+#include <boost/spirit/home/support/meta_compiler.hpp>
+#include <boost/spirit/home/qi/domain.hpp>
+#include <boost/spirit/home/qi/parser.hpp>
+#include <boost/spirit/home/support/string_traits.hpp>
+#include <boost/type_traits/remove_reference.hpp>
+#include <boost/utility/enable_if.hpp>
+#include <boost/fusion/include/at.hpp>
+
+namespace boost { namespace spirit
+{
+    template <typename T>
+    struct use_terminal<qi::domain, T
+      , typename enable_if<traits::is_parser<T> >::type> // enables parsers
+      : mpl::true_ {};
+
+    namespace qi
+    {
+        template <typename T, typename Modifiers, typename Enable = void>
+        struct make_primitive // by default, return it as-is
+        {
+            typedef T result_type;
+
+            template <typename T_>
+            T_& operator()(T_& val, unused_type) const
+            {
+                return val;
+            }
+
+            template <typename T_>
+            T_ const& operator()(T_ const& val, unused_type) const
+            {
+                return val;
+            }
+        };
+
+        template <typename Tag, typename Elements
+          , typename Modifiers, typename Enable = void>
+        struct make_composite;
+
+        template <typename Directive, typename Body
+          , typename Modifiers, typename Enable = void>
+        struct make_directive
+        {
+            typedef Body result_type;
+            result_type operator()(unused_type, Body const& body, unused_type) const
+            {
+                return body; // By default, a directive simply returns its subject
+            }
+        };
+    }
+
+    // Qi primitive meta-compiler
+    template <>
+    struct make_component<qi::domain, proto::tag::terminal>
+    {
+        template <typename Sig>
+        struct result;
+
+        template <typename This, typename Elements, typename Modifiers>
+        struct result<This(Elements, Modifiers)>
+        {
+            typedef typename qi::make_primitive<
+                typename remove_const<typename Elements::car_type>::type,
+                typename remove_reference<Modifiers>::type>::result_type
+            type;
+        };
+
+        template <typename Elements, typename Modifiers>
+        typename result<make_component(Elements, Modifiers)>::type
+        operator()(Elements const& elements, Modifiers const& modifiers) const
+        {
+            typedef typename remove_const<typename Elements::car_type>::type term;
+            return qi::make_primitive<term, Modifiers>()(elements.car, modifiers);
+        }
+    };
+
+    // Qi composite meta-compiler
+    template <typename Tag>
+    struct make_component<qi::domain, Tag>
+    {
+        template <typename Sig>
+        struct result;
+
+        template <typename This, typename Elements, typename Modifiers>
+        struct result<This(Elements, Modifiers)>
+        {
+            typedef typename
+                qi::make_composite<Tag, Elements,
+                typename remove_reference<Modifiers>::type>::result_type
+            type;
+        };
+
+        template <typename Elements, typename Modifiers>
+        typename result<make_component(Elements, Modifiers)>::type
+        operator()(Elements const& elements, Modifiers const& modifiers) const
+        {
+            return qi::make_composite<Tag, Elements, Modifiers>()(
+                elements, modifiers);
+        }
+    };
+
+    // Qi function meta-compiler
+    template <>
+    struct make_component<qi::domain, proto::tag::function>
+    {
+        template <typename Sig>
+        struct result;
+
+        template <typename This, typename Elements, typename Modifiers>
+        struct result<This(Elements, Modifiers)>
+        {
+            typedef typename
+                qi::make_composite<
+                    typename remove_const<typename Elements::car_type>::type,
+                    typename Elements::cdr_type,
+                    typename remove_reference<Modifiers>::type
+                >::result_type
+            type;
+        };
+
+        template <typename Elements, typename Modifiers>
+        typename result<make_component(Elements, Modifiers)>::type
+        operator()(Elements const& elements, Modifiers const& modifiers) const
+        {
+            return qi::make_composite<
+                typename remove_const<typename Elements::car_type>::type,
+                typename Elements::cdr_type,
+                Modifiers>()(elements.cdr, modifiers);
+        }
+    };
+
+    // Qi directive meta-compiler
+    template <>
+    struct make_component<qi::domain, tag::directive>
+    {
+        template <typename Sig>
+        struct result;
+
+        template <typename This, typename Elements, typename Modifiers>
+        struct result<This(Elements, Modifiers)>
+        {
+            typedef typename
+                qi::make_directive<
+                    typename remove_const<typename Elements::car_type>::type,
+                    typename remove_const<typename Elements::cdr_type::car_type>::type,
+                    typename remove_reference<Modifiers>::type
+                >::result_type
+            type;
+        };
+
+        template <typename Elements, typename Modifiers>
+        typename result<make_component(Elements, Modifiers)>::type
+        operator()(Elements const& elements, Modifiers const& modifiers) const
+        {
+            return qi::make_directive<
+                typename remove_const<typename Elements::car_type>::type,
+                typename remove_const<typename Elements::cdr_type::car_type>::type,
+                Modifiers>()(elements.car, elements.cdr.car, modifiers);
+        }
+    };
+
+}}
+
+#endif
Deleted: trunk/boost/spirit/home/qi/meta_grammar.hpp
==============================================================================
--- trunk/boost/spirit/home/qi/meta_grammar.hpp	2009-04-26 10:42:24 EDT (Sun, 26 Apr 2009)
+++ (empty file)
@@ -1,47 +0,0 @@
-/*=============================================================================
-    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_META_GRAMMAR_JAN_29_2007_0937AM)
-#define BOOST_SPIRIT_META_GRAMMAR_JAN_29_2007_0937AM
-
-#include <boost/spirit/home/support/meta_grammar/grammar.hpp>
-#include <boost/spirit/home/support/meta_grammar/basic_transforms.hpp>
-#include <boost/spirit/home/qi/domain.hpp>
-#include <boost/mpl/bool.hpp>
-#include <boost/mpl/placeholders.hpp>
-
-namespace boost { namespace spirit { namespace qi
-{
-    // Check if Expr is a valid RD expression
-    template <typename Expr, typename Enable = void>
-    struct is_valid_expr : mpl::false_ {};
-
-    // Return a suitable transform for the given Expr
-    template <typename Expr, typename Enable = void>
-    struct expr_transform;
-
-    struct main_meta_grammar
-      : meta_grammar::if_transform<
-            is_valid_expr<proto::_>() 
-          , expr_transform<proto::_> 
-        >
-    {
-    };
-}}}
-
-namespace boost { namespace spirit { namespace meta_grammar
-{
-    ///////////////////////////////////////////////////////////////////////////
-    //  The spirit qi domain meta-grammar
-    ///////////////////////////////////////////////////////////////////////////
-    template <>
-    struct grammar<qi::domain>
-    {
-        typedef qi::main_meta_grammar type;
-    };
-}}}
-
-#endif
Modified: trunk/boost/spirit/home/qi/nonterminal.hpp
==============================================================================
--- trunk/boost/spirit/home/qi/nonterminal.hpp	(original)
+++ trunk/boost/spirit/home/qi/nonterminal.hpp	2009-04-26 10:42:24 EDT (Sun, 26 Apr 2009)
@@ -1,14 +1,20 @@
 /*=============================================================================
-    Copyright (c) 2001-2007 Joel de Guzman
+    Copyright (c) 2001-2009 Joel de Guzman
 
-    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_NONTERMINAL_FEB_12_2007_1018AM)
-#define BOOST_SPIRIT_NONTERMINAL_FEB_12_2007_1018AM
+#if !defined(BOOST_SPIRIT_NONTERMINAL_FEBRUARY_12_2007_1018AM)
+#define BOOST_SPIRIT_NONTERMINAL_FEBRUARY_12_2007_1018AM
+
+#if defined(_MSC_VER)
+#pragma once
+#endif
 
-#include <boost/spirit/home/qi/nonterminal/meta_grammar.hpp>
 #include <boost/spirit/home/qi/nonterminal/rule.hpp>
 #include <boost/spirit/home/qi/nonterminal/grammar.hpp>
+#include <boost/spirit/home/qi/nonterminal/error_handler.hpp>
+#include <boost/spirit/home/qi/nonterminal/debug_handler.hpp>
+#include <boost/spirit/home/qi/nonterminal/simple_trace.hpp>
 
 #endif
Added: trunk/boost/spirit/home/qi/nonterminal/debug_handler.hpp
==============================================================================
--- (empty file)
+++ trunk/boost/spirit/home/qi/nonterminal/debug_handler.hpp	2009-04-26 10:42:24 EDT (Sun, 26 Apr 2009)
@@ -0,0 +1,124 @@
+/*=============================================================================
+    Copyright (c) 2001-2009 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_DEBUG_HANDLER_DECEMBER_05_2008_0734PM)
+#define BOOST_SPIRIT_DEBUG_HANDLER_DECEMBER_05_2008_0734PM
+
+#if defined(_MSC_VER)
+#pragma once
+#endif
+
+#include <boost/spirit/home/qi/nonterminal/rule.hpp>
+#include <boost/spirit/home/qi/operator/expect.hpp>
+#include <boost/function.hpp>
+#include <boost/fusion/include/at.hpp>
+#include <boost/fusion/include/vector.hpp>
+#include <boost/fusion/include/out.hpp>
+#include <iostream>
+
+namespace boost { namespace spirit { namespace qi
+{
+    enum debug_handler_state
+    {
+        pre_parse
+      , successful_parse
+      , failed_parse
+    };
+
+    template <
+        typename Iterator, typename Context
+      , typename Skipper, typename F>
+    struct debug_handler
+    {
+        typedef function<
+            bool(Iterator& first, Iterator const& last
+              , Context& context
+              , Skipper const& skipper
+            )>
+        function_type;
+
+        debug_handler(
+            function_type subject
+          , F f
+          , std::string const& rule_name)
+          : subject(subject)
+          , f(f)
+          , rule_name(rule_name)
+        {
+        }
+
+        bool operator()(
+            Iterator& first, Iterator const& last
+          , Context& context, Skipper const& skipper) const
+        {
+            f(first, last, context, pre_parse, rule_name);
+            try // subject might throw an exception
+            {
+                if (subject(first, last, context, skipper))
+                {
+                    f(first, last, context, successful_parse, rule_name);
+                    return true;
+                }
+                f(first, last, context, failed_parse, rule_name);
+            }
+            catch (expectation_failure<Iterator> const& e)
+            {
+                f(first, last, context, failed_parse, rule_name);
+                throw e;
+            }
+            return false;
+        }
+
+        function_type subject;
+        F f;
+        std::string rule_name;
+    };
+
+    template <
+        typename Iterator, typename T0, typename T1, typename T2
+      , typename F>
+    void debug(rule<Iterator, T0, T1, T2>& r, F f)
+    {
+        typedef rule<Iterator, T0, T1, T2> rule_type;
+
+        typedef
+            debug_handler<
+                Iterator
+              , typename rule_type::context_type
+              , typename rule_type::skipper_type
+              , F>
+        debug_handler;
+        r.f = debug_handler(r.f, f. r.name());
+    }
+
+    struct simple_trace;
+
+    template <typename Iterator, typename T0, typename T1, typename T2>
+    void debug(rule<Iterator, T0, T1, T2>& r)
+    {
+        typedef rule<Iterator, T0, T1, T2> rule_type;
+
+        typedef
+            debug_handler<
+                Iterator
+              , typename rule_type::context_type
+              , typename rule_type::skipper_type
+              , simple_trace>
+        debug_handler;
+        r.f = debug_handler(r.f, simple_trace(), r.name());
+    }
+
+}}}
+
+///////////////////////////////////////////////////////////////////////////////
+//  Utility macro for easy enabling of rule and grammar debugging
+#if defined(BOOST_SPIRIT_DEBUG)
+#define BOOST_SPIRIT_DEBUG_NODE(r)  r.name(#r); debug(r)
+#else
+#define BOOST_SPIRIT_DEBUG_NODE(r)
+#endif
+
+#endif
Deleted: trunk/boost/spirit/home/qi/nonterminal/detail/error_handler.hpp
==============================================================================
--- trunk/boost/spirit/home/qi/nonterminal/detail/error_handler.hpp	2009-04-26 10:42:24 EDT (Sun, 26 Apr 2009)
+++ (empty file)
@@ -1,100 +0,0 @@
-/*=============================================================================
-    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_ERROR_HANDLER_APR_29_2007_1042PM)
-#define BOOST_SPIRIT_ERROR_HANDLER_APR_29_2007_1042PM
-
-#include <boost/spirit/home/qi/nonterminal/virtual_component_base.hpp>
-#include <boost/spirit/home/qi/nonterminal/error_handler_result.hpp>
-#include <boost/spirit/home/qi/operator/expect.hpp>
-#include <boost/fusion/include/vector.hpp>
-
-namespace boost { namespace spirit { namespace qi { namespace detail
-{
-    template <
-        typename Iterator, typename Context
-      , typename Skipper, typename F, error_handler_result action
-    >
-    struct error_handler : virtual_component_base<Iterator, Context, Skipper>
-    {
-        typedef virtual_component_base<Iterator, Context, Skipper> base_type;
-        typedef intrusive_ptr<base_type> pointer_type;
-        typedef typename base_type::skipper_type skipper_type;
-
-        error_handler(pointer_type subject, F f)
-          : subject(subject)
-          , f(f)
-        {
-        }
-
-        template <typename Skipper_>
-        bool parse_main(
-            Iterator& first
-          , Iterator const& last
-          , Context& context
-          , Skipper_ const& skipper)
-        {
-            while (true)
-            {
-                try
-                {
-                    Iterator i = first;
-                    bool r = subject->parse(i, last, context, skipper);
-                    if (r)
-                        first = i;
-                    return r;
-                }
-                catch (expectation_failure<Iterator> const& x)
-                {
-                    typedef
-                        fusion::vector<
-                            Iterator&
-                          , Iterator const&
-                          , Iterator const&
-                          , std::string>
-                    params;
-                    error_handler_result r = action;
-                    params args(first, last, x.first, x.what);
-                    f(args, context, r);
-
-                    switch (r)
-                    {
-                        case fail: return false;
-                        case retry: continue;
-                        case accept: return true;
-                        case rethrow: throw x;
-                    }
-                }
-            }
-            return false;
-        }
-
-        virtual bool
-        parse(
-            Iterator& first
-          , Iterator const& last
-          , Context& context
-          , skipper_type const& skipper)
-        {
-            return parse_main(first, last, context, skipper);
-        }
-
-        virtual bool
-        parse(
-            Iterator& first
-          , Iterator const& last
-          , Context& context
-          , no_skipper)
-        {
-            return parse_main(first, last, context, unused);
-        }
-
-        pointer_type subject;
-        F f;
-    };
-}}}}
-
-#endif
Added: trunk/boost/spirit/home/qi/nonterminal/detail/fcall.hpp
==============================================================================
--- (empty file)
+++ trunk/boost/spirit/home/qi/nonterminal/detail/fcall.hpp	2009-04-26 10:42:24 EDT (Sun, 26 Apr 2009)
@@ -0,0 +1,54 @@
+/*=============================================================================
+    Copyright (c) 2001-2009 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)
+==============================================================================*/
+#ifndef BOOST_PP_IS_ITERATING
+
+#include <boost/preprocessor/iterate.hpp>
+#include <boost/preprocessor/repetition/enum_params.hpp>
+#include <boost/preprocessor/repetition/enum_binary_params.hpp>
+
+#define BOOST_PP_FILENAME_1 \
+    <boost/spirit/home/qi/nonterminal/detail/fcall.hpp>
+#define BOOST_PP_ITERATION_LIMITS (1, SPIRIT_ARGUMENTS_LIMIT)
+#include BOOST_PP_ITERATE()
+
+///////////////////////////////////////////////////////////////////////////////
+//
+//  Preprocessor vertical repetition code
+//
+///////////////////////////////////////////////////////////////////////////////
+#else // defined(BOOST_PP_IS_ITERATING)
+
+#define N BOOST_PP_ITERATION()
+
+    template <BOOST_PP_ENUM_PARAMS(N, typename A)>
+    typename lazy_enable_if_c<
+        (params_size == N)
+      , proto::terminal<
+            parameterized_rule<rule_type
+          , fusion::vector<BOOST_PP_ENUM_PARAMS(N, A)> >
+        >
+    >::type
+    operator()(BOOST_PP_ENUM_BINARY_PARAMS(N, A, const& f)) const
+    {
+        typedef fusion::vector<BOOST_PP_ENUM_PARAMS(N, A)> vector_type;
+        typedef parameterized_rule<
+            rule_type
+          , vector_type>
+        parameterized_rule;
+        typedef typename proto::terminal<parameterized_rule>::type result_type;
+
+        return result_type::make(
+            parameterized_rule(
+                this->get_rule()
+              , fusion::make_vector(BOOST_PP_ENUM_PARAMS(N, f)))
+        );
+    }
+
+#undef N
+#endif // defined(BOOST_PP_IS_ITERATING)
+
+
Added: trunk/boost/spirit/home/qi/nonterminal/detail/parser_binder.hpp
==============================================================================
--- (empty file)
+++ trunk/boost/spirit/home/qi/nonterminal/detail/parser_binder.hpp	2009-04-26 10:42:24 EDT (Sun, 26 Apr 2009)
@@ -0,0 +1,86 @@
+/*=============================================================================
+    Copyright (c) 2001-2009 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_PARSER_BINDER_DECEMBER_05_2008_0516_PM)
+#define BOOST_SPIRIT_PARSER_BINDER_DECEMBER_05_2008_0516_PM
+
+#if defined(_MSC_VER)
+#pragma once
+#endif
+
+#include <utility>
+#include <boost/type_traits/remove_reference.hpp>
+#include <boost/fusion/include/value_at.hpp>
+#include <boost/fusion/include/at.hpp>
+#include <boost/type_traits/is_same.hpp>
+#include <boost/mpl/eval_if.hpp>
+#include <boost/mpl/identity.hpp>
+#include <boost/mpl/deref.hpp>
+#include <boost/mpl/end.hpp>
+#include <boost/mpl/find_if.hpp>
+
+namespace boost { namespace spirit { namespace qi { namespace detail
+{
+    // parser_binder for plain rules
+    template <typename Parser, typename Auto>
+    struct parser_binder
+    {
+        parser_binder(Parser const& p)
+          : p(p) {};
+
+        template <typename Iterator, typename Skipper, typename Context>
+        bool operator()(
+            Iterator& first, Iterator const& last
+          , Context& context, Skipper const& skipper) const
+        {
+            // If Auto is false, the component's attribute is unused.
+            return p.parse(first, last, context, skipper, unused);
+        }
+        Parser p;
+    };
+
+    // parser_binder for auto rules
+    template <typename Parser>
+    struct parser_binder<Parser, mpl::true_>
+    {
+        parser_binder(Parser const& p)
+          : p(p) {};
+
+        template <typename Iterator, typename Skipper, typename Context>
+        bool operator()(
+            Iterator& first, Iterator const& last
+          , Context& context, Skipper const& skipper) const
+        {
+            // If Auto is true, we pass the rule's attribute on to the component.
+            return p.parse(first, last, context, skipper
+                , fusion::at_c<0>(context.attributes));
+        }
+        Parser p;
+    };
+
+    template <typename Auto, typename Parser>
+    inline parser_binder<Parser, Auto>
+    bind_parser(Parser const& p)
+    {
+        return parser_binder<Parser, Auto>(p);
+    }
+
+    template <typename Types, typename Pred, typename Default>
+    struct extract_param
+    {
+        typedef typename mpl::find_if<Types, Pred>::type pos;
+
+        typedef typename
+            mpl::eval_if<
+                is_same<pos, typename mpl::end<Types>::type>
+              , mpl::identity<Default>
+              , mpl::deref<pos>
+            >::type
+        type;
+    };
+}}}}
+
+#endif
Deleted: trunk/boost/spirit/home/qi/nonterminal/detail/rule.hpp
==============================================================================
--- trunk/boost/spirit/home/qi/nonterminal/detail/rule.hpp	2009-04-26 10:42:24 EDT (Sun, 26 Apr 2009)
+++ (empty file)
@@ -1,133 +0,0 @@
-/*=============================================================================
-    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_RULE_FEB_12_2007_0440PM)
-#define BOOST_SPIRIT_RULE_FEB_12_2007_0440PM
-
-#include <boost/spirit/home/qi/nonterminal/virtual_component_base.hpp>
-#include <boost/assert.hpp>
-
-namespace boost { namespace spirit { namespace qi { namespace detail
-{
-    template <
-        typename Iterator, typename Component
-      , typename Context, typename Skipper
-      , typename Auto
-    >
-    struct virtual_component : virtual_component_base<Iterator, Context, Skipper>
-    {
-        typedef virtual_component_base<Iterator, Context, Skipper> base_type;
-        typedef typename base_type::skipper_type skipper_type;
-        typedef typename base_type::take_no_skipper take_no_skipper;
-
-        virtual_component(Component const& component)
-          : component(component)
-        {
-        }
-
-        virtual ~virtual_component()
-        {
-        }
-
-        template <typename T>
-        static void clear(T& attr)
-        {
-            attr = T();
-        }
-
-        template <typename Skipper_>
-        bool parse_main(
-            Iterator& first
-          , Iterator const& last
-          , Context& context
-          , Skipper_ const& skipper
-          , mpl::false_)
-        {
-            // If Auto is false, the component's attribute is unused.
-
-            typedef typename Component::director director;
-            return director::parse(
-                component, first, last, context, skipper, unused);
-        }
-
-        template <typename Skipper_>
-        bool parse_main(
-            Iterator& first
-          , Iterator const& last
-          , Context& context
-          , Skipper_ const& skipper
-          , mpl::true_)
-        {
-            // If Auto is true, we synthesize the rule's attribute and pass
-            // it on to the component. On successful parse, this attribute
-            // is swapped back to the the rule's attribute.
-
-            typename
-                remove_reference<
-                    typename fusion::result_of::value_at_c<
-                        typename fusion::result_of::value_at_c<Context, 0>::type
-                      , 0
-                    >::type
-                >::type
-            attribute; // default constructed
-            typedef typename Component::director director;
-            if (director::parse(
-                component, first, last, context, skipper, attribute))
-            {
-                // $$$ need to optimize this for fusion sequences $$$
-                std::swap(fusion::at_c<0>(fusion::at_c<0>(context)), attribute);
-                return true;
-            }
-            return false;
-        }
-
-        bool parse_main(
-            Iterator& /*first*/
-          , Iterator const& /*last*/
-          , Context&
-          , take_no_skipper
-          , mpl::false_)
-        {
-            BOOST_ASSERT(false); // this should never be called
-            return false;
-        }
-
-        bool parse_main(
-            Iterator& /*first*/
-          , Iterator const& /*last*/
-          , Context& /*context*/
-          , take_no_skipper
-          , mpl::true_)
-        {
-            BOOST_ASSERT(false); // this should never be called
-            return false;
-        }
-
-        virtual bool
-        parse(
-            Iterator& first
-          , Iterator const& last
-          , Context& context
-          , skipper_type const& skipper)
-        {
-            return parse_main(first, last, context, skipper, Auto());
-        }
-
-        virtual bool
-        parse(
-            Iterator& first
-          , Iterator const& last
-          , Context& context
-          , no_skipper)
-        {
-            return parse_main(first, last, context, unused, Auto());
-        }
-
-        Component component;
-    };
-}}}}
-
-#endif
Added: trunk/boost/spirit/home/qi/nonterminal/error_handler.hpp
==============================================================================
--- (empty file)
+++ trunk/boost/spirit/home/qi/nonterminal/error_handler.hpp	2009-04-26 10:42:24 EDT (Sun, 26 Apr 2009)
@@ -0,0 +1,119 @@
+/*=============================================================================
+    Copyright (c) 2001-2009 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_ERROR_HANDLER_APRIL_29_2007_1042PM)
+#define BOOST_SPIRIT_ERROR_HANDLER_APRIL_29_2007_1042PM
+
+#if defined(_MSC_VER)
+#pragma once
+#endif
+
+#include <boost/spirit/home/qi/operator/expect.hpp>
+#include <boost/spirit/home/qi/nonterminal/rule.hpp>
+#include <boost/function.hpp>
+
+namespace boost { namespace spirit { namespace qi
+{
+    enum error_handler_result
+    {
+        fail
+      , retry
+      , accept
+      , rethrow
+    };
+
+    template <
+        typename Iterator, typename Context
+      , typename Skipper, typename F, error_handler_result action
+    >
+    struct error_handler
+    {
+        typedef function<
+            bool(Iterator& first, Iterator const& last
+              , Context& context
+              , Skipper const& skipper
+            )>
+        function_type;
+
+        error_handler(function_type subject, F f)
+          : subject(subject)
+          , f(f)
+        {
+        }
+
+        bool operator()(
+            Iterator& first, Iterator const& last
+          , Context& context, Skipper const& skipper) const
+        {
+            while (true)
+            {
+                try
+                {
+                    Iterator i = first;
+                    bool r = subject(i, last, context, skipper);
+                    if (r)
+                        first = i;
+                    return r;
+                }
+                catch (expectation_failure<Iterator> const& x)
+                {
+                    typedef
+                        fusion::vector<
+                            Iterator&
+                          , Iterator const&
+                          , Iterator const&
+                          , info const&>
+                    params;
+                    error_handler_result r = action;
+                    params args(first, last, x.first, x.what);
+                    f(args, context, r);
+
+                    switch (r)
+                    {
+                        case fail: return false;
+                        case retry: continue;
+                        case accept: return true;
+                        case rethrow: throw x;
+                    }
+                }
+            }
+            return false;
+        }
+
+        function_type subject;
+        F f;
+    };
+
+    template <
+        error_handler_result action
+      , typename Iterator, typename T0, typename T1, typename T2
+      , typename F>
+    void on_error(rule<Iterator, T0, T1, T2>& r, F f)
+    {
+        typedef rule<Iterator, T0, T1, T2> rule_type;
+
+        typedef
+            error_handler<
+                Iterator
+              , typename rule_type::context_type
+              , typename rule_type::skipper_type
+              , F
+              , action>
+        error_handler;
+        r.f = error_handler(r.f, f);
+    }
+
+    // Error handling support when <action> is not
+    // specified. We will default to <fail>.
+    template <typename Iterator, typename T0, typename T1
+      , typename T2, typename F>
+    void on_error(rule<Iterator, T0, T1, T2>& r, F f)
+    {
+        on_error<fail>(r, f);
+    }
+}}}
+
+#endif
Deleted: trunk/boost/spirit/home/qi/nonterminal/error_handler_result.hpp
==============================================================================
--- trunk/boost/spirit/home/qi/nonterminal/error_handler_result.hpp	2009-04-26 10:42:24 EDT (Sun, 26 Apr 2009)
+++ (empty file)
@@ -1,21 +0,0 @@
-/*=============================================================================
-    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_ERROR_HANDLER_RESULT_APR_29_2007_1042PM)
-#define BOOST_SPIRIT_ERROR_HANDLER_RESULT_APR_29_2007_1042PM
-
-namespace boost { namespace spirit { namespace qi
-{
-    enum error_handler_result
-    {
-        fail
-      , retry
-      , accept
-      , rethrow
-    };
-}}}
-
-#endif
Modified: trunk/boost/spirit/home/qi/nonterminal/grammar.hpp
==============================================================================
--- trunk/boost/spirit/home/qi/nonterminal/grammar.hpp	(original)
+++ trunk/boost/spirit/home/qi/nonterminal/grammar.hpp	2009-04-26 10:42:24 EDT (Sun, 26 Apr 2009)
@@ -1,78 +1,91 @@
 /*=============================================================================
-    Copyright (c) 2001-2007 Joel de Guzman
+    Copyright (c) 2001-2009 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_FEB_19_2007_0236PM)
-#define BOOST_SPIRIT_GRAMMAR_FEB_19_2007_0236PM
+#if !defined(BOOST_SPIRIT_GRAMMAR_FEBRUARY_19_2007_0236PM)
+#define BOOST_SPIRIT_GRAMMAR_FEBRUARY_19_2007_0236PM
+
+#if defined(_MSC_VER)
+#pragma once
+#endif
 
 #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/support/info.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>
-#include <boost/fusion/include/at.hpp>
+#include <boost/spirit/home/qi/reference.hpp>
 #include <boost/noncopyable.hpp>
-#include <boost/type_traits/is_convertible.hpp>
 
 namespace boost { namespace spirit { namespace qi
 {
-    template <typename Iterator, typename T0 , typename T1 , typename T2>
+    template <
+        typename Iterator
+      , typename T1 = unused_type
+      , typename T2 = unused_type
+      , typename T3 = unused_type
+    >
     struct grammar
-      : nonterminal<
-            grammar<Iterator, T0, T1, T2>
-          , typename qi::rule<Iterator, T0, T1, T2>::sig_type
-          , typename qi::rule<Iterator, T0, T1, T2>::locals_type
-        >, noncopyable
+      : proto::extends<
+            typename proto::terminal<
+                reference<rule<Iterator, T1, T2, T3> const>
+            >::type
+          , grammar<Iterator, T1, T2, T3>
+        >
+      , parser<grammar<Iterator, T1, T2, T3> >
+      , noncopyable
     {
         typedef Iterator iterator_type;
-        typedef qi::rule<Iterator, T0, T1, T2> start_type;
+        typedef rule<Iterator, T1, T2, T3> 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;
-        typedef grammar<Iterator, T0, T1, T2> base_type;
-
-        grammar(start_type const& start, std::string const& name_ = std::string())
-          : start(start), name_(name_) {}
+        typedef grammar<Iterator, T1, T2, T3> base_type;
+        typedef reference<start_type const> reference_;
+        typedef typename proto::terminal<reference_>::type terminal;
+        static size_t const params_size = start_type::params_size;
+
+        grammar(
+            start_type const& start
+          , std::string const& name_ = "unnamed-grammar")
+        : proto::extends<terminal, base_type>(terminal::make(start.alias()))
+        , name_(name_)
+        {}
 
         std::string name() const
         {
             return name_;
         }
 
-        void name(std::string const& name__)
+        void name(std::string const& str)
         {
-            name_ = name__;
+            name_ = str;
         }
 
-        start_type const& start;
-        std::string name_;
-
-    private:
-
-        template <typename Iterator_, typename Context, typename Skipper>
-        bool parse(
-            Iterator_& first, Iterator_ const& last
-          , Context& context, Skipper const& skipper) const
+        template <typename Context, typename Skipper, typename Attribute>
+        bool parse(Iterator& first, Iterator const& last
+          , Context& context, Skipper const& skipper
+          , Attribute& attr) const
         {
-            return start.parse(first, last, context, skipper);
+            return this->proto_base().child0.parse(
+                first, last, context, skipper, attr);
         }
 
-        std::string what() const
+        template <typename Context>
+        info what(Context& context) const
         {
-            if (name().empty())
-            {
-                return start.what();
-            }
-            else
-            {
-                return name();
-            }
+            return info(name_);
         }
 
-        friend struct nonterminal_director;
+        // bring in the operator() overloads
+        start_type const& get_rule() const
+        { return this->proto_base().child0.ref.get(); }
+        typedef start_type rule_type;
+        #include <boost/spirit/home/qi/nonterminal/detail/fcall.hpp>
+
+        std::string name_;
+
     };
 }}}
 
Deleted: trunk/boost/spirit/home/qi/nonterminal/grammar_fwd.hpp
==============================================================================
--- trunk/boost/spirit/home/qi/nonterminal/grammar_fwd.hpp	2009-04-26 10:42:24 EDT (Sun, 26 Apr 2009)
+++ (empty file)
@@ -1,24 +0,0 @@
-/*=============================================================================
-    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
Deleted: trunk/boost/spirit/home/qi/nonterminal/meta_grammar.hpp
==============================================================================
--- trunk/boost/spirit/home/qi/nonterminal/meta_grammar.hpp	2009-04-26 10:42:24 EDT (Sun, 26 Apr 2009)
+++ (empty file)
@@ -1,61 +0,0 @@
-/*=============================================================================
-    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_META_GRAMMAR_FEB_12_2007_0534PM)
-#define BOOST_SPIRIT_META_GRAMMAR_FEB_12_2007_0534PM
-
-#include <boost/spirit/home/support/nonterminal/nonterminal.hpp>
-#include <boost/spirit/home/qi/domain.hpp>
-#include <boost/spirit/home/qi/nonterminal/rule.hpp>
-#include <boost/spirit/home/qi/nonterminal/grammar.hpp>
-#include <boost/spirit/home/support/meta_grammar.hpp>
-#include <boost/utility/enable_if.hpp>
-#include <boost/mpl/bool.hpp>
-#include <boost/mpl/identity.hpp>
-
-namespace boost { namespace spirit { namespace qi
-{
-    ///////////////////////////////////////////////////////////////////////////
-    // forwards
-    ///////////////////////////////////////////////////////////////////////////
-    template <typename Expr, typename Enable>
-    struct is_valid_expr;
-
-    template <typename Expr, typename Enable>
-    struct expr_transform;
-
-    ///////////////////////////////////////////////////////////////////////////
-    // nonterminal meta-grammar
-    ///////////////////////////////////////////////////////////////////////////
-    struct nonterminal_meta_grammar
-      : meta_grammar::terminal_rule<
-            qi::domain
-          , nonterminal_holder<proto::_, proto::_>
-          , nonterminal_director
-        >
-    {
-    };
-
-    ///////////////////////////////////////////////////////////////////////////
-    //  These specializations non-intrusively hooks into the RD meta-grammar.
-    //  (see qi/meta_grammar.hpp)
-    ///////////////////////////////////////////////////////////////////////////
-    template <typename Expr>
-    struct is_valid_expr<Expr
-      , typename enable_if<proto::matches<Expr, nonterminal_meta_grammar> >::type>
-      : mpl::true_
-    {
-    };
-
-    template <typename Expr>
-    struct expr_transform<Expr
-      , typename enable_if<proto::matches<Expr, nonterminal_meta_grammar> >::type>
-      : mpl::identity<nonterminal_meta_grammar>
-    {
-    };
-}}}
-
-#endif
Deleted: trunk/boost/spirit/home/qi/nonterminal/nonterminal.hpp
==============================================================================
--- trunk/boost/spirit/home/qi/nonterminal/nonterminal.hpp	2009-04-26 10:42:24 EDT (Sun, 26 Apr 2009)
+++ (empty file)
@@ -1,142 +0,0 @@
-/*=============================================================================
-    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_NONTERMINAL_FEB_19_2007_0236PM)
-#define BOOST_SPIRIT_NONTERMINAL_FEB_19_2007_0236PM
-
-#include <boost/spirit/home/support/nonterminal/nonterminal.hpp>
-#include <boost/spirit/home/support/nonterminal/locals.hpp>
-#include <boost/spirit/home/support/argument.hpp>
-
-#include <boost/proto/core.hpp>
-#include <boost/function_types/result_type.hpp>
-#include <boost/function_types/parameter_types.hpp>
-#include <boost/function_types/is_function.hpp>
-#include <boost/fusion/include/as_vector.hpp>
-#include <boost/fusion/include/mpl.hpp>
-#include <boost/fusion/include/joint_view.hpp>
-#include <boost/fusion/include/single_view.hpp>
-
-#include <boost/type_traits/add_reference.hpp>
-#include <boost/type_traits/is_same.hpp>
-#include <boost/mpl/if.hpp>
-#include <boost/mpl/filter_view.hpp>
-#include <boost/mpl/find_if.hpp>
-#include <boost/mpl/not.hpp>
-#include <boost/mpl/or.hpp>
-#include <boost/mpl/size.hpp>
-#include <boost/mpl/eval_if.hpp>
-#include <boost/preprocessor/enum_params.hpp>
-#include <boost/preprocessor/enum_params_with_a_default.hpp>
-#include <boost/utility/enable_if.hpp>
-
-namespace boost { namespace spirit { namespace qi
-{
-    template <typename Derived, typename Sig, typename Locals>
-    struct nonterminal
-      : proto::extends<
-            typename make_nonterminal_holder<
-                Derived const*, Derived
-            >::type
-          , Derived
-        >
-    {
-        typedef Sig sig_type;
-        typedef typename function_types::result_type<sig_type>::type attr_type_;
-
-        // This is the nonterminal return type
-        typedef typename
-            mpl::if_<
-                is_same<attr_type_, void>
-              , unused_type
-              , attr_type_
-            >::type
-        attr_type;
-        typedef typename add_reference<attr_type>::type attr_reference_type;
-
-        // param_types is a sequence of types passed as parameters to the nonterminal
-        typedef typename function_types::parameter_types<sig_type>::type param_types;
-
-        // locals_type is a sequence of types to be used as local variables
-        typedef typename fusion::result_of::as_vector<Locals>::type locals_type;
-
-        //  The overall context_type consist of a tuple with:
-        //      1) a tuple of the return value and parameters
-        //      2) the locals
-        typedef fusion::vector<
-                typename fusion::result_of::as_vector<
-                    fusion::joint_view<
-                        fusion::single_view<attr_reference_type>
-                      , param_types
-                    >
-                >::type
-              , typename fusion::result_of::as_vector<locals_type>::type
-            >
-        context_type;
-
-        typedef nonterminal<Derived, Sig, Locals> self_type;
-        typedef nonterminal_holder<Derived const*, Derived> nonterminal_holder_;
-        typedef typename proto::terminal<nonterminal_holder_>::type nonterminal_tag;
-        typedef proto::extends<nonterminal_tag, Derived> base_type;
-
-        explicit nonterminal()
-          : base_type(make_tag())
-        {
-        }
-
-        // bring in the operator() overloads
-        #include <boost/spirit/home/support/nonterminal/detail/nonterminal_fcall.hpp>
-
-    private:
-
-        nonterminal_tag make_tag() const
-        {
-            nonterminal_tag xpr = {{static_cast<Derived const*>(this)}};
-            return xpr;
-        }
-    };
-
-    template <typename Derived, typename T0, typename T1, typename T2>
-    struct make_nonterminal
-    {
-        typedef mpl::vector<T0, T1, T2> types;
-        typedef function_types::is_function<mpl::_> is_function;
-        typedef spirit::detail::is_locals<mpl::_> is_locals;
-        typedef spirit::traits::is_component<qi::domain, mpl::_> is_skipper;
-
-        typedef typename mpl::find_if<types, is_function>::type sig_;
-        typedef typename mpl::find_if<types, is_locals>::type locals_;
-        typedef typename mpl::find_if<types, is_skipper>::type skipper_;
-
-        typedef typename
-            mpl::eval_if<
-                is_same<sig_, typename mpl::end<types>::type>
-              , mpl::identity<unused_type()>
-              , mpl::deref<sig_>
-            >::type
-        sig_type;
-
-        typedef typename
-            mpl::eval_if<
-                is_same<locals_, typename mpl::end<types>::type>
-              , mpl::identity<locals<> >
-              , mpl::deref<locals_>
-            >::type
-        locals_type;
-
-        typedef typename
-            mpl::eval_if<
-                is_same<skipper_, typename mpl::end<types>::type>
-              , mpl::identity<unused_type>
-              , mpl::deref<skipper_>
-            >::type
-        skipper_type;
-
-        typedef nonterminal<Derived, sig_type, locals_type> type;
-    };
-}}}
-
-#endif
Deleted: trunk/boost/spirit/home/qi/nonterminal/nonterminal_director.hpp
==============================================================================
--- trunk/boost/spirit/home/qi/nonterminal/nonterminal_director.hpp	2009-04-26 10:42:24 EDT (Sun, 26 Apr 2009)
+++ (empty file)
@@ -1,170 +0,0 @@
-/*=============================================================================
-    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_NONTERMINAL_DIRECTOR_FEB_19_2007_0259PM)
-#define BOOST_SPIRIT_NONTERMINAL_DIRECTOR_FEB_19_2007_0259PM
-
-#include <boost/spirit/home/support/nonterminal/nonterminal.hpp>
-#include <boost/spirit/home/support/nonterminal/detail/expand_arg.hpp>
-#include <boost/spirit/home/qi/domain.hpp>
-#include <boost/spirit/home/support/component.hpp>
-#include <boost/spirit/home/support/detail/values.hpp>
-#include <boost/fusion/include/transform.hpp>
-#include <boost/fusion/include/join.hpp>
-#include <boost/fusion/include/single_view.hpp>
-#include <boost/intrusive_ptr.hpp>
-#include <boost/mpl/at.hpp>
-#include <boost/type_traits/is_same.hpp>
-#include <boost/type_traits/remove_const.hpp>
-
-namespace boost { namespace spirit { namespace qi
-{
-    struct nonterminal_director
-    {
-        template <typename Component, typename Context, typename Iterator>
-        struct attribute
-        {
-            typedef typename result_of::subject<Component>::type nonterminal_holder;
-            typedef typename nonterminal_holder::nonterminal_type::attr_type type;
-        };
-
-        template <
-            typename NonterminalContext, typename Nonterminal
-          , typename Iterator, typename Context
-          , typename Skipper, typename Attribute>
-        static bool parse_nonterminal(
-            nonterminal_object<Nonterminal> const& x
-          , Iterator& first, Iterator const& last
-          , Context& /*caller_context*/, Skipper const& skipper
-          , Attribute& attr)
-        {
-            // the nonterminal_holder holds an actual nonterminal_object
-            typedef typename Nonterminal::locals_type locals_type;
-            fusion::single_view<Attribute&> front(attr);
-            NonterminalContext context(front, locals_type());
-            return x.obj.parse(first, last, context, skipper);
-        }
-
-        template <
-            typename NonterminalContext, typename Nonterminal
-          , typename Iterator, typename Context
-          , typename Skipper, typename Attribute>
-        static bool parse_nonterminal(
-            Nonterminal const* ptr
-          , Iterator& first, Iterator const& last
-          , Context& /*caller_context*/, Skipper const& skipper
-          , Attribute& attr)
-        {
-            // the nonterminal_holder holds a pointer to a nonterminal
-            typedef typename Nonterminal::locals_type locals_type;
-            fusion::single_view<Attribute&> front(attr);
-            NonterminalContext context(front, locals_type());
-            return ptr->parse(first, last, context, skipper);
-        }
-
-        template <
-            typename NonterminalContext, typename Nonterminal, typename FSequence
-          , typename Iterator, typename Context
-          , typename Skipper, typename Attribute>
-        static bool parse_nonterminal(
-            parameterized_nonterminal<Nonterminal, FSequence> const& x
-          , Iterator& first, Iterator const& last
-          , Context& caller_context, Skipper const& skipper
-          , Attribute& attr)
-        {
-            // the nonterminal_holder holds a parameterized_nonterminal
-            typedef typename Nonterminal::locals_type locals_type;
-            fusion::single_view<Attribute&> front(attr);
-            NonterminalContext context(
-                fusion::join(
-                    front
-                  , fusion::transform(
-                        x.fseq
-                      , spirit::detail::expand_arg<Context>(caller_context)
-                    )
-                )
-              , locals_type()
-            );
-            return x.ptr->parse(first, last, context, skipper);
-        }
-
-        template <
-            typename Component
-          , typename Iterator, typename Context
-          , typename Skipper, typename Attribute>
-        static bool parse(
-            Component const& component
-          , Iterator& first, Iterator const& last
-          , Context& context, Skipper const& skipper
-          , Attribute& attr_)
-        {
-            // main entry point
-
-            typedef typename
-                result_of::subject<Component>::type
-            nonterminal_holder;
-
-            //  The overall context_type consist of a tuple with:
-            //      1) a tuple of the return value and parameters
-            //      2) the locals
-            //  if no signature is specified the first tuple contains
-            //  an unused_type element at position zero only.
-
-            typedef typename
-                nonterminal_holder::nonterminal_type::context_type
-            context_type;
-
-            //  attr_type is the return type as specified by the associated
-            //  nonterminal signature, if no signature is specified this is
-            //  the unused_type
-            typedef typename
-                nonterminal_holder::nonterminal_type::attr_type
-            attr_type;
-
-            // create an attribute if one is not supplied
-            typename mpl::if_<
-                is_same<typename remove_const<Attribute>::type, unused_type>
-              , attr_type
-              , Attribute&>::type
-            attr = spirit::detail::make_value<attr_type>::call(attr_);
-
-            return parse_nonterminal<context_type>(
-                subject(component).held
-              , first, last, context, skipper, attr
-            );
-        }
-
-        template <typename Nonterminal>
-        static std::string what_nonterminal(nonterminal_object<Nonterminal> const& x)
-        {
-            // the nonterminal_holder holds an actual nonterminal_object
-            return x.obj.what();
-        }
-
-        template <typename Nonterminal>
-        static std::string what_nonterminal(Nonterminal const* ptr)
-        {
-            // the nonterminal_holder holds a pointer to a nonterminal
-            return ptr->what();
-        }
-
-        template <typename Nonterminal, typename FSequence>
-        static std::string what_nonterminal(
-            parameterized_nonterminal<Nonterminal, FSequence> const& x)
-        {
-            // the nonterminal_holder holds a parameterized_nonterminal
-            return x.ptr->what();
-        }
-
-        template <typename Component, typename Context>
-        static std::string what(Component const& component, Context const& ctx)
-        {
-            return what_nonterminal(subject(component).held);
-        }
-    };
-}}}
-
-#endif
Modified: trunk/boost/spirit/home/qi/nonterminal/rule.hpp
==============================================================================
--- trunk/boost/spirit/home/qi/nonterminal/rule.hpp	(original)
+++ trunk/boost/spirit/home/qi/nonterminal/rule.hpp	2009-04-26 10:42:24 EDT (Sun, 26 Apr 2009)
@@ -1,369 +1,303 @@
 /*=============================================================================
-    Copyright (c) 2001-2007 Joel de Guzman
+    Copyright (c) 2001-2009 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_RULE_FEB_12_2007_1020AM)
-#define BOOST_SPIRIT_RULE_FEB_12_2007_1020AM
+#if !defined(BOOST_SPIRIT_RULE_FEBRUARY_12_2007_1020AM)
+#define BOOST_SPIRIT_RULE_FEBRUARY_12_2007_1020AM
 
-#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>
-#include <boost/mpl/if.hpp>
-#include <boost/mpl/assert.hpp>
-#include <boost/type_traits/is_convertible.hpp>
-
-#if defined(BOOST_MSVC)
-# pragma warning(push)
-# pragma warning(disable: 4355) // 'this' : used in base member initializer list warning
+#if defined(_MSC_VER)
+#pragma once
 #endif
 
+#include <boost/function.hpp>
+#include <boost/mpl/eval_if.hpp>
+#include <boost/function_types/result_type.hpp>
+#include <boost/function_types/parameter_types.hpp>
+#include <boost/function_types/is_function.hpp>
+#include <boost/type_traits/remove_reference.hpp>
+#include <boost/utility/enable_if.hpp>
+
+#include <boost/fusion/include/vector.hpp>
+#include <boost/fusion/include/make_vector.hpp>
+#include <boost/fusion/include/cons.hpp>
+#include <boost/fusion/include/as_list.hpp>
+#include <boost/fusion/include/as_vector.hpp>
+
+#include <boost/spirit/home/support/unused.hpp>
+#include <boost/spirit/home/support/argument.hpp>
+#include <boost/spirit/home/support/context.hpp>
+#include <boost/spirit/home/support/info.hpp>
+#include <boost/spirit/home/support/attributes.hpp>
+#include <boost/spirit/home/support/nonterminal/locals.hpp>
+#include <boost/spirit/home/qi/reference.hpp>
+#include <boost/spirit/home/qi/nonterminal/detail/parser_binder.hpp>
+
 namespace boost { namespace spirit { namespace qi
 {
-    namespace detail { struct rule_decorator; }
+    BOOST_PP_REPEAT(SPIRIT_ATTRIBUTES_LIMIT, SPIRIT_USING_ATTRIBUTE, _)
+
+    using spirit::_val;
+    using spirit::_a;
+    using spirit::_b;
+    using spirit::_c;
+    using spirit::_d;
+    using spirit::_e;
+    using spirit::_f;
+    using spirit::_g;
+    using spirit::_h;
+    using spirit::_i;
+    using spirit::_j;
+
+    using spirit::info;
+    using spirit::locals;
+
+    template <typename Rule, typename Params>
+    struct parameterized_rule : parser<parameterized_rule<Rule, Params> >
+    {
+        parameterized_rule(Rule const& rule, Params const& params)
+          : ref(rule), params(params) {}
+
+        template <typename Context, typename Iterator>
+        struct attribute : Rule::template attribute<Context, Iterator> {};
+
+        template <typename Parser, typename Context
+          , typename Skipper, typename Attribute>
+        bool parse(Parser& first, Parser const& last
+          , Context& context, Skipper const& skipper
+          , Attribute& attr) const
+        {
+            // We pass the additional params argument to parse
+            return ref.get().parse(first, last, context, skipper, attr, params);
+        }
+
+        template <typename Context>
+        info what(Context& context) const
+        {
+            return ref.get().what(context);
+        }
+
+        boost::reference_wrapper<Rule const> ref;
+        Params params;
+    };
 
     template <
         typename Iterator
-      , typename T0 = unused_type
       , typename T1 = unused_type
       , typename T2 = unused_type
+      , typename T3 = unused_type
     >
     struct rule
-      : make_nonterminal<rule<Iterator, T0, T1, T2>, T0, T1, T2>::type
+      : proto::extends<
+            typename proto::terminal<
+                reference<rule<Iterator, T1, T2, T3> const>
+            >::type
+          , rule<Iterator, T1, T2, T3>
+        >
+      , parser<rule<Iterator, T1, T2, T3> >
     {
-        typedef
-            make_nonterminal<rule<Iterator, T0, T1, T2>, T0, T1, T2>
-        make_nonterminal_;
-
-        typedef typename make_nonterminal_::skipper_type skipper_type;
-        typedef typename make_nonterminal_::type base_type;
-        typedef Iterator iterator_type;
-        typedef rule<Iterator, T0, T1, T2> self_type;
-
-        typedef
-            virtual_component_base<
-                Iterator
-              , typename base_type::context_type
-              , skipper_type
-            >
-        virtual_component;
+        typedef rule<Iterator, T1, T2, T3> this_type;
+        typedef reference<this_type const> reference_;
+        typedef typename proto::terminal<reference_>::type terminal;
+        typedef proto::extends<terminal, this_type> base_type;
+        typedef mpl::vector<T1, T2, T3> template_params;
+
+        // locals_type is a sequence of types to be used as local variables
+        typedef typename fusion::result_of::as_vector<
+            typename detail::extract_param<
+                    template_params
+                  , spirit::detail::is_locals<mpl::_>
+                  , locals<>
+                >::type
+            >::type
+        locals_type;
 
-        typedef intrusive_ptr<virtual_component> pointer_type;
+        // The skip-parser type
+        typedef typename
+            result_of::compile<
+                qi::domain
+              , typename detail::extract_param<
+                    template_params
+                  , traits::matches<qi::domain, mpl::_>
+                  , unused_type
+                >::type
+            >::type
+        skipper_type;
+
+        typedef typename
+            detail::extract_param<
+                template_params
+              , function_types::is_function<mpl::_>
+              , void()
+            >::type
+        sig_type;
 
-        rule(std::string const& name_ = std::string())
-          : name_(name_) {}
+        typedef typename function_types::result_type<sig_type>::type attr_type_;
 
-        ~rule() {}
+        // This is the rule's attribute type
+        typedef typename
+            mpl::if_<
+                is_same<attr_type_, void>
+              , unused_type
+              , attr_type_
+            >::type
+        attr_type;
+        typedef typename add_reference<attr_type>::type attr_reference_type;
+
+        // parameter_types is a sequence of types passed as parameters to the rule
+        typedef typename
+            function_types::parameter_types<sig_type>::type
+        params_;
+
+        typedef typename
+            fusion::result_of::as_list<params_>::type
+        parameter_types;
+
+        static size_t const params_size = mpl::size<params_>::value;
+
+        typedef context<
+            fusion::cons<attr_reference_type, parameter_types>
+          , locals_type>
+        context_type;
+
+        typedef function<
+            bool(Iterator& first, Iterator const& last
+              , context_type& context
+              , skipper_type const& skipper
+            )>
+        function_type;
+
+        rule(std::string const& name_ = "unnamed-rule")
+          : base_type(terminal::make(alias()))
+          , name_(name_)
+        {
+        }
 
         rule(rule const& rhs)
-          : ptr(rhs.ptr)
+          : base_type(terminal::make(alias()))
           , name_(rhs.name_)
+          , f(rhs.f)
         {
         }
 
         rule& operator=(rule const& rhs)
         {
-            ptr = rhs.ptr;
+            f = rhs.f;
             name_ = rhs.name_;
             return *this;
         }
 
-        template <typename Expr>
-        rule& operator=(Expr const& xpr)
+        std::string const& name() const
         {
-            typedef spirit::traits::is_component<qi::domain, Expr> is_component;
-
-            // report invalid expression error as early as possible
-//             BOOST_MPL_ASSERT_MSG(
-//                 is_component::value,
-//                 xpr_is_not_convertible_to_a_parser, ());
-
-            // temp workaround for mpl problem
-            BOOST_STATIC_ASSERT(is_component::value);
+            return name_;
+        }
 
-            define(xpr, mpl::false_());
-            return *this;
+        void name(std::string const& str)
+        {
+            name_ = str;
         }
 
         template <typename Expr>
-        friend rule& operator%=(rule& r, Expr const& xpr)
+        rule& operator=(Expr const& expr)
         {
-            typedef spirit::traits::is_component<qi::domain, Expr> is_component;
+            // Report invalid expression error as early as possible.
+            // If you got an error_invalid_expression error message here,
+            // then the expression (expr) is not a valid spirit qi expression.
+            BOOST_SPIRIT_ASSERT_MATCH(qi::domain, Expr)
 
-            // report invalid expression error as early as possible
-            //~ BOOST_MPL_ASSERT_MSG(
-                //~ is_component::value,
-                //~ xpr_is_not_convertible_to_a_parser, ());
-
-            // temp workaround for mpl problem
-            BOOST_STATIC_ASSERT(is_component::value);
-
-            r.define(xpr, mpl::true_());
-            return r;
+            f = detail::bind_parser<mpl::false_>(compile<qi::domain>(expr));
+            return *this;
         }
 
-        self_type alias() const
+        // g++ 3.3 barfs if this is a member function :(
+        template <typename Expr>
+        friend rule& operator%=(rule& r, Expr const& expr)
         {
-            self_type result;
-            result.define(*this, mpl::false_());
-            return result;
-        }
+            // Report invalid expression error as early as possible.
+            // If you got an error_invalid_expression error message here,
+            // then the expression (expr) is not a valid spirit qi expression.
+            BOOST_SPIRIT_ASSERT_MATCH(qi::domain, Expr)
 
-        typename
-            make_nonterminal_holder<
-                nonterminal_object<self_type>
-              , self_type
-            >::type
-        copy() const
-        {
-            typename
-                make_nonterminal_holder<
-                    nonterminal_object<self_type>
-                  , self_type
-                >::type
-            result = {{*this}};
-            return result;
+            r.f = detail::bind_parser<mpl::true_>(compile<qi::domain>(expr));
+            return r;
         }
 
-        std::string const& name() const
+        // non-const version needed to suppress proto's %= kicking in
+        template <typename Expr>
+        friend rule& operator%=(rule& r, Expr& expr)
         {
-            return name_;
+            return r %= static_cast<Expr const&>(expr);
         }
 
-        void name(std::string const& str)
+        template <typename Context, typename Iterator_>
+        struct attribute
         {
-            name_ = str;
-        }
-
-    private:
-
-        template <typename Iterator_, typename T0_, typename T1_, typename T2_>
-        friend struct grammar;
-
-        friend struct detail::rule_decorator;
-
-        template <typename Expr, typename Auto>
-        void define(Expr const& xpr, Auto)
-        {
-            typedef typename
-                result_of::as_component<qi::domain, Expr>::type
-            component;
-            typedef
-                detail::virtual_component<
-                    Iterator
-                  , component
-                  , typename base_type::context_type
-                  , skipper_type
-                  , Auto
-                >
-            virtual_component;
-            ptr = new virtual_component(spirit::as_component(qi::domain(), xpr));
-        }
-
-        template <typename Iterator_, typename Context, typename Skipper>
-        bool parse(
-            Iterator_& first, Iterator_ const& last
-          , Context& context, Skipper const& skipper) const
-        {
-            // 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
-            // defining the type of this rule instance.
-            return ptr->parse(first, last, context, skipper);
-        }
+            typedef attr_type type;
+        };
 
-        std::string what() const
+        template <typename Context, typename Skipper, typename Attribute>
+        bool parse(Iterator& first, Iterator const& last
+          , Context& /*context*/, Skipper const& skipper
+          , Attribute& attr) const
         {
-            if (name_.empty())
+            if (f)
             {
-                if (ptr)
-                {
-                    return "unnamed-rule";
-                }
-                else
+                value_initialized<attr_type> val;
+                context_type context(val);
+                if (f(first, last, context, skipper))
                 {
-                    return "empty-rule";
+                    traits::swap_impl(attr, boost::get(val));
+                    return true;
                 }
             }
-            else
-            {
-                return name_;
-            }
+            return false;
         }
 
-        friend struct nonterminal_director;
-        pointer_type ptr;
-        std::string name_;
-    };
-
-    // Decoration support: create a new virtual component and link it as
-    // first element in the chain of virtual components associated with this
-    // rule. Returns the previous topmost virtual component in the chain.
-    // We provide support from 1 to 5 arguments.
-
-    namespace detail
-    {
-        struct rule_decorator
+        template <typename Context, typename Skipper
+          , typename Attribute, typename Params>
+        bool parse(Iterator& first, Iterator const& last
+          , Context& caller_context, Skipper const& skipper
+          , Attribute& attr, Params const& params) const
         {
-            template <typename Decorator, typename Rule, typename A1>
-            typename Rule::pointer_type
-            static call(Rule& r, A1 const& a1)
+            if (f)
             {
-                typename Rule::pointer_type old (r.ptr);
-                r.ptr.reset(new Decorator(r.ptr, a1));
-                return old;
-            }
-
-            template <typename Decorator, typename Rule, typename A1, typename A2>
-            typename Rule::pointer_type
-            static call(Rule& r, A1 const& a1, A2 const& a2)
-            {
-                typename Rule::pointer_type old (r.ptr);
-                r.ptr.reset(new Decorator(r.ptr, a1, a2));
-                return old;
-            }
-
-            template <typename Decorator, typename Rule
-              , typename A1, typename A2, typename A3
-            >
-            typename Rule::pointer_type
-            static call(Rule& r
-              , A1 const& a1, A2 const& a2, A3 const& a3)
-            {
-                typename Rule::pointer_type old (r.ptr);
-                r.ptr.reset(new Decorator(r.ptr, a1, a2, a3));
-                return old;
+                value_initialized<attr_type> val;
+                context_type context(val, params, caller_context);
+                if (f(first, last, context, skipper))
+                {
+                    traits::swap_impl(attr, boost::get(val));
+                    return true;
+                }
             }
+            return false;
+        }
 
-            template <typename Decorator, typename Rule
-              , typename A1, typename A2, typename A3, typename A4
-            >
-            typename Rule::pointer_type
-            static call(Rule& r
-              , A1 const& a1, A2 const& a2
-              , A3 const& a3, A4 const& a4)
-            {
-                typename Rule::pointer_type old (r.ptr);
-                r.ptr.reset(new Decorator(r.ptr, a1, a2, a3, a4));
-                return old;
-            }
+        template <typename Context>
+        info what(Context& context) const
+        {
+            return info(name_);
+        }
 
-            template <typename Decorator, typename Rule
-              , typename A1, typename A2, typename A3, typename A4, typename A5
-            >
-            typename Rule::pointer_type
-            static call(Rule& r
-              , A1 const& a1, A2 const& a2
-              , A3 const& a3, A4 const& a4, A5 const& a5)
-            {
-                typename Rule::pointer_type old (r.ptr);
-                r.ptr.reset(new Decorator(r.ptr, a1, a2, a3, a4, a5));
-                return old;
-            }
-        };
-    }
+        reference_ alias() const
+        {
+            return reference_(*this);
+        }
 
-    template <typename Decorator
-      , typename Iterator, typename T0, typename T1, typename T2
-      , typename A1>
-    typename rule<Iterator, T0, T1, T2>::pointer_type
-    decorate(rule<Iterator, T0, T1, T2>& r
-      , A1 const& a1)
-    {
-        return detail::rule_decorator::
-            template call<Decorator>(r, a1);
-    }
-
-    template <typename Decorator
-      , typename Iterator, typename T0, typename T1, typename T2
-      , typename A1, typename A2
-    >
-    typename rule<Iterator, T0, T1, T2>::pointer_type
-    decorate(rule<Iterator, T0, T1, T2>& r
-      , A1 const& a1, A2 const& a2)
-    {
-        return detail::rule_decorator::
-            template call<Decorator>(r, a1, a2);
-    }
-
-    template <typename Decorator
-      , typename Iterator, typename T0, typename T1, typename T2
-      , typename A1, typename A2, typename A3
-    >
-    typename rule<Iterator, T0, T1, T2>::pointer_type
-    decorate(rule<Iterator, T0, T1, T2>& r
-      , A1 const& a1, A2 const& a2, A3 const& a3)
-    {
-        return detail::rule_decorator::
-            template call<Decorator>(r, a1, a2, a3);
-    }
-
-    template <typename Decorator
-      , typename Iterator, typename T0, typename T1, typename T2
-      , typename A1, typename A2, typename A3, typename A4
-    >
-    typename rule<Iterator, T0, T1, T2>::pointer_type
-    decorate(rule<Iterator, T0, T1, T2>& r
-      , A1 const& a1, A2 const& a2
-      , A3 const& a3, A4 const& a4)
-    {
-        return detail::rule_decorator::
-            template call<Decorator>(r, a1, a2, a3, a4);
-    }
-
-    template <typename Decorator
-      , typename Iterator, typename T0, typename T1, typename T2
-      , typename A1, typename A2, typename A3, typename A4, typename A5
-    >
-    typename rule<Iterator, T0, T1, T2>::pointer_type
-    decorate(rule<Iterator, T0, T1, T2>& r
-      , A1 const& a1, A2 const& a2
-      , A3 const& a3, A4 const& a4, A5 const& a5)
-    {
-        return detail::rule_decorator::
-            template call<Decorator>(r, a1, a2, a3, a4, a5);
-    }
+        typename proto::terminal<this_type>::type copy() const
+        {
+            typename proto::terminal<this_type>::type result = {*this};
+            return result;
+        }
 
-    // Error handling support
-    template <
-        error_handler_result action
-      , typename Iterator, typename T0, typename T1, typename T2
-      , typename F>
-    void on_error(rule<Iterator, T0, T1, T2>& r, F f)
-    {
-        typedef
-            rule<Iterator, T0, T1, T2>
-        rule_type;
-
-        typedef
-            detail::error_handler<
-                Iterator
-              , typename rule_type::base_type::context_type
-              , typename rule_type::skipper_type
-              , F
-              , action>
-        error_handler;
-        decorate<error_handler>(r, f);
-    }
-
-    // Error handling support when <action> is not
-    // specified. We will default to <fail>.
-    template <typename Iterator, typename T0, typename T1
-      , typename T2, typename F>
-    void on_error(rule<Iterator, T0, T1, T2>& r, F f)
-    {
-        on_error<fail>(r, f);
-    }
+        // bring in the operator() overloads
+        rule const& get_rule() const { return *this; }
+        typedef this_type rule_type;
+        #include <boost/spirit/home/qi/nonterminal/detail/fcall.hpp>
 
+        std::string name_;
+        function_type f;
+    };
 }}}
 
-#if defined(BOOST_MSVC)
-# pragma warning(pop)
-#endif
-
 #endif
Added: trunk/boost/spirit/home/qi/nonterminal/simple_trace.hpp
==============================================================================
--- (empty file)
+++ trunk/boost/spirit/home/qi/nonterminal/simple_trace.hpp	2009-04-26 10:42:24 EDT (Sun, 26 Apr 2009)
@@ -0,0 +1,132 @@
+/*=============================================================================
+    Copyright (c) 2001-2009 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_SIMPLE_TRACE_DECEMBER_06_2008_1102AM)
+#define BOOST_SPIRIT_SIMPLE_TRACE_DECEMBER_06_2008_1102AM
+
+#if defined(_MSC_VER)
+#pragma once
+#endif
+
+#include <boost/fusion/include/out.hpp>
+#include <iostream>
+
+//  The stream to use for debug output
+#if !defined(BOOST_SPIRIT_DEBUG_OUT)
+#define BOOST_SPIRIT_DEBUG_OUT std::cerr
+#endif
+
+//  number of input tokens to print while debugging
+#if !defined(BOOST_SPIRIT_DEBUG_PRINT_SOME)
+#define BOOST_SPIRIT_DEBUG_PRINT_SOME 20
+#endif
+
+//  number of spaces to indent
+#if !defined(BOOST_SPIRIT_DEBUG_INDENT)
+#define BOOST_SPIRIT_DEBUG_INDENT 2
+#endif
+
+#if !defined(BOOST_FUSION_UNUSED_HAS_IO)
+namespace boost { namespace fusion
+{
+    namespace detail
+    {
+        struct unused_only
+        {
+            unused_only(unused_type const&) {}
+        };
+    }
+
+    template <typename Out>
+    inline Out& operator<<(Out& out, detail::unused_only const&)
+    {
+        return out;
+    }
+
+    template <typename In>
+    inline In& operator>>(In& in, unused_type&)
+    {
+        return in;
+    }
+}}
+#endif
+
+namespace boost { namespace spirit { namespace qi
+{
+    struct simple_trace
+    {
+        void print_indent(int n) const
+        {
+            n *= BOOST_SPIRIT_DEBUG_INDENT;
+            for (int i = 0; i != n; ++i)
+                BOOST_SPIRIT_DEBUG_OUT << ' ';
+        }
+
+        template <typename Iterator>
+        void print_some(
+            char const* tag
+          , int indent
+          , Iterator first, Iterator const& last) const
+        {
+            print_indent(indent);
+            BOOST_SPIRIT_DEBUG_OUT << '<' << tag << '>';
+            int const n = BOOST_SPIRIT_DEBUG_PRINT_SOME;
+            for (int i = 0; first != last && i != n; ++i, ++first)
+                BOOST_SPIRIT_DEBUG_OUT << *first;
+            BOOST_SPIRIT_DEBUG_OUT << "</" << tag << '>' << std::endl;
+        }
+
+        template <typename Iterator, typename Context, typename State>
+        void operator()(
+            Iterator const& first
+          , Iterator const& last
+          , Context const& context
+          , State state
+          , std::string const& rule_name) const
+        {
+            int static indent = 0;
+
+            switch (state)
+            {
+                case pre_parse:
+                    print_indent(indent++);
+                    BOOST_SPIRIT_DEBUG_OUT
+                        << '<' << rule_name << '>'
+                        << std::endl;
+                    print_some("try", indent, first, last);
+                    break;
+                case successful_parse:
+                    print_some("success", indent, first, last);
+                    print_indent(indent);
+                    BOOST_SPIRIT_DEBUG_OUT
+                        << "<attributes>"
+                        << context.attributes
+                        << "</attributes>";
+                    if (!fusion::empty(context.locals))
+                        BOOST_SPIRIT_DEBUG_OUT
+                            << "<locals>"
+                            << context.locals
+                            << "</locals>";
+                    BOOST_SPIRIT_DEBUG_OUT << std::endl;
+                    print_indent(--indent);
+                    BOOST_SPIRIT_DEBUG_OUT
+                        << "</" << rule_name << '>'
+                        << std::endl;
+                    break;
+                case failed_parse:
+                    print_indent(indent);
+                    BOOST_SPIRIT_DEBUG_OUT << "<fail/>" << std::endl;
+                    print_indent(--indent);
+                    BOOST_SPIRIT_DEBUG_OUT
+                        << "</" << rule_name << '>'
+                        << std::endl;
+                    break;
+            }
+        }
+    };
+}}}
+
+#endif
Deleted: trunk/boost/spirit/home/qi/nonterminal/virtual_component_base.hpp
==============================================================================
--- trunk/boost/spirit/home/qi/nonterminal/virtual_component_base.hpp	2009-04-26 10:42:24 EDT (Sun, 26 Apr 2009)
+++ (empty file)
@@ -1,85 +0,0 @@
-/*=============================================================================
-    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_VIRTUAL_COMPONENT_BASE_FEB_12_2007_0440PM)
-#define BOOST_SPIRIT_VIRTUAL_COMPONENT_BASE_FEB_12_2007_0440PM
-
-#include <boost/spirit/home/support/unused.hpp>
-#include <boost/spirit/home/support/component.hpp>
-#include <boost/intrusive_ptr.hpp>
-#include <boost/detail/atomic_count.hpp>
-#include <boost/mpl/eval_if.hpp>
-#include <boost/mpl/identity.hpp>
-#include <boost/type_traits/is_same.hpp>
-
-namespace boost { namespace spirit { namespace qi
-{
-    struct no_skipper
-    {
-        // this struct accepts only unused types and
-        // nothing else. This is used by the second
-        // pure virtual parse member function of
-        // virtual_component_base below.
-
-        no_skipper(unused_type) {}
-    };
-
-    template <typename Iterator, typename Context, typename Skipper>
-    struct virtual_component_base
-    {
-        struct take_no_skipper {};
-
-        typedef typename
-            mpl::eval_if<
-                is_same<Skipper, unused_type>
-              , mpl::identity<take_no_skipper>
-              , result_of::as_component<qi::domain, Skipper>
-            >::type
-        skipper_type;
-
-        virtual_component_base()
-          : use_count(0)
-        {
-        }
-
-        virtual ~virtual_component_base()
-        {
-        }
-
-        virtual bool
-        parse(
-            Iterator& first
-          , Iterator const& last
-          , Context& context
-          , skipper_type const& skipper) = 0;
-
-        virtual bool
-        parse(
-            Iterator& first
-          , Iterator const& last
-          , Context& context
-          , no_skipper) = 0;
-
-        boost::detail::atomic_count use_count;
-    };
-
-    template <typename Iterator, typename Context, typename Skipper>
-    inline void
-    intrusive_ptr_add_ref(virtual_component_base<Iterator, Context, Skipper>* p)
-    {
-        ++p->use_count;
-    }
-
-    template <typename Iterator, typename Context, typename Skipper>
-    inline void
-    intrusive_ptr_release(virtual_component_base<Iterator, Context, Skipper>* p)
-    {
-        if (--p->use_count == 0)
-            delete p;
-    }
-}}}
-
-#endif
Modified: trunk/boost/spirit/home/qi/numeric.hpp
==============================================================================
--- trunk/boost/spirit/home/qi/numeric.hpp	(original)
+++ trunk/boost/spirit/home/qi/numeric.hpp	2009-04-26 10:42:24 EDT (Sun, 26 Apr 2009)
@@ -1,15 +1,18 @@
 /*=============================================================================
-    Copyright (c) 2001-2007 Joel de Guzman
+    Copyright (c) 2001-2009 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_NUMERIC_FEB_05_2007_1231PM)
-#define BOOST_SPIRIT_NUMERIC_FEB_05_2007_1231PM
+#if !defined(BOOST_SPIRIT_NUMERIC_FEBRUARY_05_2007_1231PM)
+#define BOOST_SPIRIT_NUMERIC_FEBRUARY_05_2007_1231PM
+
+#if defined(_MSC_VER)
+#pragma once
+#endif
 
 #include <boost/spirit/home/qi/numeric/int.hpp>
 #include <boost/spirit/home/qi/numeric/uint.hpp>
 #include <boost/spirit/home/qi/numeric/real.hpp>
-#include <boost/spirit/home/qi/numeric/meta_grammar.hpp>
 
 #endif
Modified: trunk/boost/spirit/home/qi/numeric/detail/numeric_utils.hpp
==============================================================================
--- trunk/boost/spirit/home/qi/numeric/detail/numeric_utils.hpp	(original)
+++ trunk/boost/spirit/home/qi/numeric/detail/numeric_utils.hpp	2009-04-26 10:42:24 EDT (Sun, 26 Apr 2009)
@@ -1,17 +1,21 @@
 /*=============================================================================
-    Copyright (c) 2001-2007 Joel de Guzman
+    Copyright (c) 2001-2009 Joel de Guzman
     Copyright (c) 2001-2009 Hartmut Kaiser
     Copyright (c) 2006 Stephen Nutt
 
     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(SPIRIT_NUMERIC_UTILS_APR_17_2006_0816AM)
-#define SPIRIT_NUMERIC_UTILS_APR_17_2006_0816AM
+#if !defined(SPIRIT_NUMERIC_UTILS_APRIL_17_2006_0816AM)
+#define SPIRIT_NUMERIC_UTILS_APRIL_17_2006_0816AM
+
+#if defined(_MSC_VER)
+#pragma once
+#endif
 
 #include <boost/detail/iterator.hpp>
 #include <boost/spirit/home/support/unused.hpp>
-#include <boost/spirit/home/support/char_class/ascii.hpp>
+#include <boost/spirit/home/support/char_encoding/ascii.hpp>
 #include <boost/preprocessor/repetition/repeat.hpp>
 #include <boost/utility/enable_if.hpp>
 #include <boost/mpl/bool.hpp>
@@ -136,7 +140,7 @@
         {
             if (ch >= '0' && ch <= '9')
                 return ch - '0';
-            return spirit::char_class::ascii::tolower(ch) - 'a' + 10;
+            return spirit::char_encoding::ascii::tolower(ch) - 'a' + 10;
         }
 
         template<typename T>
@@ -316,10 +320,10 @@
     >
     struct extract_int
     {
-#if BOOST_WORKAROUND(BOOST_MSVC, >= 1400)  
-# pragma warning(push)  
+#if BOOST_WORKAROUND(BOOST_MSVC, >= 1400)
+# pragma warning(push)
 # pragma warning(disable: 4127)   // conditional expression is constant
-#endif 
+#endif
         template <typename Iterator, typename Attribute>
         static bool
         parse_main(
@@ -364,9 +368,9 @@
             }
             return false;
         }
-#if BOOST_WORKAROUND(BOOST_MSVC, >= 1400)  
-# pragma warning(pop)  
-#endif 
+#if BOOST_WORKAROUND(BOOST_MSVC, >= 1400)
+# pragma warning(pop)
+#endif
 
         template <typename Iterator>
         static bool
@@ -408,10 +412,10 @@
     template <typename T, unsigned Radix, typename Accumulator, bool Accumulate>
     struct extract_int<T, Radix, 1, -1, Accumulator, Accumulate>
     {
-#if BOOST_WORKAROUND(BOOST_MSVC, >= 1400)  
-# pragma warning(push)  
+#if BOOST_WORKAROUND(BOOST_MSVC, >= 1400)
+# pragma warning(push)
 # pragma warning(disable: 4127)   // conditional expression is constant
-#endif 
+#endif
         template <typename Iterator, typename Attribute>
         static bool
         parse_main(
@@ -471,9 +475,9 @@
             first = it;
             return true;
         }
-#if BOOST_WORKAROUND(BOOST_MSVC, >= 1400)  
-# pragma warning(pop)  
-#endif 
+#if BOOST_WORKAROUND(BOOST_MSVC, >= 1400)
+# pragma warning(pop)
+#endif
 
         template <typename Iterator>
         static bool
Modified: trunk/boost/spirit/home/qi/numeric/detail/real_impl.hpp
==============================================================================
--- trunk/boost/spirit/home/qi/numeric/detail/real_impl.hpp	(original)
+++ trunk/boost/spirit/home/qi/numeric/detail/real_impl.hpp	2009-04-26 10:42:24 EDT (Sun, 26 Apr 2009)
@@ -1,49 +1,100 @@
 /*=============================================================================
-    Copyright (c) 2001-2007 Joel de Guzman
+    Copyright (c) 2001-2009 Joel de Guzman
     Copyright (c) 2001-2009 Hartmut Kaiser
     http://spirit.sourceforge.net/
 
     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(SPIRIT_REAL_IMPL_APR_18_2006_0901AM)
-#define SPIRIT_REAL_IMPL_APR_18_2006_0901AM
+#if !defined(SPIRIT_REAL_IMPL_APRIL_18_2006_0901AM)
+#define SPIRIT_REAL_IMPL_APRIL_18_2006_0901AM
 
-#include <boost/config/no_tr1/cmath.hpp>
+#if defined(_MSC_VER)
+#pragma once
+#endif
+
+#include <cmath>
+#include <limits>
 #include <boost/type_traits/is_same.hpp>
 #include <boost/spirit/home/support/unused.hpp>
+#include <boost/spirit/home/support/detail/pow10.hpp>
+#include <boost/spirit/home/support/detail/sign.hpp>
+#include <boost/assert.hpp>
+
+#if BOOST_WORKAROUND(BOOST_MSVC, >= 1400)
+# pragma warning(push)
+# pragma warning(disable: 4100)   // 'p': unreferenced formal parameter
+# pragma warning(disable: 4127)   // conditional expression is constant
+#endif
 
 namespace boost { namespace spirit { namespace qi  { namespace detail
 {
     namespace
     {
+        using spirit::detail::pow10;
+
         template <typename T>
         inline void
-        scale_number(T const& exp, T& n)
+        scale_number(int exp, T& n)
         {
-            using namespace std;    // allow for ADL to find the correct overload
-            n *= pow(T(10), exp);
+            if (exp >= 0)
+            {
+                // $$$ Why is this failing for boost.math.concepts ? $$$
+                //~ int nn = std::numeric_limits<T>::max_exponent10;
+                //~ BOOST_ASSERT(exp <= std::numeric_limits<T>::max_exponent10);
+                n *= pow10<T>(exp);
+            }
+            else
+            {
+                if (exp < std::numeric_limits<T>::min_exponent10)
+                {
+                    n /= pow10<T>(-std::numeric_limits<T>::min_exponent10);
+                    n /= pow10<T>(-exp + std::numeric_limits<T>::min_exponent10);
+                }
+                else
+                {
+                    n /= pow10<T>(-exp);
+                }
+            }
         }
 
         inline void
-        scale_number(unused_type /*exp*/, unused_type /*n*/)
+        scale_number(int /*exp*/, unused_type /*n*/)
         {
             // no-op for unused_type
         }
 
         template <typename T>
         inline void
-        scale_number(T const& exp, int frac, T& n)
+        scale_number(int exp, int frac, T& n)
         {
-            scale_number(exp - T(frac), n);
+            scale_number(exp - frac, n);
         }
 
         inline void
-        scale_number(unused_type /*exp*/, int /*frac*/, unused_type /*n*/)
+        scale_number(int /*exp*/, int /*frac*/, unused_type /*n*/)
         {
             // no-op for unused_type
         }
 
+          inline float
+        negate_number(bool neg, float n)
+        {
+            return neg ? spirit::detail::changesign(n) : n;
+        }
+
+        inline double
+        negate_number(bool neg, double n)
+        {
+            return neg ? spirit::detail::changesign(n) : n;
+        }
+
+        inline long double
+        negate_number(bool neg, long double n)
+        {
+            return neg ? spirit::detail::changesign(n) : n;
+        }
+
         template <typename T>
         inline T
         negate_number(bool neg, T const& n)
@@ -57,7 +108,7 @@
             // no-op for unused_type
             return n;
         }
-        
+
         template <typename T>
         inline bool
         number_equal_to_one(T const& value)
@@ -73,18 +124,12 @@
         }
     }
 
-#if BOOST_WORKAROUND(BOOST_MSVC, >= 1400)  
-# pragma warning(push)  
-# pragma warning(disable: 4100)   // 'p': unreferenced formal parameter  
-# pragma warning(disable: 4127)   // conditional expression is constant
-#endif 
-
     template <typename T, typename RealPolicies>
     struct real_impl
     {
         template <typename Iterator, typename Attribute>
         static bool
-        parse(Iterator& first, Iterator const& last, Attribute& attr, 
+        parse(Iterator& first, Iterator const& last, Attribute& attr,
             RealPolicies const& p)
         {
             if (first == last)
@@ -99,7 +144,7 @@
             Attribute n = 0;
             bool got_a_number = p.parse_n(first, last, n);
 
-            // If we did not get a number it might be a NaN, Inf or a leading 
+            // If we did not get a number it might be a NaN, Inf or a leading
             // dot.
             if (!got_a_number)
             {
@@ -111,7 +156,7 @@
                     attr = negate_number(neg, attr);
                     return true;    // got a NaN or Inf, return early
                 }
-                
+
                 // If we did not get a number and our policies do not
                 // allow a leading dot, fail and return early (no-match)
                 if (!p.allow_leading_dot)
@@ -120,7 +165,7 @@
                     return false;
                 }
             }
-            
+
             bool e_hit = false;
             int frac_digits = 0;
 
@@ -136,7 +181,7 @@
                     // Optimization note: don't compute frac_digits if T is
                     // an unused_type. This should be optimized away by the compiler.
                     if (!is_same<T, unused_type>::value)
-                        frac_digits = 
+                        frac_digits =
                             static_cast<int>(std::distance(savef, first));
                 }
                 else if (!got_a_number || !p.allow_trailing_dot)
@@ -174,7 +219,7 @@
             {
                 // We got the exponent prefix. Now we will try to parse the
                 // actual exponent. It is an error if it is not there.
-                Attribute exp = 0;
+                int exp = 0;
                 if (p.parse_exp_n(first, last, exp))
                 {
                     // Got the exponent value. Scale the number by
@@ -191,11 +236,11 @@
             else if (frac_digits)
             {
                 // No exponent found. Scale the number by -frac_digits.
-                scale_number(Attribute(-frac_digits), n);
+                scale_number(-frac_digits, n);
             }
             else if (number_equal_to_one(n))
             {
-                // There is a chance of having to parse one of the 1.0#... 
+                // There is a chance of having to parse one of the 1.0#...
                 // styles some implementations use for representing NaN or Inf.
 
                 // Check whether the number to parse is a NaN or Inf
@@ -207,7 +252,7 @@
                     return true;    // got a NaN or Inf, return immediately
                 }
             }
-            
+
             // If we got a negative sign, negate the number
             attr = negate_number(neg, n);
 
@@ -216,9 +261,9 @@
         }
     };
 
-#if BOOST_WORKAROUND(BOOST_MSVC, >= 1400)  
-# pragma warning(pop)  
-#endif 
+#if BOOST_WORKAROUND(BOOST_MSVC, >= 1400)
+# pragma warning(pop)
+#endif
 
 }}}}
 
Modified: trunk/boost/spirit/home/qi/numeric/int.hpp
==============================================================================
--- trunk/boost/spirit/home/qi/numeric/int.hpp	(original)
+++ trunk/boost/spirit/home/qi/numeric/int.hpp	2009-04-26 10:42:24 EDT (Sun, 26 Apr 2009)
@@ -1,5 +1,5 @@
 /*=============================================================================
-    Copyright (c) 2001-2007 Joel de Guzman
+    Copyright (c) 2001-2009 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)
@@ -7,47 +7,135 @@
 #if !defined(BOOST_SPIRIT_INT_APR_17_2006_0830AM)
 #define BOOST_SPIRIT_INT_APR_17_2006_0830AM
 
-#include <boost/spirit/home/qi/skip.hpp>
+#if defined(_MSC_VER)
+#pragma once
+#endif
+
+#include <boost/spirit/home/qi/skip_over.hpp>
 #include <boost/spirit/home/qi/numeric/numeric_utils.hpp>
+#include <boost/spirit/home/qi/meta_compiler.hpp>
+#include <boost/spirit/home/qi/parser.hpp>
+#include <boost/spirit/home/support/common_terminals.hpp>
+#include <boost/spirit/home/support/info.hpp>
 #include <boost/mpl/assert.hpp>
 
+namespace boost { namespace spirit
+{
+    ///////////////////////////////////////////////////////////////////////////
+    // Enablers
+    ///////////////////////////////////////////////////////////////////////////
+    template <>
+    struct use_terminal<qi::domain, tag::short_> // enables short_
+      : mpl::true_ {};
+
+    template <>
+    struct use_terminal<qi::domain, tag::int_> // enables int_
+      : mpl::true_ {};
+
+    template <>
+    struct use_terminal<qi::domain, tag::long_> // enables long_
+      : mpl::true_ {};
+
+#ifdef BOOST_HAS_LONG_LONG
+    template <>
+    struct use_terminal<qi::domain, tag::long_long> // enables long_long
+      : mpl::true_ {};
+#endif
+}}
+
 namespace boost { namespace spirit { namespace qi
 {
-    template <typename T, unsigned Radix, unsigned MinDigits, int MaxDigits>
-    struct int_parser
+    using spirit::short_;
+    using spirit::short__type;
+    using spirit::int_;
+    using spirit::int__type;
+    using spirit::long_;
+    using spirit::long__type;
+#ifdef BOOST_HAS_LONG_LONG
+    using spirit::long_long;
+    using spirit::long_long_type;
+#endif
+
+    ///////////////////////////////////////////////////////////////////////////
+    // This is the actual int parser
+    ///////////////////////////////////////////////////////////////////////////
+    template <
+        typename T
+      , unsigned Radix = 10
+      , unsigned MinDigits = 1
+      , int MaxDigits = -1>
+    struct int_parser_impl
+      : primitive_parser<int_parser_impl<T, Radix, MinDigits, MaxDigits> >
     {
         // check template parameter 'Radix' for validity
         BOOST_MPL_ASSERT_MSG(
             Radix == 2 || Radix == 8 || Radix == 10 || Radix == 16,
             not_supported_radix, ());
 
-        template <typename Component, typename Context, typename Iterator>
+        template <typename Context, typename Iterator>
         struct attribute
         {
             typedef T type;
         };
 
-        template <
-            typename Component
-          , typename Iterator, typename Context
+        template <typename Iterator, typename Context
           , typename Skipper, typename Attribute>
-        static bool parse(
-            Component const& /*component*/
-          , Iterator& first, Iterator const& last
+        bool parse(Iterator& first, Iterator const& last
           , Context& /*context*/, Skipper const& skipper
-          , Attribute& attr)
+          , Attribute& attr) const
         {
-            qi::skip(first, last, skipper);
+            qi::skip_over(first, last, skipper);
             return extract_int<T, Radix, MinDigits, MaxDigits>
                 ::call(first, last, attr);
         }
 
-        template <typename Component, typename Context>
-        static std::string what(Component const& component, Context const& ctx)
+        template <typename Context>
+        info what(Context& /*context*/) const
         {
-            return "integer";
+            return info("integer");
         }
     };
+
+    ///////////////////////////////////////////////////////////////////////////
+    // This one is the class that the user can instantiate directly
+    ///////////////////////////////////////////////////////////////////////////
+    template <
+        typename T
+      , unsigned Radix = 10
+      , unsigned MinDigits = 1
+      , int MaxDigits = -1>
+    struct int_parser
+      : proto::terminal<int_parser_impl<T, Radix, MinDigits, MaxDigits> >::type
+    {
+    };
+
+    ///////////////////////////////////////////////////////////////////////////
+    // Parser generators: make_xxx function (objects)
+    ///////////////////////////////////////////////////////////////////////////
+    template <typename T>
+    struct make_int
+    {
+        typedef int_parser_impl<T> result_type;
+        result_type operator()(unused_type, unused_type) const
+        {
+            return result_type();
+        }
+    };
+
+    template <typename Modifiers>
+    struct make_primitive<tag::short_, Modifiers> : make_int<short> {};
+
+    template <typename Modifiers>
+    struct make_primitive<tag::int_, Modifiers> : make_int<int> {};
+
+    template <typename Modifiers>
+    struct make_primitive<tag::long_, Modifiers> : make_int<long> {};
+
+#ifdef BOOST_HAS_LONG_LONG
+    template <typename Modifiers>
+    struct make_primitive<tag::long_long, Modifiers> : make_int<long long> {};
+#endif
+
 }}}
 
 #endif
Deleted: trunk/boost/spirit/home/qi/numeric/meta_grammar.hpp
==============================================================================
--- trunk/boost/spirit/home/qi/numeric/meta_grammar.hpp	2009-04-26 10:42:24 EDT (Sun, 26 Apr 2009)
+++ (empty file)
@@ -1,312 +0,0 @@
-/*=============================================================================
-    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_META_GRAMMAR_FEB_05_2007_0951AM)
-#define BOOST_SPIRIT_META_GRAMMAR_FEB_05_2007_0951AM
-
-#include <boost/spirit/home/qi/domain.hpp>
-#include <boost/spirit/home/support/placeholders.hpp>
-#include <boost/spirit/home/support/meta_grammar.hpp>
-#include <boost/spirit/home/qi/numeric/real_policies.hpp>
-#include <boost/utility/enable_if.hpp>
-
-namespace boost { namespace spirit
-{
-    namespace qi
-    {
-        template <typename T, unsigned Radix, unsigned MinDigits, int MaxDigits>
-        struct int_tag;
-
-        template <typename T, unsigned Radix, unsigned MinDigits, int MaxDigits>
-        struct uint_tag;
-
-        template <typename T, typename RealPolicies>
-        struct real_tag;
-    }
-
-    template <typename T, unsigned Radix, unsigned MinDigits, int MaxDigits>
-    struct is_int_tag<qi::int_tag<T, Radix, MinDigits, MaxDigits>, qi::domain> 
-      : mpl::true_ {};
-
-    template <typename T, unsigned Radix, unsigned MinDigits, int MaxDigits>
-    struct is_int_tag<qi::uint_tag<T, Radix, MinDigits, MaxDigits>, qi::domain> 
-      : mpl::true_ {};
-
-    template <typename T, typename RealPolicies>
-    struct is_real_tag<qi::real_tag<T, RealPolicies>, qi::domain> 
-      : mpl::true_ {};
-}}
-
-namespace boost { namespace spirit { namespace qi
-{
-    ///////////////////////////////////////////////////////////////////////////
-    // forwards
-    ///////////////////////////////////////////////////////////////////////////
-    template <typename T, unsigned Radix, unsigned MinDigits, int MaxDigits>
-    struct int_parser;
-
-    template <typename T, unsigned Radix, unsigned MinDigits, int MaxDigits>
-    struct uint_parser;
-
-    template <typename T, typename RealPolicies>
-    struct real_parser;
-
-    template <typename Expr, typename Enable>
-    struct is_valid_expr;
-
-    template <typename Expr, typename Enable>
-    struct expr_transform;
-
-    ///////////////////////////////////////////////////////////////////////////
-    // numeric tags
-    ///////////////////////////////////////////////////////////////////////////
-    template <typename T, unsigned Radix, unsigned MinDigits, int MaxDigits>
-    struct int_tag
-    {
-    };
-
-    template <typename T, unsigned Radix, unsigned MinDigits, int MaxDigits>
-    struct uint_tag
-    {
-    };
-
-    template <typename T, typename RealPolicies>
-    struct real_tag
-    {
-        RealPolicies policies;
-    };
-
-    ///////////////////////////////////////////////////////////////////////////
-    // numeric specs
-    ///////////////////////////////////////////////////////////////////////////
-    template <
-        typename T = int
-      , unsigned Radix = 10
-      , unsigned MinDigits = 1
-      , int MaxDigits = -1
-    >
-    struct int_spec
-      : proto::terminal<
-            int_tag<T, Radix, MinDigits, MaxDigits>
-        >::type
-    {
-    };
-
-    template <
-        typename T = int
-      , unsigned Radix = 10
-      , unsigned MinDigits = 1
-      , int MaxDigits = -1
-    >
-    struct uint_spec
-      : proto::terminal<
-            uint_tag<T, Radix, MinDigits, MaxDigits>
-        >::type
-    {
-    };
-
-    ///////////////////////////////////////////////////////////////////////////
-    template <
-        typename T = double,
-        typename RealPolicies = real_policies<T>
-    >
-    struct real_spec
-      : proto::terminal<
-            real_tag<T, RealPolicies>
-        >::type
-    {
-    private:
-        typedef typename 
-            proto::terminal<real_tag<T, RealPolicies> >::type
-        base_type;
-
-        base_type make_tag(RealPolicies const& p) const
-        {
-            base_type xpr = {{p}};
-            return xpr;
-        }
-
-    public:
-        real_spec(RealPolicies const& p = RealPolicies())
-          : base_type(make_tag(p))
-        {}
-    };
-
-    ///////////////////////////////////////////////////////////////////////////
-    namespace detail
-    {
-        template <typename RealPolicies>
-        struct real_policy
-        {
-            template <typename Tag>
-            static RealPolicies get(Tag) { return RealPolicies(); }
-
-            template <typename T>
-            static RealPolicies const& get(real_tag<T, RealPolicies> const& p) 
-            { return p.policies; }
-        };
-    }
-    
-    ///////////////////////////////////////////////////////////////////////////
-    // get the director of an int tag
-    ///////////////////////////////////////////////////////////////////////////
-    template <typename T>
-    struct extract_int_director;
-
-    template <>
-    struct extract_int_director<tag::bin>
-    {
-        typedef uint_parser<unsigned, 2, 1, -1> type;
-    };
-
-    template <>
-    struct extract_int_director<tag::oct>
-    {
-        typedef uint_parser<unsigned, 8, 1, -1> type;
-    };
-
-    template <>
-    struct extract_int_director<tag::hex>
-    {
-        typedef uint_parser<unsigned, 16, 1, -1> type;
-    };
-
-    template <>
-    struct extract_int_director<tag::ushort>
-    {
-        typedef uint_parser<unsigned short, 10, 1, -1> type;
-    };
-
-    template <>
-    struct extract_int_director<tag::ulong>
-    {
-        typedef uint_parser<unsigned long, 10, 1, -1> type;
-    };
-
-    template <>
-    struct extract_int_director<tag::uint>
-    {
-        typedef uint_parser<unsigned int, 10, 1, -1> type;
-    };
-
-    template <>
-    struct extract_int_director<tag::short_>
-    {
-        typedef int_parser<short, 10, 1, -1> type;
-    };
-
-    template <>
-    struct extract_int_director<tag::long_>
-    {
-        typedef int_parser<long, 10, 1, -1> type;
-    };
-
-    template <>
-    struct extract_int_director<tag::int_>
-    {
-        typedef int_parser<int, 10, 1, -1> type;
-    };
-
-#ifdef BOOST_HAS_LONG_LONG
-    template <>
-    struct extract_int_director<tag::ulong_long>
-    {
-        typedef uint_parser<unsigned long long, 10, 1, -1> type;
-    };
-
-    template <>
-    struct extract_int_director<tag::long_long>
-    {
-        typedef int_parser<long long, 10, 1, -1> type;
-    };
-#endif
-
-    template <typename T, unsigned Radix, unsigned MinDigits, int MaxDigits>
-    struct extract_int_director<int_tag<T, Radix, MinDigits, MaxDigits> >
-    {
-        typedef int_parser<T, Radix, MinDigits, MaxDigits> type;
-    };
-
-    template <typename T, unsigned Radix, unsigned MinDigits, int MaxDigits>
-    struct extract_int_director<uint_tag<T, Radix, MinDigits, MaxDigits> >
-    {
-        typedef uint_parser<T, Radix, MinDigits, MaxDigits> type;
-    };
-
-    ///////////////////////////////////////////////////////////////////////////
-    // get the director of a real tag
-    ///////////////////////////////////////////////////////////////////////////
-    template <typename T>
-    struct extract_real_director;
-
-    template <>
-    struct extract_real_director<tag::float_>
-    {
-        typedef real_parser<float, real_policies<float> > type;
-    };
-
-    template <>
-    struct extract_real_director<tag::double_>
-    {
-        typedef real_parser<double, real_policies<double> > type;
-    };
-
-    template <>
-    struct extract_real_director<tag::long_double>
-    {
-        typedef real_parser<long double, real_policies<long double> > type;
-    };
-
-    template <typename T, typename RealPolicies>
-    struct extract_real_director<real_tag<T, RealPolicies> >
-    {
-        typedef real_parser<T, RealPolicies> type;
-    };
-
-    ///////////////////////////////////////////////////////////////////////////
-    // numeric parser meta-grammar
-    ///////////////////////////////////////////////////////////////////////////
-    struct int_meta_grammar
-      : meta_grammar::compose_empty<
-            proto::if_<is_int_tag<proto::_child, qi::domain>()>
-          , qi::domain
-          , mpl::identity<extract_int_director<mpl::_> >
-        >
-    {};
-
-    struct real_meta_grammar
-      : meta_grammar::compose_single<
-            proto::if_<is_real_tag<proto::_child, qi::domain>()>
-          , qi::domain
-          , mpl::identity<extract_real_director<mpl::_> >
-        >
-    {};
-
-    struct numeric_meta_grammar
-      : proto::or_<int_meta_grammar, real_meta_grammar>
-    {
-    };
-
-    ///////////////////////////////////////////////////////////////////////////
-    //  These specializations non-intrusively hooks into the RD meta-grammar.
-    //  (see qi/meta_grammar.hpp)
-    ///////////////////////////////////////////////////////////////////////////
-    template <typename Expr>
-    struct is_valid_expr<Expr
-      , typename enable_if<proto::matches<Expr, numeric_meta_grammar> >::type>
-      : mpl::true_
-    {
-    };
-
-    template <typename Expr>
-    struct expr_transform<Expr
-      , typename enable_if<proto::matches<Expr, numeric_meta_grammar> >::type>
-      : mpl::identity<numeric_meta_grammar>
-    {
-    };
-}}}
-
-#endif
Modified: trunk/boost/spirit/home/qi/numeric/numeric_utils.hpp
==============================================================================
--- trunk/boost/spirit/home/qi/numeric/numeric_utils.hpp	(original)
+++ trunk/boost/spirit/home/qi/numeric/numeric_utils.hpp	2009-04-26 10:42:24 EDT (Sun, 26 Apr 2009)
@@ -1,11 +1,15 @@
 /*=============================================================================
-    Copyright (c) 2001-2007 Joel de Guzman
+    Copyright (c) 2001-2009 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_NUMERIC_UTILS_APR_17_2006_0830AM)
-#define BOOST_SPIRIT_NUMERIC_UTILS_APR_17_2006_0830AM
+#if !defined(BOOST_SPIRIT_NUMERIC_UTILS_APRIL_17_2006_0830AM)
+#define BOOST_SPIRIT_NUMERIC_UTILS_APRIL_17_2006_0830AM
+
+#if defined(_MSC_VER)
+#pragma once
+#endif
 
 #include <boost/spirit/home/qi/numeric/detail/numeric_utils.hpp>
 #include <boost/assert.hpp>
@@ -13,9 +17,9 @@
 
 namespace boost { namespace spirit { namespace qi
 {
-    ///////////////////////////////////////////////////////////////////////
+    ///////////////////////////////////////////////////////////////////////////
     //  Extract the prefix sign (- or +), return true if a '-' was found
-    ///////////////////////////////////////////////////////////////////////
+    ///////////////////////////////////////////////////////////////////////////
     template <typename Iterator>
     inline bool
     extract_sign(Iterator& first, Iterator const& last)
@@ -32,9 +36,9 @@
         return false;
     }
 
-    ///////////////////////////////////////////////////////////////////////
+    ///////////////////////////////////////////////////////////////////////////
     // Low level unsigned integer parser
-    ///////////////////////////////////////////////////////////////////////
+    ///////////////////////////////////////////////////////////////////////////
     template <typename T, unsigned Radix, unsigned MinDigits, int MaxDigits
       , bool Accumulate = false>
     struct extract_uint
@@ -66,9 +70,9 @@
         }
     };
 
-    ///////////////////////////////////////////////////////////////////////
+    ///////////////////////////////////////////////////////////////////////////
     // Low level signed integer parser
-    ///////////////////////////////////////////////////////////////////////
+    ///////////////////////////////////////////////////////////////////////////
     template <typename T, unsigned Radix, unsigned MinDigits, int MaxDigits>
     struct extract_int
     {
Modified: trunk/boost/spirit/home/qi/numeric/real.hpp
==============================================================================
--- trunk/boost/spirit/home/qi/numeric/real.hpp	(original)
+++ trunk/boost/spirit/home/qi/numeric/real.hpp	2009-04-26 10:42:24 EDT (Sun, 26 Apr 2009)
@@ -1,60 +1,118 @@
 /*=============================================================================
-    Copyright (c) 2001-2007 Joel de Guzman
+    Copyright (c) 2001-2009 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_REAL_APR_18_2006_0850AM)
-#define BOOST_SPIRIT_REAL_APR_18_2006_0850AM
+#if !defined(BOOST_SPIRIT_REAL_APRIL_18_2006_0850AM)
+#define BOOST_SPIRIT_REAL_APRIL_18_2006_0850AM
 
-#include <boost/spirit/home/qi/skip.hpp>
+#if defined(_MSC_VER)
+#pragma once
+#endif
+
+#include <boost/spirit/home/qi/skip_over.hpp>
 #include <boost/spirit/home/qi/numeric/real_policies.hpp>
 #include <boost/spirit/home/qi/numeric/numeric_utils.hpp>
 #include <boost/spirit/home/qi/numeric/detail/real_impl.hpp>
+#include <boost/spirit/home/qi/meta_compiler.hpp>
+#include <boost/spirit/home/qi/parser.hpp>
+#include <boost/spirit/home/support/common_terminals.hpp>
 
-namespace boost { namespace spirit { namespace qi
+namespace boost { namespace spirit
 {
-    namespace detail
-    {
-        template <typename RealPolicies>
-        struct real_policy;
-    }
+    ///////////////////////////////////////////////////////////////////////////
+    // Enablers
+    ///////////////////////////////////////////////////////////////////////////
+    template <>
+    struct use_terminal<qi::domain, tag::float_> // enables float_
+      : mpl::true_ {};
+
+    template <>
+    struct use_terminal<qi::domain, tag::double_> // enables double_
+      : mpl::true_ {};
+
+    template <>
+    struct use_terminal<qi::domain, tag::long_double> // enables long_double
+      : mpl::true_ {};
+}}
 
+namespace boost { namespace spirit { namespace qi
+{
+    using spirit::float_;
+    using spirit::float__type;
+    using spirit::double_;
+    using spirit::double__type;
+    using spirit::long_double;
+    using spirit::long_double_type;
+
+    ///////////////////////////////////////////////////////////////////////////
+    // This is the actual real number parser
+    ///////////////////////////////////////////////////////////////////////////
     template <
         typename T = double,
         typename RealPolicies = real_policies<T>
     >
-    struct real_parser
+    struct real_parser_impl
+      : primitive_parser<real_parser_impl<T, RealPolicies> >
     {
-        template <typename Component, typename Context, typename Iterator>
+        template <typename Context, typename Iterator>
         struct attribute
         {
             typedef T type;
         };
 
-        template <
-            typename Component
-          , typename Iterator, typename Context
+        template <typename Iterator, typename Context
           , typename Skipper, typename Attribute>
-        static bool parse(
-            Component const& component
-          , Iterator& first, Iterator const& last
+        bool parse(Iterator& first, Iterator const& last
           , Context& /*context*/, Skipper const& skipper
-          , Attribute& attr)
+          , Attribute& attr) const
         {
-            RealPolicies const& p = detail::real_policy<RealPolicies>::get(
-                fusion::at_c<0>(component.elements));
+            qi::skip_over(first, last, skipper);
+            return detail::real_impl<T, RealPolicies>::
+                parse(first, last, attr, RealPolicies());
+        }
 
-            qi::skip(first, last, skipper);
-            return detail::real_impl<T, RealPolicies>::parse(first, last, attr, p);
+        template <typename Context>
+        info what(Context& /*context*/) const
+        {
+            return info("real-number");
         }
+    };
+
+    ///////////////////////////////////////////////////////////////////////////
+    // This one is the class that the user can instantiate directly
+    ///////////////////////////////////////////////////////////////////////////
+    template <
+        typename T = double,
+        typename RealPolicies = real_policies<T>
+    >
+    struct real_parser
+      : proto::terminal<real_parser_impl<T, RealPolicies> >::type
+    {
+    };
 
-        template <typename Component, typename Context>
-        static std::string what(Component const& component, Context const& ctx)
+    ///////////////////////////////////////////////////////////////////////////
+    // Parser generators: make_xxx function (objects)
+    ///////////////////////////////////////////////////////////////////////////
+    template <typename T>
+    struct make_real
+    {
+        typedef real_parser_impl<T, real_policies<T> > result_type;
+        result_type operator()(unused_type, unused_type) const
         {
-            return "real number";
+            return result_type();
         }
     };
+
+    template <typename Modifiers>
+    struct make_primitive<tag::float_, Modifiers> : make_real<float> {};
+
+    template <typename Modifiers>
+    struct make_primitive<tag::double_, Modifiers> : make_real<double> {};
+
+    template <typename Modifiers>
+    struct make_primitive<tag::long_double, Modifiers> : make_real<long double> {};
 }}}
 
 #endif
Modified: trunk/boost/spirit/home/qi/numeric/real_policies.hpp
==============================================================================
--- trunk/boost/spirit/home/qi/numeric/real_policies.hpp	(original)
+++ trunk/boost/spirit/home/qi/numeric/real_policies.hpp	2009-04-26 10:42:24 EDT (Sun, 26 Apr 2009)
@@ -1,15 +1,19 @@
 /*=============================================================================
-    Copyright (c) 2001-2007 Joel de Guzman
+    Copyright (c) 2001-2009 Joel de Guzman
+    Copyright (c) 2001-2009 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(SPIRIT_REAL_POLICIES_APR_17_2006_1158PM)
-#define SPIRIT_REAL_POLICIES_APR_17_2006_1158PM
+#if !defined(SPIRIT_REAL_POLICIES_APRIL_17_2006_1158PM)
+#define SPIRIT_REAL_POLICIES_APRIL_17_2006_1158PM
+
+#if defined(_MSC_VER)
+#pragma once
+#endif
 
 #include <boost/spirit/home/qi/numeric/numeric_utils.hpp>
 #include <boost/spirit/home/qi/detail/string_parse.hpp>
-#include <boost/detail/iterator.hpp>                // boost::iterator_traits<>
 
 namespace boost { namespace spirit { namespace qi
 {
@@ -65,37 +69,37 @@
             return true;
         }
 
-        template <typename Iterator, typename Attribute>
+        template <typename Iterator>
         static bool
-        parse_exp_n(Iterator& first, Iterator const& last, Attribute& attr)
+        parse_exp_n(Iterator& first, Iterator const& last, int& attr)
         {
-            return extract_int<T, 10, 1, -1>::call(first, last, attr);
+            return extract_int<int, 10, 1, -1>::call(first, last, attr);
         }
-        
+
         ///////////////////////////////////////////////////////////////////////
         //  The parse_nan() and parse_inf() functions get called whenever:
         //
-        //    - a number to parse does not start with a digit (after having 
+        //    - a number to parse does not start with a digit (after having
         //      successfully parsed an optional sign)
         //
         //  or
         //
-        //    - after a floating point number of the value 1 (having no 
-        //      exponential part and a fractional part value of 0) has been 
-        //      parsed. 
+        //    - after a floating point number of the value 1 (having no
+        //      exponential part and a fractional part value of 0) has been
+        //      parsed.
         //
         //  The first call allows to recognize representations of NaN or Inf
-        //  starting with a non-digit character (such as NaN, Inf, QNaN etc.). 
+        //  starting with a non-digit character (such as NaN, Inf, QNaN etc.).
         //
-        //  The second call allows to recognize representation formats starting 
+        //  The second call allows to recognize representation formats starting
         //  with a 1.0 (such as 1.0#QNAN or 1.0#INF etc.).
         //
-        //  The functions should return true if a Nan or Inf has been found. In 
-        //  this case the attr should be set to the matched value (NaN or 
+        //  The functions should return true if a Nan or Inf has been found. In
+        //  this case the attr should be set to the matched value (NaN or
         //  Inf). The optional sign will be automatically applied afterwards.
         //
-        //  The default implementation below recognizes representations of NaN 
-        //  and Inf as mandated by the C99 Standard and as proposed for 
+        //  The default implementation below recognizes representations of NaN
+        //  and Inf as mandated by the C99 Standard and as proposed for
         //  inclusion into the C++0x Standard: nan, nan(...), inf and infinity
         //  (the matching is performed case-insensitively).
         ///////////////////////////////////////////////////////////////////////
@@ -105,10 +109,10 @@
         {
             if (first == last)
                 return false;   // end of input reached
-            
+
             if (*first != 'n' && *first != 'N')
                 return false;   // not "nan"
-            
+
             // nan[(...)] ?
             if (detail::string_parse("nan", "NAN", first, last, unused))
             {
@@ -128,7 +132,7 @@
                 return true;
             }
             return false;
-        }        
+        }
 
         template <typename Iterator, typename Attribute>
         static bool
@@ -136,12 +140,12 @@
         {
             if (first == last)
                 return false;   // end of input reached
-            
+
             if (*first != 'i' && *first != 'I')
                 return false;   // not "inf"
-            
+
             // inf or infinity ?
-            if (detail::string_parse("inf", "INF", first, last, unused)) 
+            if (detail::string_parse("inf", "INF", first, last, unused))
             {
                 // skip allowed 'inity' part of infinity
                 detail::string_parse("inity", "INITY", first, last, unused);
@@ -149,7 +153,7 @@
                 return true;
             }
             return false;
-        }        
+        }
     };
 
     ///////////////////////////////////////////////////////////////////////////
Modified: trunk/boost/spirit/home/qi/numeric/uint.hpp
==============================================================================
--- trunk/boost/spirit/home/qi/numeric/uint.hpp	(original)
+++ trunk/boost/spirit/home/qi/numeric/uint.hpp	2009-04-26 10:42:24 EDT (Sun, 26 Apr 2009)
@@ -1,5 +1,5 @@
 /*=============================================================================
-    Copyright (c) 2001-2007 Joel de Guzman
+    Copyright (c) 2001-2009 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)
@@ -7,47 +7,172 @@
 #if !defined(SPIRIT_UINT_APR_17_2006_0901AM)
 #define SPIRIT_UINT_APR_17_2006_0901AM
 
-#include <boost/spirit/home/qi/skip.hpp>
+#if defined(_MSC_VER)
+#pragma once
+#endif
+
+#include <boost/spirit/home/qi/skip_over.hpp>
 #include <boost/spirit/home/qi/numeric/numeric_utils.hpp>
+#include <boost/spirit/home/qi/meta_compiler.hpp>
+#include <boost/spirit/home/qi/parser.hpp>
+#include <boost/spirit/home/support/common_terminals.hpp>
+#include <boost/spirit/home/support/info.hpp>
 #include <boost/mpl/assert.hpp>
 
+namespace boost { namespace spirit
+{
+    ///////////////////////////////////////////////////////////////////////////
+    // Enablers
+    ///////////////////////////////////////////////////////////////////////////
+    template <>
+    struct use_terminal<qi::domain, tag::bin> // enables bin
+      : mpl::true_ {};
+
+    template <>
+    struct use_terminal<qi::domain, tag::oct> // enables oct
+      : mpl::true_ {};
+
+    template <>
+    struct use_terminal<qi::domain, tag::hex> // enables hex
+      : mpl::true_ {};
+
+    template <>
+    struct use_terminal<qi::domain, tag::ushort_> // enables ushort_
+      : mpl::true_ {};
+
+    template <>
+    struct use_terminal<qi::domain, tag::ulong_> // enables ulong_
+      : mpl::true_ {};
+
+    template <>
+    struct use_terminal<qi::domain, tag::uint_> // enables uint_
+      : mpl::true_ {};
+
+#ifdef BOOST_HAS_LONG_LONG
+    template <>
+    struct use_terminal<qi::domain, tag::ulong_long> // enables ulong_long
+      : mpl::true_ {};
+#endif
+}}
+
 namespace boost { namespace spirit { namespace qi
 {
-    template <typename T, unsigned Radix, unsigned MinDigits, int MaxDigits>
-    struct uint_parser
+    using spirit::bin;
+    using spirit::bin_type;
+    using spirit::oct;
+    using spirit::oct_type;
+    using spirit::hex;
+    using spirit::hex_type;
+    using spirit::ushort_;
+    using spirit::ushort__type;
+    using spirit::ulong_;
+    using spirit::ulong__type;
+    using spirit::uint_;
+    using spirit::uint__type;
+#ifdef BOOST_HAS_LONG_LONG
+    using spirit::ulong_long;
+    using spirit::ulong_long_type;
+#endif
+
+    ///////////////////////////////////////////////////////////////////////////
+    // This actual unsigned int parser
+    ///////////////////////////////////////////////////////////////////////////
+    template <
+        typename T
+      , unsigned Radix = 10
+      , unsigned MinDigits = 1
+      , int MaxDigits = -1>
+    struct uint_parser_impl
+      : primitive_parser<uint_parser_impl<T, Radix, MinDigits, MaxDigits> >
     {
         // check template parameter 'Radix' for validity
         BOOST_MPL_ASSERT_MSG(
             Radix == 2 || Radix == 8 || Radix == 10 || Radix == 16,
             not_supported_radix, ());
 
-        template <typename Component, typename Context, typename Iterator>
+        template <typename Context, typename Iterator>
         struct attribute
         {
             typedef T type;
         };
 
-        template <
-            typename Component
-          , typename Iterator, typename Context
+        template <typename Iterator, typename Context
           , typename Skipper, typename Attribute>
-        static bool parse(
-            Component const& /*component*/
-          , Iterator& first, Iterator const& last
+        bool parse(Iterator& first, Iterator const& last
           , Context& /*context*/, Skipper const& skipper
-          , Attribute& attr)
+          , Attribute& attr) const
         {
-            qi::skip(first, last, skipper);
+            qi::skip_over(first, last, skipper);
             return extract_uint<T, Radix, MinDigits, MaxDigits>
                 ::call(first, last, attr);
         }
 
-        template <typename Component, typename Context>
-        static std::string what(Component const& component, Context const& ctx)
+        template <typename Context>
+        info what(Context& /*context*/) const
         {
-            return "unsigned integer";
+            return info("unsigned-integer");
         }
     };
+
+    ///////////////////////////////////////////////////////////////////////////
+    // uint_parser is the class that the user can instantiate directly
+    ///////////////////////////////////////////////////////////////////////////
+    template <
+        typename T
+      , unsigned Radix = 10
+      , unsigned MinDigits = 1
+      , int MaxDigits = -1>
+    struct uint_parser
+      : proto::terminal<uint_parser_impl<T, Radix, MinDigits, MaxDigits> >::type
+    {
+    };
+
+    ///////////////////////////////////////////////////////////////////////////
+    // Parser generators: make_xxx function (objects)
+    ///////////////////////////////////////////////////////////////////////////
+    template <
+        typename T
+      , unsigned Radix = 10
+      , unsigned MinDigits = 1
+      , int MaxDigits = -1>
+    struct make_uint
+    {
+        typedef uint_parser_impl<T, Radix, MinDigits, MaxDigits> result_type;
+        result_type operator()(unused_type, unused_type) const
+        {
+            return result_type();
+        }
+    };
+
+    template <typename Modifiers>
+    struct make_primitive<tag::bin, Modifiers>
+      : make_uint<unsigned, 2, 1, -1> {};
+
+    template <typename Modifiers>
+    struct make_primitive<tag::oct, Modifiers>
+      : make_uint<unsigned, 8, 1, -1> {};
+
+    template <typename Modifiers>
+    struct make_primitive<tag::hex, Modifiers>
+      : make_uint<unsigned, 16, 1, -1> {};
+
+    template <typename Modifiers>
+    struct make_primitive<tag::ushort_, Modifiers>
+      : make_uint<unsigned short> {};
+
+    template <typename Modifiers>
+    struct make_primitive<tag::ulong_, Modifiers>
+      : make_uint<unsigned long> {};
+
+    template <typename Modifiers>
+    struct make_primitive<tag::uint_, Modifiers>
+      : make_uint<unsigned int> {};
+
+#ifdef BOOST_HAS_LONG_LONG
+    template <typename Modifiers>
+    struct make_primitive<tag::ulong_long, Modifiers>
+      : make_uint<unsigned long long> {};
+#endif
 }}}
 
 #endif
Modified: trunk/boost/spirit/home/qi/operator.hpp
==============================================================================
--- trunk/boost/spirit/home/qi/operator.hpp	(original)
+++ trunk/boost/spirit/home/qi/operator.hpp	2009-04-26 10:42:24 EDT (Sun, 26 Apr 2009)
@@ -1,11 +1,15 @@
 /*=============================================================================
-    Copyright (c) 2001-2007 Joel de Guzman
+    Copyright (c) 2001-2009 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_OPERATOR_FEB_02_2007_0558PM)
-#define BOOST_SPIRIT_OPERATOR_FEB_02_2007_0558PM
+#if !defined(BOOST_SPIRIT_OPERATOR_FEBRUARY_02_2007_0558PM)
+#define BOOST_SPIRIT_OPERATOR_FEBRUARY_02_2007_0558PM
+
+#if defined(_MSC_VER)
+#pragma once
+#endif
 
 #include <boost/spirit/home/qi/operator/sequence.hpp>
 #include <boost/spirit/home/qi/operator/expect.hpp>
@@ -19,6 +23,5 @@
 #include <boost/spirit/home/qi/operator/plus.hpp>
 #include <boost/spirit/home/qi/operator/and_predicate.hpp>
 #include <boost/spirit/home/qi/operator/not_predicate.hpp>
-#include <boost/spirit/home/qi/operator/meta_grammar.hpp>
 
 #endif
Modified: trunk/boost/spirit/home/qi/operator/alternative.hpp
==============================================================================
--- trunk/boost/spirit/home/qi/operator/alternative.hpp	(original)
+++ trunk/boost/spirit/home/qi/operator/alternative.hpp	2009-04-26 10:42:24 EDT (Sun, 26 Apr 2009)
@@ -1,97 +1,100 @@
 /*=============================================================================
-    Copyright (c) 2001-2007 Joel de Guzman
+    Copyright (c) 2001-2009 Joel de Guzman
     Copyright (c) 2001-2009 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(SPIRIT_ALTERNATIVE_FEB_05_2007_1153AM)
-#define SPIRIT_ALTERNATIVE_FEB_05_2007_1153AM
+#if !defined(SPIRIT_ALTERNATIVE_FEBRUARY_05_2007_1153AM)
+#define SPIRIT_ALTERNATIVE_FEBRUARY_05_2007_1153AM
+
+#if defined(_MSC_VER)
+#pragma once
+#endif
 
 #include <boost/spirit/home/qi/detail/alternative_function.hpp>
-#include <boost/spirit/home/support/attribute_transform.hpp>
+#include <boost/spirit/home/qi/meta_compiler.hpp>
+#include <boost/spirit/home/qi/parser.hpp>
+#include <boost/spirit/home/support/attributes.hpp>
 #include <boost/spirit/home/support/detail/what_function.hpp>
 #include <boost/spirit/home/support/unused.hpp>
-#include <boost/spirit/home/support/as_variant.hpp>
+#include <boost/spirit/home/support/info.hpp>
 #include <boost/fusion/include/any.hpp>
-#include <boost/fusion/include/vector.hpp>
 #include <boost/fusion/include/mpl.hpp>
 #include <boost/fusion/include/for_each.hpp>
-#include <boost/fusion/include/push_front.hpp>
-#include <boost/variant.hpp>
-#include <boost/type_traits/is_same.hpp>
-#include <boost/mpl/end.hpp>
-#include <boost/mpl/find_if.hpp>
-#include <boost/mpl/eval_if.hpp>
-#include <boost/mpl/identity.hpp>
+
+namespace boost { namespace spirit
+{
+    ///////////////////////////////////////////////////////////////////////////
+    // Enablers
+    ///////////////////////////////////////////////////////////////////////////
+    template <>
+    struct use_operator<qi::domain, proto::tag::bitwise_or> // enables |
+      : mpl::true_ {};
+
+    template <>
+    struct flatten_tree<qi::domain, proto::tag::bitwise_or> // flattens |
+      : mpl::true_ {};
+}}
 
 namespace boost { namespace spirit { namespace qi
 {
-    struct alternative
+    template <typename Elements>
+    struct alternative : nary_parser<alternative<Elements> >
     {
-        template <typename T>
-        struct transform_child : mpl::identity<T> {};
-
-        template <typename All, typename Filtered>
-        struct build_container
+        template <typename Context, typename Iterator>
+        struct attribute
         {
-            // if the original attribute list does not contain any unused
-            // attributes it is used, otherwise a single unused_type is
-            // pushed to the front the list. This is to make sure that if
-            // there is an unused in the list it is the first one.
-            typedef typename
-                mpl::find_if<All, is_same<mpl::_, unused_type> >::type
-            unused_;
-
-            typedef typename
-                mpl::eval_if<
-                    is_same<unused_, typename mpl::end<All>::type>,
-                    mpl::identity<All>,
-                    fusion::result_of::push_front<Filtered, unused_type>
-                >::type
-            attribute_sequence;
-
-            // Ok, now make a variant over the attribute_sequence. It's
-            // a pity that make_variant_over does not support forward MPL
-            // sequences. We use our own conversion metaprogram (as_variant).
+            // Put all the element attributes in a tuple
+            typedef typename traits::build_attribute_sequence<
+                Elements, Context, mpl::identity, Iterator>::type
+            all_attributes;
+
+            // Ok, now make a variant over the attribute sequence. Note that
+            // build_variant makes sure that 1) all attributes in the variant
+            // are unique 2) puts the unused attribute, if there is any, to
+            // the front and 3) collapses single element variants, variant<T>
+            // to T.
             typedef typename
-                as_variant<attribute_sequence>::type
+                traits::build_variant<all_attributes>::type
             type;
         };
 
-        template <typename Component, typename Context, typename Iterator>
-        struct attribute :
-            build_fusion_sequence<alternative, Component, Iterator, Context>
-        {
-        };
+        alternative(Elements const& elements)
+          : elements(elements) {}
 
-        template <
-            typename Component
-          , typename Iterator, typename Context
+        template <typename Iterator, typename Context
           , typename Skipper, typename Attribute>
-        static bool parse(
-            Component const& component
-          , Iterator& first, Iterator const& last
+        bool parse(Iterator& first, Iterator const& last
           , Context& context, Skipper const& skipper
-          , Attribute& attr)
+          , Attribute& attr) const
         {
             detail::alternative_function<Iterator, Context, Skipper, Attribute>
                 f(first, last, context, skipper, attr);
 
             // return true if *any* of the parsers succeed
-            return fusion::any(component.elements, f);
+            return fusion::any(elements, f);
         }
 
-        template <typename Component, typename Context>
-        static std::string what(Component const& component, Context const& ctx)
+        template <typename Context>
+        info what(Context& context) const
         {
-            std::string result = "alternatives[";
-            fusion::for_each(component.elements,
-                spirit::detail::what_function<Context>(result, ctx));
-            result += "]";
+            info result("alternative");
+            fusion::for_each(elements,
+                spirit::detail::what_function<Context>(result, context));
             return result;
         }
+
+        Elements elements;
     };
+
+    ///////////////////////////////////////////////////////////////////////////
+    // Parser generators: make_xxx function (objects)
+    ///////////////////////////////////////////////////////////////////////////
+    template <typename Elements, typename Modifiers>
+    struct make_composite<proto::tag::bitwise_or, Elements, Modifiers>
+      : make_nary_composite<Elements, alternative>
+    {};
 }}}
 
 #endif
Modified: trunk/boost/spirit/home/qi/operator/and_predicate.hpp
==============================================================================
--- trunk/boost/spirit/home/qi/operator/and_predicate.hpp	(original)
+++ trunk/boost/spirit/home/qi/operator/and_predicate.hpp	2009-04-26 10:42:24 EDT (Sun, 26 Apr 2009)
@@ -1,5 +1,5 @@
 /*=============================================================================
-    Copyright (c) 2001-2007 Joel de Guzman
+    Copyright (c) 2001-2009 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)
@@ -7,52 +7,69 @@
 #if !defined(SPIRIT_AND_PREDICATE_MARCH_23_2007_0617PM)
 #define SPIRIT_AND_PREDICATE_MARCH_23_2007_0617PM
 
-#include <boost/spirit/home/support/component.hpp>
-#include <boost/spirit/home/support/unused.hpp>
+#if defined(_MSC_VER)
+#pragma once
+#endif
+
+#include <boost/spirit/home/qi/domain.hpp>
+#include <boost/spirit/home/qi/meta_compiler.hpp>
+#include <boost/spirit/home/qi/parser.hpp>
+#include <boost/spirit/home/support/attributes.hpp>
+#include <boost/spirit/home/support/info.hpp>
+#include <boost/fusion/include/at.hpp>
+
+namespace boost { namespace spirit
+{
+    ///////////////////////////////////////////////////////////////////////////
+    // Enablers
+    ///////////////////////////////////////////////////////////////////////////
+    template <>
+    struct use_operator<qi::domain, proto::tag::address_of> // enables &p
+      : mpl::true_ {};
+}}
 
 namespace boost { namespace spirit { namespace qi
 {
-    struct and_predicate
+    template <typename Subject>
+    struct and_predicate : unary_parser<and_predicate<Subject> >
     {
-        template <typename Component, typename Context, typename Iterator>
+        typedef Subject subject_type;
+
+        template <typename Context, typename Iterator>
         struct attribute
         {
             typedef unused_type type;
         };
 
-        template <
-            typename Component
-          , typename Iterator, typename Context
+        and_predicate(Subject const& subject)
+          : subject(subject) {}
+
+        template <typename Iterator, typename Context
           , typename Skipper, typename Attribute>
-        static bool parse(
-            Component const& component
-          , Iterator& first, Iterator const& last
+        bool parse(Iterator& first, Iterator const& last
           , Context& context, Skipper const& skipper
-          , Attribute& /*attr*/)
+          , Attribute& /*attr*/) const
         {
-            typedef typename
-                result_of::subject<Component>::type::director
-            director;
-
             Iterator i = first;
-            return director::parse(
-                subject(component), i, last, context, skipper, unused);
+            return subject.parse(i, last, context, skipper, unused);
         }
 
-        template <typename Component, typename Context>
-        static std::string what(Component const& component, Context const& ctx)
+        template <typename Context>
+        info what(Context& context) const
         {
-            std::string result = "and-predicate[";
-
-            typedef typename
-                result_of::subject<Component>::type::director
-            director;
-
-            result += director::what(subject(component), ctx);
-            result += "]";
-            return result;
+            return info("and-predicate", subject.what(context));
         }
+
+        Subject subject;
     };
+
+    ///////////////////////////////////////////////////////////////////////////
+    // Parser generators: make_xxx function (objects)
+    ///////////////////////////////////////////////////////////////////////////
+    template <typename Elements, typename Modifiers>
+    struct make_composite<proto::tag::address_of, Elements, Modifiers>
+      : make_unary_composite<Elements, and_predicate>
+    {};
 }}}
 
 #endif
Modified: trunk/boost/spirit/home/qi/operator/difference.hpp
==============================================================================
--- trunk/boost/spirit/home/qi/operator/difference.hpp	(original)
+++ trunk/boost/spirit/home/qi/operator/difference.hpp	2009-04-26 10:42:24 EDT (Sun, 26 Apr 2009)
@@ -1,52 +1,58 @@
 /*=============================================================================
-    Copyright (c) 2001-2007 Joel de Guzman
+    Copyright (c) 2001-2009 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(SPIRIT_DIFFERENCE_FEB_11_2007_1250PM)
-#define SPIRIT_DIFFERENCE_FEB_11_2007_1250PM
+#if !defined(SPIRIT_DIFFERENCE_FEBRUARY_11_2007_1250PM)
+#define SPIRIT_DIFFERENCE_FEBRUARY_11_2007_1250PM
+
+#if defined(_MSC_VER)
+#pragma once
+#endif
 
 #include <boost/spirit/home/qi/domain.hpp>
-#include <boost/spirit/home/support/component.hpp>
-#include <boost/spirit/home/support/attribute_of.hpp>
-#include <vector>
+#include <boost/spirit/home/qi/meta_compiler.hpp>
+#include <boost/spirit/home/qi/parser.hpp>
+#include <boost/spirit/home/support/attributes.hpp>
+#include <boost/spirit/home/support/info.hpp>
+#include <boost/fusion/include/at.hpp>
+
+namespace boost { namespace spirit
+{
+    ///////////////////////////////////////////////////////////////////////////
+    // Enablers
+    ///////////////////////////////////////////////////////////////////////////
+    template <>
+    struct use_operator<qi::domain, proto::tag::minus> // enables -
+      : mpl::true_ {};
+}}
 
 namespace boost { namespace spirit { namespace qi
 {
-    struct difference
+    template <typename Left, typename Right>
+    struct difference : binary_parser<difference<Left, Right> >
     {
-        template <typename Component, typename Context, typename Iterator>
+        typedef Left left_type;
+        typedef Right right_type;
+
+        template <typename Context, typename Iterator>
         struct attribute
         {
             typedef typename
-                result_of::left<Component>::type
-            left_type;
-
-            typedef typename
-                traits::attribute_of<
-                    qi::domain, left_type, Context, Iterator>::type
+                traits::attribute_of<left_type, Context, Iterator>::type
             type;
         };
 
-        template <
-            typename Component
-          , typename Iterator, typename Context
+        difference(Left const& left, Right const& right)
+          : left(left), right(right) {}
+
+        template <typename Iterator, typename Context
           , typename Skipper, typename Attribute>
-        static bool parse(
-            Component const& component
-          , Iterator& first, Iterator const& last
+        bool parse(Iterator& first, Iterator const& last
           , Context& context, Skipper const& skipper
-          , Attribute& attr)
+          , Attribute& attr) const
         {
-            typedef typename
-                result_of::left<Component>::type::director
-            ldirector;
-
-            typedef typename
-                result_of::right<Component>::type::director
-            rdirector;
-
             // Unlike classic Spirit, with this version of difference, the rule
             // lit("policeman") - "police" will always fail to match.
 
@@ -56,38 +62,34 @@
 
             // Try RHS first
             Iterator start = first;
-            if (rdirector::parse(spirit::right(component), first, last, context, 
-                skipper, unused))
+            if (right.parse(first, last, context, skipper, unused))
             {
                 // RHS succeeds, we fail.
                 first = start;
                 return false;
             }
             // RHS fails, now try LHS
-            return ldirector::parse(spirit::left(component), first, last, 
-                context, skipper, attr);
+            return left.parse(first, last, context, skipper, attr);
         }
 
-        template <typename Component, typename Context>
-        static std::string what(Component const& component, Context const& ctx)
+        template <typename Context>
+        info what(Context& context) const
         {
-            std::string result = "difference[";
-
-            typedef typename
-                result_of::left<Component>::type::director
-            ldirector;
-
-            typedef typename
-                result_of::right<Component>::type::director
-            rdirector;
-
-            result += ldirector::what(spirit::left(component), ctx);
-            result += ", ";
-            result += rdirector::what(spirit::right(component), ctx);
-            result += "]";
-            return result;
+            return info("difference",
+                std::make_pair(left.what(context), right.what(context)));
         }
+
+        Left left;
+        Right right;
     };
+
+    ///////////////////////////////////////////////////////////////////////////
+    // Parser generators: make_xxx function (objects)
+    ///////////////////////////////////////////////////////////////////////////
+    template <typename Elements, typename Modifiers>
+    struct make_composite<proto::tag::minus, Elements, Modifiers>
+      : make_binary_composite<Elements, difference>
+    {};
 }}}
 
 #endif
Modified: trunk/boost/spirit/home/qi/operator/expect.hpp
==============================================================================
--- trunk/boost/spirit/home/qi/operator/expect.hpp	(original)
+++ trunk/boost/spirit/home/qi/operator/expect.hpp	2009-04-26 10:42:24 EDT (Sun, 26 Apr 2009)
@@ -1,5 +1,5 @@
 /*=============================================================================
-    Copyright (c) 2001-2007 Joel de Guzman
+    Copyright (c) 2001-2009 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)
@@ -7,8 +7,28 @@
 #if !defined(SPIRIT_EXPECT_APRIL_29_2007_0445PM)
 #define SPIRIT_EXPECT_APRIL_29_2007_0445PM
 
+#if defined(_MSC_VER)
+#pragma once
+#endif
+
 #include <boost/spirit/home/qi/operator/sequence_base.hpp>
 #include <boost/spirit/home/qi/detail/expect_function.hpp>
+#include <boost/spirit/home/qi/meta_compiler.hpp>
+#include <boost/spirit/home/support/info.hpp>
+
+namespace boost { namespace spirit
+{
+    ///////////////////////////////////////////////////////////////////////////
+    // Enablers
+    ///////////////////////////////////////////////////////////////////////////
+    template <>
+    struct use_operator<qi::domain, proto::tag::greater> // enables >
+      : mpl::true_ {};
+
+    template <>
+    struct flatten_tree<qi::domain, proto::tag::greater> // flattens >
+      : mpl::true_ {};
+}}
 
 namespace boost { namespace spirit { namespace qi
 {
@@ -17,12 +37,16 @@
     {
         Iterator first;
         Iterator last;
-        std::string what;
+        info what;
     };
 
-    struct expect : sequence_base<expect>
+    template <typename Elements>
+    struct expect : sequence_base<expect<Elements>, Elements>
     {
-        friend struct sequence_base<expect>;
+        friend struct sequence_base<expect<Elements>, Elements>;
+
+        expect(Elements const& elements)
+          : sequence_base<expect<Elements>, Elements>(elements) {}
 
     private:
 
@@ -39,11 +63,16 @@
                 (first, last, context, skipper);
         }
 
-        static std::string what_()
-        {
-            return "expect[";
-        }
+        std::string id() const { return "expect"; }
     };
+
+    ///////////////////////////////////////////////////////////////////////////
+    // Parser generators: make_xxx function (objects)
+    ///////////////////////////////////////////////////////////////////////////
+    template <typename Elements, typename Modifiers>
+    struct make_composite<proto::tag::greater, Elements, Modifiers>
+      : make_nary_composite<Elements, expect>
+    {};
 }}}
 
 #endif
Modified: trunk/boost/spirit/home/qi/operator/kleene.hpp
==============================================================================
--- trunk/boost/spirit/home/qi/operator/kleene.hpp	(original)
+++ trunk/boost/spirit/home/qi/operator/kleene.hpp	2009-04-26 10:42:24 EDT (Sun, 26 Apr 2009)
@@ -1,85 +1,90 @@
 /*=============================================================================
-    Copyright (c) 2001-2007 Joel de Guzman
+    Copyright (c) 2001-2009 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(SPIRIT_KLEENE_JAN_07_2007_0818AM)
-#define SPIRIT_KLEENE_JAN_07_2007_0818AM
+#if !defined(SPIRIT_KLEENE_JANUARY_07_2007_0818AM)
+#define SPIRIT_KLEENE_JANUARY_07_2007_0818AM
 
-#include <boost/spirit/home/qi/domain.hpp>
-#include <boost/spirit/home/support/component.hpp>
-#include <boost/spirit/home/support/detail/container.hpp>
-#include <boost/spirit/home/support/attribute_transform.hpp>
-#include <vector>
+#if defined(_MSC_VER)
+#pragma once
+#endif
+
+#include <boost/spirit/home/qi/meta_compiler.hpp>
+#include <boost/spirit/home/qi/parser.hpp>
+#include <boost/spirit/home/support/container.hpp>
+#include <boost/spirit/home/support/attributes.hpp>
+#include <boost/spirit/home/support/info.hpp>
+
+namespace boost { namespace spirit
+{
+    ///////////////////////////////////////////////////////////////////////////
+    // Enablers
+    ///////////////////////////////////////////////////////////////////////////
+    template <>
+    struct use_operator<qi::domain, proto::tag::dereference> // enables *p
+      : mpl::true_ {};
+}}
 
 namespace boost { namespace spirit { namespace qi
 {
-    struct kleene
+    template <typename Subject>
+    struct kleene : unary_parser<kleene<Subject> >
     {
-        template <typename T>
-        struct build_attribute_container
-        {
-            typedef std::vector<T> type;
-        };
+        typedef Subject subject_type;
 
-        template <typename Component, typename Context, typename Iterator>
-        struct attribute :
-            build_container<kleene, Component, Iterator, Context>
+        template <typename Context, typename Iterator>
+        struct attribute
         {
+            // Build a std::vector from the subject's attribute. Note
+            // that build_std_vector may return unused_type if the
+            // subject's attribute is an unused_type.
+            typedef typename
+                traits::build_std_vector<
+                    typename traits::
+                        attribute_of<Subject, Context, Iterator>::type
+                >::type
+            type;
         };
 
-        template <
-            typename Component
-          , typename Iterator, typename Context
+        kleene(Subject const& subject)
+          : subject(subject) {}
+
+        template <typename Iterator, typename Context
           , typename Skipper, typename Attribute>
-        static bool parse(
-            Component const& component
-          , Iterator& first, Iterator const& last
+        bool parse(Iterator& first, Iterator const& last
           , Context& context, Skipper const& skipper
-          , Attribute& attr)
+          , Attribute& attr) const
         {
-            typedef typename
-                result_of::subject<Component>::type
-            subject_type;
-            typedef typename
-                traits::attribute_of<
-                    qi::domain, subject_type, Context, Iterator>::type
-            attr_type;
-            typedef typename subject_type::director director;
-
-            // create a value if Attribute is not unused_type
-            typename mpl::if_<
-                is_same<typename remove_const<Attribute>::type, unused_type>
-              , unused_type
-              , attr_type>::type
-            val;
-
-            while(
-                director::parse(
-                    subject(component)
-                  , first, last, context, skipper, val)
-                )
+            // create a local value if Attribute is not unused_type
+            typename traits::result_of::value<Attribute>::type val;
+
+            // Repeat while subject parses ok
+            while (subject.parse(first, last, context, skipper, val))
             {
-                container::push_back(attr, val);
+                // push the parsed value into our attribute
+                traits::push_back(attr, val);
             }
             return true;
         }
 
-        template <typename Component, typename Context>
-        static std::string what(Component const& component, Context const& ctx)
+        template <typename Context>
+        info what(Context& context) const
         {
-            std::string result = "kleene[";
-
-            typedef typename
-                result_of::subject<Component>::type::director
-            director;
-
-            result += director::what(subject(component), ctx);
-            result += "]";
-            return result;
+            return info("kleene", subject.what(context));
         }
+
+        Subject subject;
     };
+
+    ///////////////////////////////////////////////////////////////////////////
+    // Parser generators: make_xxx function (objects)
+    ///////////////////////////////////////////////////////////////////////////
+    template <typename Elements, typename Modifiers>
+    struct make_composite<proto::tag::dereference, Elements, Modifiers>
+      : make_unary_composite<Elements, kleene>
+    {};
 }}}
 
 #endif
Modified: trunk/boost/spirit/home/qi/operator/list.hpp
==============================================================================
--- trunk/boost/spirit/home/qi/operator/list.hpp	(original)
+++ trunk/boost/spirit/home/qi/operator/list.hpp	2009-04-26 10:42:24 EDT (Sun, 26 Apr 2009)
@@ -1,5 +1,5 @@
 /*=============================================================================
-    Copyright (c) 2001-2007 Joel de Guzman
+    Copyright (c) 2001-2009 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)
@@ -7,63 +7,69 @@
 #if !defined(SPIRIT_LIST_MARCH_24_2007_1031AM)
 #define SPIRIT_LIST_MARCH_24_2007_1031AM
 
-#include <boost/spirit/home/support/component.hpp>
-#include <boost/spirit/home/support/detail/container.hpp>
-#include <boost/spirit/home/support/attribute_transform.hpp>
+#if defined(_MSC_VER)
+#pragma once
+#endif
+
+#include <boost/spirit/home/qi/meta_compiler.hpp>
+#include <boost/spirit/home/qi/parser.hpp>
+#include <boost/spirit/home/support/container.hpp>
+#include <boost/spirit/home/support/attributes.hpp>
+#include <boost/spirit/home/support/info.hpp>
 #include <vector>
 
+namespace boost { namespace spirit
+{
+    ///////////////////////////////////////////////////////////////////////////
+    // Enablers
+    ///////////////////////////////////////////////////////////////////////////
+    template <>
+    struct use_operator<qi::domain, proto::tag::modulus> // enables p % d
+      : mpl::true_ {};
+}}
+
 namespace boost { namespace spirit { namespace qi
 {
-    struct list
+    template <typename Left, typename Right>
+    struct list : binary_parser<list<Left, Right> >
     {
-        template <typename T>
-        struct build_attribute_container
-        {
-            typedef std::vector<T> type;
-        };
+        typedef Left left_type;
+        typedef Right right_type;
 
-        template <typename Component, typename Context, typename Iterator>
-        struct attribute :
-            build_container<list, Component, Iterator, Context>
+        template <typename Context, typename Iterator>
+        struct attribute
         {
+            // Build a std::vector from the LHS's attribute. Note
+            // that build_std_vector may return unused_type if the
+            // subject's attribute is an unused_type.
+            typedef typename
+                traits::build_std_vector<
+                    typename traits::
+                        attribute_of<Left, Context, Iterator>::type
+                >::type
+            type;
         };
 
-        template <
-            typename Component
-          , typename Iterator, typename Context
+        list(Left const& left, Right const& right)
+          : left(left), right(right) {}
+
+        template <typename Iterator, typename Context
           , typename Skipper, typename Attribute>
-        static bool parse(
-            Component const& component
-          , Iterator& first, Iterator const& last
+        bool parse(Iterator& first, Iterator const& last
           , Context& context, Skipper const& skipper
-          , Attribute& attr)
+          , Attribute& attr) const
         {
-            typedef typename
-                result_of::left<Component>::type::director
-            ldirector;
+            // create a local value if Attribute is not unused_type
+            typename traits::result_of::value<Attribute>::type val;
 
-            typedef typename
-                result_of::right<Component>::type::director
-            rdirector;
-
-            typename container::result_of::value<Attribute>::type val;
-            if (ldirector::parse(
-                    spirit::left(component)
-                  , first, last, context, skipper, val)
-                )
+            if (left.parse(first, last, context, skipper, val))
             {
-                container::push_back(attr, val);
+                traits::push_back(attr, val);
                 Iterator i = first;
-                while(
-                    rdirector::parse(
-                        spirit::right(component)
-                      , i, last, context, skipper, unused)
-                 && ldirector::parse(
-                        spirit::left(component)
-                      , i, last, context, skipper, val)
-                    )
+                while (right.parse(i, last, context, skipper, unused)
+                 && left.parse(i, last, context, skipper, val))
                 {
-                    container::push_back(attr, val);
+                    traits::push_back(attr, val);
                     first = i;
                 }
                 return true;
@@ -71,27 +77,24 @@
             return false;
         }
 
-
-        template <typename Component, typename Context>
-        static std::string what(Component const& component, Context const& ctx)
+        template <typename Context>
+        info what(Context& context) const
         {
-            std::string result = "list[";
-
-            typedef typename
-                result_of::left<Component>::type::director
-            ldirector;
-
-            typedef typename
-                result_of::right<Component>::type::director
-            rdirector;
-
-            result += ldirector::what(spirit::left(component), ctx);
-            result += ", ";
-            result += rdirector::what(spirit::right(component), ctx);
-            result += "]";
-            return result;
+            return info("list",
+                std::make_pair(left.what(context), right.what(context)));
         }
+
+        Left left;
+        Right right;
     };
+
+    ///////////////////////////////////////////////////////////////////////////
+    // Parser generators: make_xxx function (objects)
+    ///////////////////////////////////////////////////////////////////////////
+    template <typename Elements, typename Modifiers>
+    struct make_composite<proto::tag::modulus, Elements, Modifiers>
+      : make_binary_composite<Elements, list>
+    {};
 }}}
 
 #endif
Deleted: trunk/boost/spirit/home/qi/operator/meta_grammar.hpp
==============================================================================
--- trunk/boost/spirit/home/qi/operator/meta_grammar.hpp	2009-04-26 10:42:24 EDT (Sun, 26 Apr 2009)
+++ (empty file)
@@ -1,146 +0,0 @@
-/*=============================================================================
-    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_META_GRAMMAR_FEB_02_2007_0620PM)
-#define BOOST_SPIRIT_META_GRAMMAR_FEB_02_2007_0620PM
-
-#include <boost/spirit/home/qi/domain.hpp>
-#include <boost/spirit/home/support/meta_grammar.hpp>
-#include <boost/utility/enable_if.hpp>
-
-namespace boost { namespace spirit { namespace qi
-{
-    ///////////////////////////////////////////////////////////////////////////
-    // forwards
-    ///////////////////////////////////////////////////////////////////////////
-    struct sequence;
-    struct expect;
-    struct alternative;
-    struct sequential_or;
-    struct permutation;
-    struct difference;
-    struct list;
-    struct optional;
-    struct kleene;
-    struct plus;
-    struct and_predicate;
-    struct not_predicate;
-    struct main_meta_grammar;
-
-    template <typename Expr, typename Enable>
-    struct is_valid_expr;
-
-    template <typename Expr, typename Enable>
-    struct expr_transform;
-
-    ///////////////////////////////////////////////////////////////////////////
-    // operator meta-grammars
-    ///////////////////////////////////////////////////////////////////////////
-    struct binary_meta_grammar
-      : proto::or_<
-            // a >> b
-            meta_grammar::binary_rule_flat<
-                qi::domain, proto::tag::shift_right, sequence
-              , main_meta_grammar
-            >
-            // a + b
-          , meta_grammar::binary_rule_flat<
-                qi::domain, proto::tag::plus, sequence
-              , main_meta_grammar
-            >
-            // a > b
-          , meta_grammar::binary_rule_flat<
-                qi::domain, proto::tag::greater, expect
-              , main_meta_grammar
-            >
-            // a | b
-          , meta_grammar::binary_rule_flat<
-                qi::domain, proto::tag::bitwise_or, alternative
-              , main_meta_grammar
-            >
-            // a || b
-          , meta_grammar::binary_rule_flat<
-                qi::domain, proto::tag::logical_or, sequential_or
-              , main_meta_grammar
-            >
-            // a ^ b
-          , meta_grammar::binary_rule_flat<
-                qi::domain, proto::tag::bitwise_xor, permutation
-              , main_meta_grammar
-            >
-            // a - b
-          , meta_grammar::binary_rule<
-                qi::domain, proto::tag::minus, difference
-              , main_meta_grammar, main_meta_grammar
-            >
-            // a % b
-          , meta_grammar::binary_rule<
-                qi::domain, proto::tag::modulus, list
-              , main_meta_grammar, main_meta_grammar
-            >
-        >
-    {
-    };
-
-    struct unary_meta_grammar
-      : proto::or_<
-            // -a
-            meta_grammar::unary_rule<
-                qi::domain, proto::tag::negate, optional
-              , main_meta_grammar
-            >
-            // *a
-          , meta_grammar::unary_rule<
-                qi::domain, proto::tag::dereference, kleene
-              , main_meta_grammar
-            >
-            // +a
-          , meta_grammar::unary_rule<
-                qi::domain, proto::tag::unary_plus, plus
-              , main_meta_grammar
-            >
-            // &a
-          , meta_grammar::unary_rule<
-                qi::domain, proto::tag::address_of, and_predicate
-              , main_meta_grammar
-            >
-            // !a
-          , meta_grammar::unary_rule<
-                qi::domain, proto::tag::logical_not, not_predicate
-              , main_meta_grammar
-            >
-        >
-    {
-    };
-
-    struct operator_meta_grammar
-      : proto::or_<
-            binary_meta_grammar
-          , unary_meta_grammar
-        >
-    {
-    };
-
-    ///////////////////////////////////////////////////////////////////////////
-    //  These specializations non-intrusively hooks into the RD meta-grammar.
-    //  (see qi/meta_grammar.hpp)
-    ///////////////////////////////////////////////////////////////////////////
-    template <typename Expr>
-    struct is_valid_expr<Expr
-      , typename enable_if<proto::matches<Expr, operator_meta_grammar> >::type>
-      : mpl::true_
-    {
-    };
-
-    template <typename Expr>
-    struct expr_transform<Expr
-      , typename enable_if<proto::matches<Expr, operator_meta_grammar> >::type>
-      : mpl::identity<operator_meta_grammar>
-    {
-    };
-}}}
-
-#endif
Modified: trunk/boost/spirit/home/qi/operator/not_predicate.hpp
==============================================================================
--- trunk/boost/spirit/home/qi/operator/not_predicate.hpp	(original)
+++ trunk/boost/spirit/home/qi/operator/not_predicate.hpp	2009-04-26 10:42:24 EDT (Sun, 26 Apr 2009)
@@ -1,5 +1,5 @@
 /*=============================================================================
-    Copyright (c) 2001-2007 Joel de Guzman
+    Copyright (c) 2001-2009 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)
@@ -7,52 +7,68 @@
 #if !defined(SPIRIT_NOT_PREDICATE_MARCH_23_2007_0618PM)
 #define SPIRIT_NOT_PREDICATE_MARCH_23_2007_0618PM
 
-#include <boost/spirit/home/support/component.hpp>
-#include <boost/spirit/home/support/unused.hpp>
+#if defined(_MSC_VER)
+#pragma once
+#endif
+
+#include <boost/spirit/home/qi/domain.hpp>
+#include <boost/spirit/home/qi/meta_compiler.hpp>
+#include <boost/spirit/home/qi/parser.hpp>
+#include <boost/spirit/home/support/attributes.hpp>
+#include <boost/spirit/home/support/info.hpp>
+
+namespace boost { namespace spirit
+{
+    ///////////////////////////////////////////////////////////////////////////
+    // Enablers
+    ///////////////////////////////////////////////////////////////////////////
+    template <>
+    struct use_operator<qi::domain, proto::tag::logical_not> // enables !p
+      : mpl::true_ {};
+}}
 
 namespace boost { namespace spirit { namespace qi
 {
-    struct not_predicate
+    template <typename Subject>
+    struct not_predicate : unary_parser<not_predicate<Subject> >
     {
-        template <typename Component, typename Context, typename Iterator>
+        typedef Subject subject_type;
+
+        template <typename Context, typename Iterator>
         struct attribute
         {
             typedef unused_type type;
         };
 
-        template <
-            typename Component
-          , typename Iterator, typename Context
+        not_predicate(Subject const& subject)
+          : subject(subject) {}
+
+        template <typename Iterator, typename Context
           , typename Skipper, typename Attribute>
-        static bool parse(
-            Component const& component
-          , Iterator& first, Iterator const& last
+        bool parse(Iterator& first, Iterator const& last
           , Context& context, Skipper const& skipper
-          , Attribute& /*attr*/)
+          , Attribute& /*attr*/) const
         {
-            typedef typename
-                result_of::subject<Component>::type::director
-            director;
-
             Iterator i = first;
-            return !director::parse(
-                subject(component), i, last, context, skipper, unused);
+            return !subject.parse(i, last, context, skipper, unused);
         }
 
-        template <typename Component, typename Context>
-        static std::string what(Component const& component, Context const& ctx)
+        template <typename Context>
+        info what(Context& context) const
         {
-            std::string result = "not-predicate[";
-
-            typedef typename
-                result_of::subject<Component>::type::director
-            director;
-
-            result += director::what(subject(component), ctx);
-            result += "]";
-            return result;
+            return info("not-predicate", subject.what(context));
         }
+
+        Subject subject;
     };
+
+    ///////////////////////////////////////////////////////////////////////////
+    // Parser generators: make_xxx function (objects)
+    ///////////////////////////////////////////////////////////////////////////
+    template <typename Elements, typename Modifiers>
+    struct make_composite<proto::tag::logical_not, Elements, Modifiers>
+      : make_unary_composite<Elements, not_predicate>
+    {};
 }}}
 
 #endif
Modified: trunk/boost/spirit/home/qi/operator/optional.hpp
==============================================================================
--- trunk/boost/spirit/home/qi/operator/optional.hpp	(original)
+++ trunk/boost/spirit/home/qi/operator/optional.hpp	2009-04-26 10:42:24 EDT (Sun, 26 Apr 2009)
@@ -1,5 +1,5 @@
 /*=============================================================================
-    Copyright (c) 2001-2007 Joel de Guzman
+    Copyright (c) 2001-2009 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)
@@ -7,80 +7,86 @@
 #if !defined(SPIRIT_OPTIONAL_MARCH_23_2007_1117PM)
 #define SPIRIT_OPTIONAL_MARCH_23_2007_1117PM
 
-#include <boost/spirit/home/support/component.hpp>
+#if defined(_MSC_VER)
+#pragma once
+#endif
+
 #include <boost/spirit/home/support/unused.hpp>
-#include <boost/spirit/home/support/attribute_transform.hpp>
-#include <boost/spirit/home/qi/domain.hpp>
+#include <boost/spirit/home/support/attributes.hpp>
+#include <boost/spirit/home/support/info.hpp>
+#include <boost/spirit/home/qi/parser.hpp>
+#include <boost/spirit/home/qi/meta_compiler.hpp>
 #include <boost/spirit/home/qi/detail/assign_to.hpp>
 #include <boost/optional.hpp>
 #include <vector>
 
+namespace boost { namespace spirit
+{
+    ///////////////////////////////////////////////////////////////////////////
+    // Enablers
+    ///////////////////////////////////////////////////////////////////////////
+    template <>
+    struct use_operator<qi::domain, proto::tag::negate> // enables -p
+      : mpl::true_ {};
+}}
+
 namespace boost { namespace spirit { namespace qi
 {
-    struct optional
+    template <typename Subject>
+    struct optional : unary_parser<optional<Subject> >
     {
-        template <typename T>
-        struct build_attribute_container
-        {
-            typedef boost::optional<T> type;
-        };
+        typedef Subject subject_type;
 
-        template <typename Component, typename Context, typename Iterator>
-        struct attribute :
-            build_container<optional, Component, Iterator, Context>
+        template <typename Context, typename Iterator>
+        struct attribute
         {
+            // Build a boost::optional from the subject's attribute. Note
+            // that boost::optional may return unused_type if the
+            // subject's attribute is an unused_type.
+            typedef typename
+                traits::build_optional<
+                    typename traits::
+                        attribute_of<Subject, Context, Iterator>::type
+                >::type
+            type;
         };
 
-        template <
-            typename Component
-          , typename Iterator, typename Context
+        optional(Subject const& subject)
+          : subject(subject) {}
+
+        template <typename Iterator, typename Context
           , typename Skipper, typename Attribute>
-        static bool parse(
-            Component const& component
-          , Iterator& first, Iterator const& last
+        bool parse(Iterator& first, Iterator const& last
           , Context& context, Skipper const& skipper
-          , Attribute& attr)
+          , Attribute& attr) const
         {
-            typedef typename
-                result_of::subject<Component>::type
-            subject_type;
-
-            typedef typename
-                traits::attribute_of<
-                    qi::domain, subject_type, Context, Iterator>::type
-            attr_type;
-
-            typedef typename subject_type::director director;
-
-            // create a value if Attribute is not unused_type
-            typename mpl::if_<
-                is_same<typename remove_const<Attribute>::type, unused_type>
-              , unused_type
-              , attr_type>::type
-            val;
+            // create a local value if Attribute is not unused_type
+            typename traits::result_of::optional_value<Attribute>::type val;
 
-            if (director::parse(
-                subject(component), first, last, context, skipper, val))
+            if (subject.parse(first, last, context, skipper, val))
             {
+                // assign the parsed value into our attribute
                 qi::detail::assign_to(val, attr);
             }
             return true;
         }
 
-        template <typename Component, typename Context>
-        static std::string what(Component const& component, Context const& ctx)
+        template <typename Context>
+        info what(Context& context) const
         {
-            std::string result = "optional[";
-
-            typedef typename
-                result_of::subject<Component>::type::director
-            director;
-
-            result += director::what(subject(component), ctx);
-            result += "]";
-            return result;
+            return info("optional", subject.what(context));
         }
+
+        Subject subject;
     };
+
+    ///////////////////////////////////////////////////////////////////////////
+    // Parser generators: make_xxx function (objects)
+    ///////////////////////////////////////////////////////////////////////////
+    template <typename Elements, typename Modifiers>
+    struct make_composite<proto::tag::negate, Elements, Modifiers>
+      : make_unary_composite<Elements, optional>
+    {};
 }}}
 
 #endif
Modified: trunk/boost/spirit/home/qi/operator/permutation.hpp
==============================================================================
--- trunk/boost/spirit/home/qi/operator/permutation.hpp	(original)
+++ trunk/boost/spirit/home/qi/operator/permutation.hpp	2009-04-26 10:42:24 EDT (Sun, 26 Apr 2009)
@@ -1,5 +1,5 @@
 /*=============================================================================
-    Copyright (c) 2001-2007 Joel de Guzman
+    Copyright (c) 2001-2009 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)
@@ -7,90 +7,123 @@
 #if !defined(SPIRIT_PERMUTATION_OR_MARCH_13_2007_1145PM)
 #define SPIRIT_PERMUTATION_OR_MARCH_13_2007_1145PM
 
+#if defined(_MSC_VER)
+#pragma once
+#endif
+
 #include <boost/spirit/home/qi/detail/permute_function.hpp>
-#include <boost/spirit/home/support/attribute_transform.hpp>
-#include <boost/spirit/home/support/algorithm/any.hpp>
+#include <boost/spirit/home/support/attributes.hpp>
+#include <boost/spirit/home/support/algorithm/any_if_ns.hpp>
 #include <boost/spirit/home/support/detail/what_function.hpp>
-#include <boost/fusion/include/vector.hpp>
-#include <boost/fusion/include/as_vector.hpp>
+#include <boost/spirit/home/support/info.hpp>
 #include <boost/fusion/include/size.hpp>
 #include <boost/optional.hpp>
 #include <boost/foreach.hpp>
 #include <boost/array.hpp>
 
+namespace boost { namespace spirit
+{
+    ///////////////////////////////////////////////////////////////////////////
+    // Enablers
+    ///////////////////////////////////////////////////////////////////////////
+    template <>
+    struct use_operator<qi::domain, proto::tag::bitwise_xor> // enables ^
+      : mpl::true_ {};
+
+    template <>
+    struct flatten_tree<qi::domain, proto::tag::bitwise_xor> // flattens ^
+      : mpl::true_ {};
+}}
+
 namespace boost { namespace spirit { namespace qi
 {
-    struct permutation
+    template <typename Elements>
+    struct permutation : nary_parser<alternative<Elements> >
     {
-        template <typename T>
-        struct transform_child
+        template <typename Context, typename Iterator>
+        struct attribute
         {
-            typedef boost::optional<T> type;
-        };
-
-        template <typename All, typename Filtered>
-        struct build_container
-        {
-            typedef
-                typename fusion::result_of::as_vector<Filtered>::type
+            // Put all the element attributes in a tuple,
+            // wrapping each element in a boost::optional
+            typedef typename traits::build_attribute_sequence<
+                Elements, Context, traits::build_optional, Iterator>::type
+            all_attributes;
+
+            // Now, build a fusion vector over the attributes. Note
+            // that build_fusion_vector 1) removes all unused attributes
+            // and 2) may return unused_type if all elements have
+            // unused_type(s).
+            typedef typename
+                traits::build_fusion_vector<all_attributes>::type
             type;
         };
 
-        template <typename Component, typename Context, typename Iterator>
-        struct attribute :
-            build_fusion_sequence<permutation, Component, Iterator, Context>
-        {
-        };
+        permutation(Elements const& elements)
+          : elements(elements) {}
 
-        template <
-            typename Component
-          , typename Iterator, typename Context
+        template <typename Iterator, typename Context
           , typename Skipper, typename Attribute>
-        static bool parse(
-            Component const& component
-          , Iterator& first, Iterator const& last
+        bool parse(Iterator& first, Iterator const& last
           , Context& context, Skipper const& skipper
-          , Attribute& attr)
+          , Attribute& attr_) const
         {
+            typedef traits::attribute_not_unused<Context, Iterator> predicate;
             detail::permute_function<Iterator, Context, Skipper>
                 f(first, last, context, skipper);
 
-            boost::array<
-                bool
-              , fusion::result_of::size<typename Component::elements_type>::value
-            >
-            slots;
-
-            BOOST_FOREACH(bool& taken, slots)
+            boost::array<bool, fusion::result_of::size<Elements>::value> flags;
+            BOOST_FOREACH(bool& taken, flags)
             {
                 taken = false;
             }
 
-            // We have a bool array 'slots' with one flag for each parser.
+            // wrap the attribute in a tuple if it is not a tuple
+            typename traits::wrap_if_not_tuple<Attribute>::type attr(attr_);
+
+            // We have a bool array 'flags' with one flag for each parser.
             // permute_function sets the slot to true when the corresponding
             // parser successful matches. We loop until there are no more
             // successful parsers.
 
             bool result = false;
-            f.taken = slots.begin();
-            while (spirit::any_ns(component.elements, attr, f))
+            f.taken = flags.begin();
+            while (spirit::any_if_ns(elements, attr, f, predicate()))
             {
-                f.taken = slots.begin();
+                f.taken = flags.begin();
                 result = true;
             }
             return result;
         }
 
-        template <typename Component, typename Context>
-        static std::string what(Component const& component, Context const& ctx)
+        template <typename Context>
+        info what(Context& context) const
         {
-            std::string result = "permutation[";
-            fusion::for_each(component.elements,
-                spirit::detail::what_function<Context>(result, ctx));
-            result += "]";
+            info result("permutation");
+            fusion::for_each(elements,
+                spirit::detail::what_function<Context>(result, context));
             return result;
         }
+
+        Elements elements;
     };
+
+    ///////////////////////////////////////////////////////////////////////////
+    // Parser generators: make_xxx function (objects)
+    ///////////////////////////////////////////////////////////////////////////
+    template <typename Elements, typename Modifiers>
+    struct make_composite<proto::tag::bitwise_xor, Elements, Modifiers>
+      : make_nary_composite<Elements, permutation>
+    {};
+}}}
+
+namespace boost { namespace spirit { namespace traits
+{
+    // We specialize this for permutation (see support/attributes.hpp).
+    // For permutation, we only wrap the attribute in a tuple IFF
+    // it is not already a fusion tuple.
+    template <typename Elements, typename Attribute>
+    struct pass_attribute<qi::permutation<Elements>, Attribute>
+      : wrap_if_not_tuple<Attribute> {};
 }}}
 
 #endif
Modified: trunk/boost/spirit/home/qi/operator/plus.hpp
==============================================================================
--- trunk/boost/spirit/home/qi/operator/plus.hpp	(original)
+++ trunk/boost/spirit/home/qi/operator/plus.hpp	2009-04-26 10:42:24 EDT (Sun, 26 Apr 2009)
@@ -1,5 +1,5 @@
 /*=============================================================================
-    Copyright (c) 2001-2007 Joel de Guzman
+    Copyright (c) 2001-2009 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)
@@ -7,86 +7,87 @@
 #if !defined(SPIRIT_PLUS_MARCH_13_2007_0127PM)
 #define SPIRIT_PLUS_MARCH_13_2007_0127PM
 
-#include <boost/spirit/home/qi/domain.hpp>
-#include <boost/spirit/home/support/component.hpp>
-#include <boost/spirit/home/support/detail/container.hpp>
-#include <boost/spirit/home/support/attribute_transform.hpp>
-#include <vector>
+#if defined(_MSC_VER)
+#pragma once
+#endif
+
+#include <boost/spirit/home/qi/meta_compiler.hpp>
+#include <boost/spirit/home/qi/parser.hpp>
+#include <boost/spirit/home/support/container.hpp>
+#include <boost/spirit/home/support/attributes.hpp>
+#include <boost/spirit/home/support/info.hpp>
+
+namespace boost { namespace spirit
+{
+    ///////////////////////////////////////////////////////////////////////////
+    // Enablers
+    ///////////////////////////////////////////////////////////////////////////
+    template <>
+    struct use_operator<qi::domain, proto::tag::unary_plus> // enables +p
+      : mpl::true_ {};
+}}
 
 namespace boost { namespace spirit { namespace qi
 {
-    struct plus
+    template <typename Subject>
+    struct plus : unary_parser<plus<Subject> >
     {
-        template <typename T>
-        struct build_attribute_container
-        {
-            typedef std::vector<T> type;
-        };
+        typedef Subject subject_type;
 
-        template <typename Component, typename Context, typename Iterator>
-        struct attribute :
-            build_container<plus, Component, Iterator, Context>
+        template <typename Context, typename Iterator>
+        struct attribute
         {
+            // Build a std::vector from the subject's attribute. Note
+            // that build_std_vector may return unused_type if the
+            // subject's attribute is an unused_type.
+            typedef typename
+                traits::build_std_vector<
+                    typename traits::attribute_of<
+                        Subject, Context, Iterator>::type
+                >::type
+            type;
         };
 
-        template <
-            typename Component
-          , typename Iterator, typename Context
+        plus(Subject const& subject)
+          : subject(subject) {}
+
+        template <typename Iterator, typename Context
           , typename Skipper, typename Attribute>
-        static bool parse(
-            Component const& component
-          , Iterator& first, Iterator const& last
+        bool parse(Iterator& first, Iterator const& last
           , Context& context, Skipper const& skipper
-          , Attribute& attr)
+          , Attribute& attr) const
         {
-            typedef typename
-                result_of::subject<Component>::type
-            subject_type;
-            typedef typename
-                traits::attribute_of<
-                    qi::domain, subject_type, Context, Iterator>::type
-            attr_type;
-            typedef typename subject_type::director director;
-
-            // create a value if Attribute is not unused_type
-            typename mpl::if_<
-                is_same<typename remove_const<Attribute>::type, unused_type>
-              , unused_type
-              , attr_type>::type
-            val;
-
-            if (director::parse(
-                    subject(component)
-                  , first, last, context, skipper, val)
-                )
+            // create a local value if Attribute is not unused_type
+            typename traits::result_of::value<Attribute>::type val;
+
+            if (subject.parse(first, last, context, skipper, val))
             {
-                container::push_back(attr, val);
-                while(director::parse(
-                        subject(component)
-                      , first, last, context, skipper, val)
-                    )
+                traits::push_back(attr, val);
+                while (subject.parse(first, last, context, skipper, val))
                 {
-                    container::push_back(attr, val);
+                    traits::push_back(attr, val);
                 }
                 return true;
             }
             return false;
         }
 
-        template <typename Component, typename Context>
-        static std::string what(Component const& component, Context const& ctx)
+        template <typename Context>
+        info what(Context& context) const
         {
-            std::string result = "plus[";
-
-            typedef typename
-                result_of::subject<Component>::type::director
-            director;
-
-            result += director::what(subject(component), ctx);
-            result += "]";
-            return result;
+            return info("plus", subject.what(context));
         }
+
+        Subject subject;
     };
+
+    ///////////////////////////////////////////////////////////////////////////
+    // Parser generators: make_xxx function (objects)
+    ///////////////////////////////////////////////////////////////////////////
+    template <typename Elements, typename Modifiers>
+    struct make_composite<proto::tag::unary_plus, Elements, Modifiers>
+      : make_unary_composite<Elements, plus>
+    {};
 }}}
 
 #endif
Modified: trunk/boost/spirit/home/qi/operator/sequence.hpp
==============================================================================
--- trunk/boost/spirit/home/qi/operator/sequence.hpp	(original)
+++ trunk/boost/spirit/home/qi/operator/sequence.hpp	2009-04-26 10:42:24 EDT (Sun, 26 Apr 2009)
@@ -1,5 +1,5 @@
 /*=============================================================================
-    Copyright (c) 2001-2007 Joel de Guzman
+    Copyright (c) 2001-2009 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)
@@ -7,14 +7,37 @@
 #if !defined(SPIRIT_SEQUENCE_APR_22_2006_0811AM)
 #define SPIRIT_SEQUENCE_APR_22_2006_0811AM
 
+#if defined(_MSC_VER)
+#pragma once
+#endif
+
 #include <boost/spirit/home/qi/operator/sequence_base.hpp>
 #include <boost/spirit/home/qi/detail/fail_function.hpp>
+#include <boost/spirit/home/qi/meta_compiler.hpp>
+
+namespace boost { namespace spirit
+{
+    ///////////////////////////////////////////////////////////////////////////
+    // Enablers
+    ///////////////////////////////////////////////////////////////////////////
+    template <>
+    struct use_operator<qi::domain, proto::tag::shift_right> // enables >>
+      : mpl::true_ {};
+
+    template <>
+    struct flatten_tree<qi::domain, proto::tag::shift_right> // flattens >>
+      : mpl::true_ {};
+}}
 
 namespace boost { namespace spirit { namespace qi
 {
-    struct sequence : sequence_base<sequence>
+    template <typename Elements>
+    struct sequence : sequence_base<sequence<Elements>, Elements>
     {
-        friend struct sequence_base<sequence>;
+        friend struct sequence_base<sequence<Elements>, Elements>;
+
+        sequence(Elements const& elements)
+          : sequence_base<sequence<Elements>, Elements>(elements) {}
 
     private:
 
@@ -28,11 +51,16 @@
                 (first, last, context, skipper);
         }
 
-        static std::string what_()
-        {
-            return "sequence[";
-        }
+        std::string id() const { return "sequence"; }
     };
+
+    ///////////////////////////////////////////////////////////////////////////
+    // Parser generators: make_xxx function (objects)
+    ///////////////////////////////////////////////////////////////////////////
+    template <typename Elements, typename Modifiers>
+    struct make_composite<proto::tag::shift_right, Elements, Modifiers>
+      : make_nary_composite<Elements, sequence>
+    {};
 }}}
 
 #endif
Modified: trunk/boost/spirit/home/qi/operator/sequence_base.hpp
==============================================================================
--- trunk/boost/spirit/home/qi/operator/sequence_base.hpp	(original)
+++ trunk/boost/spirit/home/qi/operator/sequence_base.hpp	2009-04-26 10:42:24 EDT (Sun, 26 Apr 2009)
@@ -1,89 +1,126 @@
 /*=============================================================================
-    Copyright (c) 2001-2007 Joel de Guzman
+    Copyright (c) 2001-2009 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(SPIRIT_SEQUENCE_BASE_APR_22_2006_0811AM)
-#define SPIRIT_SEQUENCE_BASE_APR_22_2006_0811AM
+#if !defined(SPIRIT_SEQUENCE_BASE_APRIL_22_2006_0811AM)
+#define SPIRIT_SEQUENCE_BASE_APRIL_22_2006_0811AM
+
+#if defined(_MSC_VER)
+#pragma once
+#endif
 
 #include <boost/spirit/home/qi/domain.hpp>
-#include <boost/spirit/home/support/attribute_transform.hpp>
+#include <boost/spirit/home/qi/detail/pass_container.hpp>
+#include <boost/spirit/home/support/attributes.hpp>
 #include <boost/spirit/home/support/algorithm/any_if.hpp>
 #include <boost/spirit/home/support/detail/what_function.hpp>
 #include <boost/spirit/home/support/unused.hpp>
-#include <boost/spirit/home/support/detail/values.hpp>
+#include <boost/spirit/home/support/info.hpp>
+#include <boost/spirit/home/support/sequence_base_id.hpp>
+#include <boost/spirit/home/qi/parser.hpp>
 #include <boost/fusion/include/as_vector.hpp>
+#include <boost/fusion/include/vector.hpp>
 #include <boost/fusion/include/for_each.hpp>
 #include <boost/mpl/identity.hpp>
 
 namespace boost { namespace spirit { namespace qi
 {
-    template <typename Derived>
+    template <typename Derived, typename Elements>
     struct sequence_base // this class is shared by sequence and expect
+      : nary_parser<Derived>
     {
-        template <typename T>
-        struct transform_child : mpl::identity<T> {};
+        typedef Elements elements_type;
+        struct sequence_base_id;
 
-        template <typename All, typename Filtered>
-        struct build_container
+        template <typename Context, typename Iterator>
+        struct attribute
         {
-            typedef
-                typename fusion::result_of::as_vector<Filtered>::type
+            // Put all the element attributes in a tuple
+            typedef typename traits::build_attribute_sequence<
+                Elements, Context, mpl::identity, Iterator>::type
+            all_attributes;
+
+            // Now, build a fusion vector over the attributes. Note
+            // that build_fusion_vector 1) removes all unused attributes
+            // and 2) may return unused_type if all elements have
+            // unused_type(s).
+            typedef typename
+                traits::build_fusion_vector<all_attributes>::type
+            type_;
+
+            // Finally, strip single element vectors into its
+            // naked form: vector1<T> --> T
+            typedef typename
+                traits::strip_single_element_vector<type_>::type
             type;
         };
 
-        template <typename Component, typename Context, typename Iterator>
-        struct attribute :
-            build_fusion_sequence<
-                sequence_base<Derived>, Component, Iterator, Context
-            >
-        {
-        };
-
-        template <typename Iterator, typename Context>
-        struct attribute_not_unused
-        {
-            template <typename Component>
-            struct apply
-              : spirit::traits::is_not_unused<typename
-                    traits::attribute_of<
-                        qi::domain, Component, Context, Iterator>::type
-                > 
-            {};
-        };
+        sequence_base(Elements const& elements)
+          : elements(elements) {}
 
-        template <
-            typename Component
-          , typename Iterator, typename Context
+        // standard case. Attribute is a fusion tuple
+        template <typename Iterator, typename Context
           , typename Skipper, typename Attribute>
-        static bool parse(
-            Component const& component
-          , Iterator& first, Iterator const& last
+        bool parse_impl(Iterator& first, Iterator const& last
           , Context& context, Skipper const& skipper
-          , Attribute& attr)
+          , Attribute& attr_, mpl::false_) const
         {
             Iterator iter = first;
-            typedef attribute_not_unused<Iterator, Context> predicate;
+            typedef traits::attribute_not_unused<Context, Iterator> predicate;
+
+            // wrap the attribute in a tuple if it is not a tuple
+            typename traits::wrap_if_not_tuple<Attribute>::type attr(attr_);
 
             // return false if *any* of the parsers fail
-            if (spirit::any_if(
-                component.elements, attr
+            if (spirit::any_if(elements, attr
               , Derived::fail_function(iter, last, context, skipper), predicate()))
                 return false;
             first = iter;
             return true;
         }
 
-        template <typename Component, typename Context>
-        static std::string what(Component const& component, Context const& ctx)
+        // Special case when Attribute is an stl container
+        template <typename Iterator, typename Context
+          , typename Skipper, typename Attribute>
+        bool parse_impl(Iterator& first, Iterator const& last
+          , Context& context, Skipper const& skipper
+          , Attribute& attr_, mpl::true_) const
+        {
+            Iterator iter = first;
+            // return false if *any* of the parsers fail
+            if (fusion::any(elements
+              , detail::make_pass_container(
+                    Derived::fail_function(iter, last, context, skipper), attr_))
+                )
+                return false;
+            first = iter;
+            return true;
+        }
+
+        // main parse function. Dispatches to parse_impl depending
+        // on the Attribute type.
+        template <typename Iterator, typename Context
+          , typename Skipper, typename Attribute>
+        bool parse(Iterator& first, Iterator const& last
+          , Context& context, Skipper const& skipper
+          , Attribute& attr) const
+        {
+            return parse_impl(first, last, context, skipper, attr
+              , traits::is_container<Attribute>());
+        }
+
+        template <typename Context>
+        info what(Context& context) const
         {
-            std::string result = Derived::what_();
-            fusion::for_each(component.elements,
-                spirit::detail::what_function<Context>(result, ctx));
-            result += "]";
+            info result(this->derived().id());
+            fusion::for_each(elements,
+                spirit::detail::what_function<Context>(result, context));
             return result;
         }
+
+        Elements elements;
     };
 }}}
 
Modified: trunk/boost/spirit/home/qi/operator/sequential_or.hpp
==============================================================================
--- trunk/boost/spirit/home/qi/operator/sequential_or.hpp	(original)
+++ trunk/boost/spirit/home/qi/operator/sequential_or.hpp	2009-04-26 10:42:24 EDT (Sun, 26 Apr 2009)
@@ -1,5 +1,5 @@
 /*=============================================================================
-    Copyright (c) 2001-2007 Joel de Guzman
+    Copyright (c) 2001-2009 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)
@@ -7,69 +7,105 @@
 #if !defined(SPIRIT_SEQUENTIAL_OR_MARCH_12_2007_1130PM)
 #define SPIRIT_SEQUENTIAL_OR_MARCH_12_2007_1130PM
 
+#if defined(_MSC_VER)
+#pragma once
+#endif
+
 #include <boost/spirit/home/qi/detail/pass_function.hpp>
-#include <boost/spirit/home/support/attribute_transform.hpp>
+#include <boost/spirit/home/support/attributes.hpp>
 #include <boost/spirit/home/support/detail/what_function.hpp>
-#include <boost/spirit/home/support/algorithm/any_ns.hpp>
+#include <boost/spirit/home/support/algorithm/any_if_ns.hpp>
 #include <boost/fusion/include/as_vector.hpp>
 #include <boost/fusion/include/for_each.hpp>
 
+namespace boost { namespace spirit
+{
+    ///////////////////////////////////////////////////////////////////////////
+    // Enablers
+    ///////////////////////////////////////////////////////////////////////////
+    template <>
+    struct use_operator<qi::domain, proto::tag::logical_or> // enables ||
+      : mpl::true_ {};
+
+    template <>
+    struct flatten_tree<qi::domain, proto::tag::logical_or> // flattens ||
+      : mpl::true_ {};
+}}
+
 namespace boost { namespace spirit { namespace qi
 {
-    struct sequential_or
+    template <typename Elements>
+    struct sequential_or : nary_parser<sequential_or<Elements> >
     {
-        template <typename T>
-        struct transform_child
+        template <typename Context, typename Iterator>
+        struct attribute
         {
-            typedef boost::optional<T> type;
-        };
-
-        template <typename All, typename Filtered>
-        struct build_container
-        {
-            typedef
-                typename fusion::result_of::as_vector<Filtered>::type
+            // Put all the element attributes in a tuple,
+            // wrapping each element in a boost::optional
+            typedef typename traits::build_attribute_sequence<
+                Elements, Context, traits::build_optional, Iterator>::type
+            all_attributes;
+
+            // Now, build a fusion vector over the attributes. Note
+            // that build_fusion_vector 1) removes all unused attributes
+            // and 2) may return unused_type if all elements have
+            // unused_type(s).
+            typedef typename
+                traits::build_fusion_vector<all_attributes>::type
             type;
         };
 
-        template <typename Component, typename Context, typename Iterator>
-        struct attribute :
-            build_fusion_sequence<
-                sequential_or, Component, Iterator, Context
-            >
-        {
-        };
+        sequential_or(Elements const& elements)
+          : elements(elements) {}
 
-        template <
-            typename Component
-          , typename Iterator, typename Context
+        template <typename Iterator, typename Context
           , typename Skipper, typename Attribute>
-        static bool parse(
-            Component const& component
-          , Iterator& first, Iterator const& last
+        bool parse(Iterator& first, Iterator const& last
           , Context& context, Skipper const& skipper
-          , Attribute& attr)
+          , Attribute& attr_) const
         {
-            qi::detail::pass_function<Iterator, Context, Skipper>
+            typedef traits::attribute_not_unused<Context, Iterator> predicate;
+            detail::pass_function<Iterator, Context, Skipper>
                 f(first, last, context, skipper);
 
+            // wrap the attribute in a tuple if it is not a tuple
+            typename traits::wrap_if_not_tuple<Attribute>::type attr(attr_);
+
             // return true if *any* of the parsers succeed
-            // (we use the non-short-circuiting version: any_ns
+            // (we use the non-short-circuiting version: any_if_ns
             // to force all elements to be tested)
-            return spirit::any_ns(component.elements, attr, f);
+            return spirit::any_if_ns(elements, attr, f, predicate());
         }
 
-
-        template <typename Component, typename Context>
-        static std::string what(Component const& component, Context const& ctx)
+        template <typename Context>
+        info what(Context& context) const
         {
-            std::string result = "sequential-or[";
-            fusion::for_each(component.elements,
-                spirit::detail::what_function<Context>(result, ctx));
-            result += "]";
+            info result("sequential-or");
+            fusion::for_each(elements,
+                spirit::detail::what_function<Context>(result, context));
             return result;
         }
+
+        Elements elements;
     };
+
+    ///////////////////////////////////////////////////////////////////////////
+    // Parser generators: make_xxx function (objects)
+    ///////////////////////////////////////////////////////////////////////////
+    template <typename Elements, typename Modifiers>
+    struct make_composite<proto::tag::logical_or, Elements, Modifiers>
+      : make_nary_composite<Elements, sequential_or>
+    {};
+}}}
+
+namespace boost { namespace spirit { namespace traits
+{
+    // We specialize this for sequential_or (see support/attributes.hpp).
+    // For sequential_or, we only wrap the attribute in a tuple IFF
+    // it is not already a fusion tuple.
+    template <typename Elements, typename Attribute>
+    struct pass_attribute<qi::sequential_or<Elements>, Attribute>
+      : wrap_if_not_tuple<Attribute> {};
 }}}
 
 #endif
Modified: trunk/boost/spirit/home/qi/parse.hpp
==============================================================================
--- trunk/boost/spirit/home/qi/parse.hpp	(original)
+++ trunk/boost/spirit/home/qi/parse.hpp	2009-04-26 10:42:24 EDT (Sun, 26 Apr 2009)
@@ -1,38 +1,46 @@
 /*=============================================================================
-    Copyright (c) 2001-2007 Joel de Guzman
+    Copyright (c) 2001-2009 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_PARSE_APR_16_2006_0442PM)
-#define BOOST_SPIRIT_PARSE_APR_16_2006_0442PM
+#if !defined(BOOST_SPIRIT_PARSE_APRIL_16_2006_0442PM)
+#define BOOST_SPIRIT_PARSE_APRIL_16_2006_0442PM
 
-#include <boost/spirit/home/qi/meta_grammar.hpp>
-#include <boost/spirit/home/qi/skip.hpp>
+#if defined(_MSC_VER)
+#pragma once
+#endif
+
+#include <boost/spirit/home/qi/meta_compiler.hpp>
+#include <boost/spirit/home/qi/skip_over.hpp>
 #include <boost/spirit/home/support/unused.hpp>
+#include <boost/spirit/home/support/detail/scoped_enum_emulation.hpp>
 #include <boost/mpl/assert.hpp>
 #include <boost/mpl/bool.hpp>
 
 namespace boost { namespace spirit { namespace qi
 {
+    ///////////////////////////////////////////////////////////////////////////
+    BOOST_SCOPED_ENUM_START(skip_flag) 
+    { 
+        postskip,           // force post-skipping in phrase_parse()
+        dont_postskip       // inhibit post-skipping in phrase_parse()
+    };
+    BOOST_SCOPED_ENUM_END
+
+    ///////////////////////////////////////////////////////////////////////////
     template <typename Iterator, typename Expr>
     inline bool
     parse(
         Iterator& first
       , Iterator last
-      , Expr const& xpr)
+      , Expr const& expr)
     {
-        typedef spirit::traits::is_component<qi::domain, Expr> is_component;
-
-        // report invalid expression error as early as possible
-        BOOST_MPL_ASSERT_MSG(
-            is_component::value,
-            xpr_is_not_convertible_to_a_parser, (Iterator, Expr));
-
-        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::parse(c, first, last, unused, unused, unused);
+        // Report invalid expression error as early as possible.
+        // If you got an error_invalid_expression error message here,
+        // then the expression (expr) is not a valid spirit qi expression.
+        BOOST_SPIRIT_ASSERT_MATCH(qi::domain, Expr)
+        return compile<qi::domain>(expr).parse(first, last, unused, unused, unused);
     }
 
     template <typename Iterator, typename Expr, typename Attr>
@@ -40,20 +48,14 @@
     parse(
         Iterator& first
       , Iterator last
-      , Expr const& xpr
+      , Expr const& expr
       , Attr& attr)
     {
-        typedef spirit::traits::is_component<qi::domain, Expr> is_component;
-
-        // report invalid expression error as early as possible
-        BOOST_MPL_ASSERT_MSG(
-            is_component::value,
-            xpr_is_not_convertible_to_a_parser, (Iterator, Expr, Attr));
-
-        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::parse(c, first, last, unused, unused, attr);
+        // Report invalid expression error as early as possible.
+        // If you got an error_invalid_expression error message here,
+        // then the expression (expr) is not a valid spirit qi expression.
+        BOOST_SPIRIT_ASSERT_MATCH(qi::domain, Expr)
+        return compile<qi::domain>(expr).parse(first, last, unused, unused, attr);
     }
 
     ///////////////////////////////////////////////////////////////////////////
@@ -62,74 +64,74 @@
     phrase_parse(
         Iterator& first
       , Iterator last
-      , Expr const& xpr
-      , Skipper const& skipper_)
+      , Expr const& expr
+      , Skipper const& skipper
+      , BOOST_SCOPED_ENUM(skip_flag) post_skip = skip_flag::postskip)
     {
-        typedef spirit::traits::is_component<qi::domain, Expr> expr_is_component;
-        typedef spirit::traits::is_component<qi::domain, Skipper> skipper_is_component;
-
-        // report invalid expressions error as early as possible
-        BOOST_MPL_ASSERT_MSG(
-            expr_is_component::value,
-            xpr_is_not_convertible_to_a_parser, (Iterator, Expr, Skipper));
-
-        BOOST_MPL_ASSERT_MSG(
-            skipper_is_component::value,
-            skipper_is_not_convertible_to_a_parser, (Iterator, Expr, Skipper));
-
-        typedef typename result_of::as_component<qi::domain, Expr>::type component;
-        typedef typename component::director director;
-        component c = spirit::as_component(qi::domain(), xpr);
-
-        typename result_of::as_component<qi::domain, Skipper>::type 
-            skipper = spirit::as_component(qi::domain(), skipper_);
+        // Report invalid expression error as early as possible.
+        // If you got an error_invalid_expression error message here,
+        // then either the expression (expr) or skipper is not a valid
+        // spirit qi expression.
+        BOOST_SPIRIT_ASSERT_MATCH(qi::domain, Expr)
+        BOOST_SPIRIT_ASSERT_MATCH(qi::domain, Skipper)
+
+        typedef
+            typename result_of::compile<qi::domain, Skipper>::type
+        skipper_type;
+        skipper_type const skipper_ = compile<qi::domain>(skipper);
 
-        if (!director::parse(c, first, last, unused, skipper, unused))
+        if (!compile<qi::domain>(expr).parse(
+                first, last, unused, skipper_, unused))
             return false;
 
-        // do a final post-skip
-        skip(first, last, skipper);
+        if (post_skip == skip_flag::postskip)
+            qi::skip_over(first, last, skipper_);
         return true;
     }
 
-    template <typename Iterator, typename Expr, typename Attr, typename Skipper>
+    template <typename Iterator, typename Expr, typename Skipper, typename Attr>
     inline bool
     phrase_parse(
         Iterator& first
       , Iterator last
-      , Expr const& xpr
-      , Attr& attr
-      , Skipper const& skipper_)
+      , Expr const& expr
+      , Skipper const& skipper
+      , BOOST_SCOPED_ENUM(skip_flag) post_skip
+      , Attr& attr)
     {
-        typedef spirit::traits::is_component<qi::domain, Expr> expr_is_component;
-        typedef spirit::traits::is_component<qi::domain, Skipper> skipper_is_component;
-
-        // report invalid expressions error as early as possible
-        BOOST_MPL_ASSERT_MSG(
-            expr_is_component::value,
-            xpr_is_not_convertible_to_a_parser, 
-            (Iterator, Expr, Attr, Skipper));
-
-        BOOST_MPL_ASSERT_MSG(
-            skipper_is_component::value,
-            skipper_is_not_convertible_to_a_parser, 
-            (Iterator, Expr, Attr, Skipper));
-
-        typedef typename result_of::as_component<qi::domain, Expr>::type component;
-        typedef typename component::director director;
-        component c = spirit::as_component(qi::domain(), xpr);
+        // Report invalid expression error as early as possible.
+        // If you got an error_invalid_expression error message here,
+        // then either the expression (expr) or skipper is not a valid
+        // spirit qi expression.
+        BOOST_SPIRIT_ASSERT_MATCH(qi::domain, Expr)
+        BOOST_SPIRIT_ASSERT_MATCH(qi::domain, Skipper)
+
+        typedef
+            typename result_of::compile<qi::domain, Skipper>::type
+        skipper_type;
+        skipper_type const skipper_ = compile<qi::domain>(skipper);
 
-        typename result_of::as_component<qi::domain, Skipper>::type 
-            skipper = spirit::as_component(qi::domain(), skipper_);
-
-        if (!director::parse(c, first, last, unused, skipper, attr))
+        if (!compile<qi::domain>(expr).parse(
+                first, last, unused, skipper_, attr))
             return false;
 
-        // do a final post-skip
-        skip(first, last, skipper);
+        if (post_skip == skip_flag::postskip)
+            qi::skip_over(first, last, skipper_);
         return true;
     }
-    
+
+    template <typename Iterator, typename Expr, typename Skipper, typename Attr>
+    inline bool
+    phrase_parse(
+        Iterator& first
+      , Iterator last
+      , Expr const& expr
+      , Skipper const& skipper
+      , Attr& attr)
+    {
+        return phrase_parse(first, last, expr, skipper, skip_flag::postskip, attr);
+    }
+
 }}}
 
 #endif
Added: trunk/boost/spirit/home/qi/parse_attr.hpp
==============================================================================
--- (empty file)
+++ trunk/boost/spirit/home/qi/parse_attr.hpp	2009-04-26 10:42:24 EDT (Sun, 26 Apr 2009)
@@ -0,0 +1,120 @@
+//  Copyright (c) 2001-2009 Hartmut Kaiser
+//  Copyright (c) 2001-2009 Joel de Guzman
+//  Copyright (c) 2009 Carl Barron
+// 
+//  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_PP_IS_ITERATING)
+
+#if !defined(BOOST_SPIRIT_PARSE_ATTR_APRIL_24_2009_1043AM)
+#define BOOST_SPIRIT_PARSE_ATTR_APRIL_24_2009_1043AM
+
+#include <boost/spirit/home/qi/parse.hpp>
+
+#include <boost/fusion/include/vector.hpp>
+#include <boost/preprocessor/cat.hpp>
+#include <boost/preprocessor/iterate.hpp>
+#include <boost/preprocessor/repetition/enum.hpp>
+#include <boost/preprocessor/repetition/enum_params.hpp>
+#include <boost/preprocessor/repetition/enum_binary_params.hpp>
+
+#define BOOST_PP_FILENAME_1 <boost/spirit/home/qi/parse_attr.hpp>
+#define BOOST_PP_ITERATION_LIMITS (2, SPIRIT_ARGUMENTS_LIMIT)
+#include BOOST_PP_ITERATE()
+
+#endif
+
+///////////////////////////////////////////////////////////////////////////////
+//
+//  Preprocessor vertical repetition code
+//
+///////////////////////////////////////////////////////////////////////////////
+#else // defined(BOOST_PP_IS_ITERATING)
+
+#define N BOOST_PP_ITERATION()
+#define BOOST_SPIRIT_QI_ATTRIBUTE_REFERENCE(z, n, A) BOOST_PP_CAT(A, n)&
+
+namespace boost { namespace spirit { namespace qi
+{
+    template <typename Iterator, typename Expr
+      , BOOST_PP_ENUM_PARAMS(N, typename A)>
+    inline bool
+    parse(
+        Iterator& first
+      , Iterator last
+      , Expr const& expr
+      , BOOST_PP_ENUM_BINARY_PARAMS(N, A, & attr))
+    {
+        // Report invalid expression error as early as possible.
+        // If you got an error_invalid_expression error message here,
+        // then the expression (expr) is not a valid spirit qi expression.
+        BOOST_SPIRIT_ASSERT_MATCH(qi::domain, Expr)
+
+        typedef fusion::vector<
+            BOOST_PP_ENUM(N, BOOST_SPIRIT_QI_ATTRIBUTE_REFERENCE, A)
+        > vector_type;
+
+        vector_type attr (BOOST_PP_ENUM_PARAMS(N, attr));
+        return compile<qi::domain>(expr).parse(first, last, unused, unused, attr);
+    }
+
+    ///////////////////////////////////////////////////////////////////////////
+    template <typename Iterator, typename Expr, typename Skipper
+      , BOOST_PP_ENUM_PARAMS(N, typename A)>
+    inline bool
+    phrase_parse(
+        Iterator& first
+      , Iterator last
+      , Expr const& expr
+      , Skipper const& skipper
+      , BOOST_SCOPED_ENUM(skip_flag) post_skip
+      , BOOST_PP_ENUM_BINARY_PARAMS(N, A, & attr))
+    {
+        // Report invalid expression error as early as possible.
+        // If you got an error_invalid_expression error message here,
+        // then either the expression (expr) or skipper is not a valid
+        // spirit qi expression.
+        BOOST_SPIRIT_ASSERT_MATCH(qi::domain, Expr)
+        BOOST_SPIRIT_ASSERT_MATCH(qi::domain, Skipper)
+
+        typedef
+            typename result_of::compile<qi::domain, Skipper>::type
+        skipper_type;
+        skipper_type const skipper_ = compile<qi::domain>(skipper);
+
+        typedef fusion::vector<
+            BOOST_PP_ENUM(N, BOOST_SPIRIT_QI_ATTRIBUTE_REFERENCE, A)
+        > vector_type;
+
+        vector_type attr (BOOST_PP_ENUM_PARAMS(N, attr));
+        if (!compile<qi::domain>(expr).parse(
+                first, last, unused, skipper_, attr))
+            return false;
+
+        if (post_skip == skip_flag::postskip)
+            qi::skip_over(first, last, skipper_);
+        return true;
+    }
+
+    template <typename Iterator, typename Expr, typename Skipper
+      , BOOST_PP_ENUM_PARAMS(N, typename A)>
+    inline bool
+    phrase_parse(
+        Iterator& first
+      , Iterator last
+      , Expr const& expr
+      , Skipper const& skipper
+      , BOOST_PP_ENUM_BINARY_PARAMS(N, A, & attr))
+    {
+        return phrase_parse(first, last, expr, skipper, skip_flag::postskip
+          , BOOST_PP_ENUM_PARAMS(N, attr));
+    }
+
+}}}
+
+#undef BOOST_SPIRIT_QI_ATTRIBUTE_REFERENCE
+#undef N
+
+#endif
+
Added: trunk/boost/spirit/home/qi/parser.hpp
==============================================================================
--- (empty file)
+++ trunk/boost/spirit/home/qi/parser.hpp	2009-04-26 10:42:24 EDT (Sun, 26 Apr 2009)
@@ -0,0 +1,135 @@
+/*=============================================================================
+    Copyright (c) 2001-2009 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_PARSER_OCTOBER_16_2008_0254PM)
+#define BOOST_SPIRIT_PARSER_OCTOBER_16_2008_0254PM
+
+#if defined(_MSC_VER)
+#pragma once
+#endif
+
+#include <boost/mpl/has_xxx.hpp>
+#include <boost/spirit/home/qi/domain.hpp>
+
+namespace boost { namespace spirit { namespace qi
+{
+    template <typename Derived>
+    struct parser
+    {
+        struct parser_id;
+        typedef Derived derived_type;
+        typedef qi::domain domain;
+
+        // Requirement: p.parse(f, l, context, skip, attr) -> bool
+        //
+        //  p:          a parser
+        //  f, l:       first/last iterator pair
+        //  context:    enclosing rule context (can be unused_type)
+        //  skip:       skipper (can be unused_type)
+        //  attr:       attribute (can be unused_type)
+
+        // Requirement: p.what(context) -> void
+        //
+        //  p:          a parser
+        //  context:    enclosing rule context (can be unused_type)
+
+        // Requirement: P::template attribute<Ctx, Iter>::type
+        //
+        //  P:          a parser type
+        //  Ctx:        A context type (can be unused_type)
+        //  Iter:       An iterator type (can be unused_type)
+
+        Derived const& derived() const
+        {
+            return *static_cast<Derived const*>(this);
+        }
+    };
+
+    template <typename Derived>
+    struct primitive_parser : parser<Derived>
+    {
+        struct primitive_parser_id;
+    };
+
+    template <typename Derived>
+    struct nary_parser : parser<Derived>
+    {
+        struct nary_parser_id;
+
+        // Requirement: p.elements -> fusion sequence
+        //
+        // p:   a composite parser
+
+        // Requirement: P::elements_type -> fusion sequence
+        //
+        // P:   a composite parser type
+    };
+
+    template <typename Derived>
+    struct unary_parser : parser<Derived>
+    {
+        struct unary_parser_id;
+
+        // Requirement: p.subject -> subject parser
+        //
+        // p:   a unary parser
+
+        // Requirement: P::subject_type -> subject parser type
+        //
+        // P:   a unary parser type
+    };
+
+    template <typename Derived>
+    struct binary_parser : parser<Derived>
+    {
+        struct binary_parser_id;
+
+        // Requirement: p.left -> left parser
+        //
+        // p:   a binary parser
+
+        // Requirement: P::left_type -> left parser type
+        //
+        // P:   a binary parser type
+
+        // Requirement: p.right -> right parser
+        //
+        // p:   a binary parser
+
+        // Requirement: P::right_type -> right parser type
+        //
+        // P:   a binary parser type
+    };
+}}}
+
+namespace boost { namespace spirit { namespace traits // classification
+{
+    namespace detail
+    {
+        BOOST_MPL_HAS_XXX_TRAIT_DEF(parser_id)
+        BOOST_MPL_HAS_XXX_TRAIT_DEF(primitive_parser_id)
+        BOOST_MPL_HAS_XXX_TRAIT_DEF(nary_parser_id)
+        BOOST_MPL_HAS_XXX_TRAIT_DEF(unary_parser_id)
+        BOOST_MPL_HAS_XXX_TRAIT_DEF(binary_parser_id)
+    }
+
+    template <typename T>
+    struct is_parser : detail::has_parser_id<T> {};
+
+    template <typename T>
+    struct is_primitive_parser : detail::has_primitive_parser_id<T> {};
+
+    template <typename T>
+    struct is_nary_parser : detail::has_nary_parser_id<T> {};
+
+    template <typename T>
+    struct is_unary_parser : detail::has_unary_parser_id<T> {};
+
+    template <typename T>
+    struct is_binary_parser : detail::has_binary_parser_id<T> {};
+}}}
+
+#endif
Added: trunk/boost/spirit/home/qi/reference.hpp
==============================================================================
--- (empty file)
+++ trunk/boost/spirit/home/qi/reference.hpp	2009-04-26 10:42:24 EDT (Sun, 26 Apr 2009)
@@ -0,0 +1,53 @@
+/*=============================================================================
+    Copyright (c) 2001-2009 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_REFERENCE_OCTOBER_31_2008_1218AM)
+#define BOOST_SPIRIT_REFERENCE_OCTOBER_31_2008_1218AM
+
+#if defined(_MSC_VER)
+#pragma once
+#endif
+
+#include <boost/spirit/home/qi/meta_compiler.hpp>
+#include <boost/spirit/home/qi/parser.hpp>
+#include <boost/spirit/home/support/info.hpp>
+#include <boost/ref.hpp>
+
+namespace boost { namespace spirit { namespace qi
+{
+    ///////////////////////////////////////////////////////////////////////////
+    // reference is a parser that references another parser (its Subject)
+    ///////////////////////////////////////////////////////////////////////////
+    template <typename Subject>
+    struct reference : parser<reference<Subject> >
+    {
+        reference(Subject& subject)
+          : ref(subject) {}
+
+        template <typename Context, typename Iterator>
+        struct attribute : Subject::template attribute<Context, Iterator> {};
+
+        template <typename Iterator, typename Context
+          , typename Skipper, typename Attribute>
+        bool parse(Iterator& first, Iterator const& last
+          , Context& context, Skipper const& skipper
+          , Attribute& attr) const
+        {
+            return ref.get().parse(first, last, context, skipper, attr);
+        }
+
+        template <typename Context>
+        info what(Context& context) const
+        {
+            // the reference is transparent (does not add any info)
+            return ref.get().what(context);
+        }
+
+        boost::reference_wrapper<Subject> ref;
+    };
+}}}
+
+#endif
Deleted: trunk/boost/spirit/home/qi/skip.hpp
==============================================================================
--- trunk/boost/spirit/home/qi/skip.hpp	2009-04-26 10:42:24 EDT (Sun, 26 Apr 2009)
+++ (empty file)
@@ -1,34 +0,0 @@
-/*=============================================================================
-    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_SKIP_APR_16_2006_0625PM)
-#define BOOST_SPIRIT_SKIP_APR_16_2006_0625PM
-
-#include <boost/spirit/home/qi/meta_grammar.hpp>
-#include <boost/spirit/home/support/unused.hpp>
-
-namespace boost { namespace spirit { namespace qi
-{ 
-    ///////////////////////////////////////////////////////////////////////////
-    // Move the /first/ iterator to the first non-matching position
-    // given a skip-parser. The function is a no-op if unused_type is 
-    // passed as the skip-parser.
-    ///////////////////////////////////////////////////////////////////////////
-    template <typename Iterator, typename T>
-    inline void skip(Iterator& first, Iterator const& last, T const& skipper)
-    {
-        while (first != last && 
-               T::director::parse(skipper, first, last, unused, unused, unused))
-            ;
-    }
-
-    template <typename Iterator>
-    inline void skip(Iterator&, Iterator const&, unused_type)
-    {
-    }
-}}}
-
-#endif
Added: trunk/boost/spirit/home/qi/skip_over.hpp
==============================================================================
--- (empty file)
+++ trunk/boost/spirit/home/qi/skip_over.hpp	2009-04-26 10:42:24 EDT (Sun, 26 Apr 2009)
@@ -0,0 +1,45 @@
+/*=============================================================================
+    Copyright (c) 2001-2009 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_SKIP_APRIL_16_2006_0625PM)
+#define BOOST_SPIRIT_SKIP_APRIL_16_2006_0625PM
+
+#if defined(_MSC_VER)
+#pragma once
+#endif
+
+#include <boost/spirit/home/support/unused.hpp>
+#include <boost/spirit/home/support/unused.hpp>
+
+namespace boost { namespace spirit { namespace qi
+{
+    ///////////////////////////////////////////////////////////////////////////
+    // Move the /first/ iterator to the first non-matching position
+    // given a skip-parser. The function is a no-op if unused_type is
+    // passed as the skip-parser.
+    ///////////////////////////////////////////////////////////////////////////
+    template <typename Iterator, typename T>
+    inline void skip_over(Iterator& first, Iterator const& last, T const& skipper)
+    {
+        while (first != last && skipper.parse(first, last, unused, unused, unused))
+            /***/;
+    }
+
+    template <typename Iterator>
+    inline void skip_over(Iterator&, Iterator const&, unused_type)
+    {
+    }
+
+    template <typename Skipper>
+    struct unused_skipper;
+
+    template <typename Iterator, typename Skipper>
+    inline void skip_over(Iterator&, Iterator const&, unused_skipper<Skipper> const&)
+    {
+    }
+}}}
+
+#endif
Modified: trunk/boost/spirit/home/qi/stream.hpp
==============================================================================
--- trunk/boost/spirit/home/qi/stream.hpp	(original)
+++ trunk/boost/spirit/home/qi/stream.hpp	2009-04-26 10:42:24 EDT (Sun, 26 Apr 2009)
@@ -1,17 +1,19 @@
-//  Copyright (c) 2001-2009 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)
+/*=============================================================================
+    Copyright (c) 2001-2009 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_STREAM_MAY_05_2007_1227PM)
 #define BOOST_SPIRIT_STREAM_MAY_05_2007_1227PM
 
-#if defined(_MSC_VER) && (_MSC_VER >= 1020)
-#pragma once      // MS compatible compilers support #pragma once
+#if defined(_MSC_VER)
+#pragma once
 #endif
 
 #include <boost/spirit/home/qi/stream/match_manip.hpp>
+#include <boost/spirit/home/qi/stream/match_manip_attr.hpp>
 #include <boost/spirit/home/qi/stream/stream.hpp>
-#include <boost/spirit/home/qi/stream/meta_grammar.hpp>
 
 #endif
Deleted: trunk/boost/spirit/home/qi/stream/detail/iterator_istream.hpp
==============================================================================
--- trunk/boost/spirit/home/qi/stream/detail/iterator_istream.hpp	2009-04-26 10:42:24 EDT (Sun, 26 Apr 2009)
+++ (empty file)
@@ -1,52 +0,0 @@
-//  Copyright (c) 2001-2009 Hartmut Kaiser
-// 
-//  Distributed under the Boost Software License, Version 1.0. (See accompanying 
-//  file LICENSE_1_0.txt or copy at http://www.boist.org/LICENSE_1_0.txt)
-
-#if !defined(BOOST_SPIRIT_ITERATOR_ISTREAM_MAY_05_2007_0110PM)
-#define BOOST_SPIRIT_ITERATOR_ISTREAM_MAY_05_2007_0110PM
-
-#include <boost/iostreams/stream.hpp>
-#include <boost/detail/iterator.hpp>
-
-///////////////////////////////////////////////////////////////////////////////
-namespace boost { namespace spirit { namespace qi { namespace detail
-{
-    ///////////////////////////////////////////////////////////////////////////
-    template <typename Iterator>
-    struct iterator_source
-    {
-        typedef typename 
-            boost::detail::iterator_traits<Iterator>::value_type 
-        char_type;
-        typedef boost::iostreams::source_tag category;
-
-        iterator_source (Iterator& first_, Iterator const& last_)
-          : first(first_), last(last_)
-        {}
-        
-        // Read up to n characters from the input sequence into the buffer s, 
-        // returning the number of characters read, or -1 to indicate 
-        // end-of-sequence.
-        std::streamsize read (char_type* s, std::streamsize n) 
-        {
-            if (first == last)
-                return -1;
-        
-            std::streamsize bytes_read = 0;
-            while (n--) {
-                *s = *first;
-                ++s; ++bytes_read;
-                if (++first == last)
-                    break;
-            }
-            return bytes_read;
-        }
-        
-        Iterator& first;
-        Iterator const& last;
-    };
-
-}}}}
-
-#endif
Added: trunk/boost/spirit/home/qi/stream/detail/iterator_source.hpp
==============================================================================
--- (empty file)
+++ trunk/boost/spirit/home/qi/stream/detail/iterator_source.hpp	2009-04-26 10:42:24 EDT (Sun, 26 Apr 2009)
@@ -0,0 +1,57 @@
+/*=============================================================================
+    Copyright (c) 2001-2009 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_ITERATOR_ISTREAM_MAY_05_2007_0110PM)
+#define BOOST_SPIRIT_ITERATOR_ISTREAM_MAY_05_2007_0110PM
+
+#if defined(_MSC_VER)
+#pragma once
+#endif
+
+#include <boost/iostreams/stream.hpp>
+#include <boost/detail/iterator.hpp>
+
+///////////////////////////////////////////////////////////////////////////////
+namespace boost { namespace spirit { namespace qi { namespace detail
+{
+    ///////////////////////////////////////////////////////////////////////////
+    template <typename Iterator>
+    struct iterator_source
+    {
+        typedef typename
+            boost::detail::iterator_traits<Iterator>::value_type
+        char_type;
+        typedef boost::iostreams::source_tag category;
+
+        iterator_source (Iterator& first_, Iterator const& last_)
+          : first(first_), last(last_)
+        {}
+
+        // Read up to n characters from the input sequence into the buffer s,
+        // returning the number of characters read, or -1 to indicate
+        // end-of-sequence.
+        std::streamsize read (char_type* s, std::streamsize n)
+        {
+            if (first == last)
+                return -1;
+
+            std::streamsize bytes_read = 0;
+            while (n--) {
+                *s = *first;
+                ++s; ++bytes_read;
+                if (++first == last)
+                    break;
+            }
+            return bytes_read;
+        }
+
+        Iterator& first;
+        Iterator const& last;
+    };
+
+}}}}
+
+#endif
Modified: trunk/boost/spirit/home/qi/stream/detail/match_manip.hpp
==============================================================================
--- trunk/boost/spirit/home/qi/stream/detail/match_manip.hpp	(original)
+++ trunk/boost/spirit/home/qi/stream/detail/match_manip.hpp	2009-04-26 10:42:24 EDT (Sun, 26 Apr 2009)
@@ -1,13 +1,19 @@
-//  Copyright (c) 2001-2009 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)
+/*=============================================================================
+    Copyright (c) 2001-2009 Hartmut Kaiser
 
-#if !defined(BOOST_SPIRIT_FORMAT_MANIP_MAY_05_2007_1203PM)
-#define BOOST_SPIRIT_FORMAT_MANIP_MAY_05_2007_1203PM
+    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_MATCH_MANIP_MAY_05_2007_1203PM)
+#define BOOST_SPIRIT_MATCH_MANIP_MAY_05_2007_1203PM
+
+#if defined(_MSC_VER)
+#pragma once
+#endif
 
 #include <boost/spirit/home/qi/parse.hpp>
 #include <boost/spirit/home/support/unused.hpp>
+#include <boost/mpl/bool.hpp>
 
 #include <iterator>
 #include <string>
@@ -16,43 +22,61 @@
 namespace boost { namespace spirit { namespace qi { namespace detail
 {
     ///////////////////////////////////////////////////////////////////////////
-    template <
-        typename Expr, 
-        typename Attribute = unused_type const, 
-        typename Skipper = unused_type
-    >
-    struct match_manip 
+    template <typename Expr, typename Copy = mpl::false_
+      , typename Skipper = unused_type, typename Attribute = unused_type const>
+    struct match_manip
     {
-        match_manip(Expr const& xpr, Attribute& a, Skipper const& s) 
-          : expr(xpr), attr(a), skipper(s)
-        {}
+        match_manip(Expr const& xpr, Skipper const& s, Attribute& a)
+          : expr(xpr), attr(a), skipper(s), post_skip(skip_flag::postskip) {}
+
+        match_manip(Expr const& xpr, Skipper const& s
+            , BOOST_SCOPED_ENUM(skip_flag) ps, Attribute& a)
+          : expr(xpr), attr(a), skipper(s), post_skip(ps) {}
 
         Expr const& expr;
+        Skipper const& skipper;
+        BOOST_SCOPED_ENUM(skip_flag) const post_skip;
         Attribute& attr;
+    };
+
+    template <typename Expr, typename Skipper, typename Attribute>
+    struct match_manip<Expr, mpl::true_, Skipper, Attribute>
+    {
+        match_manip(Expr const& xpr, Skipper const& s, Attribute& a)
+          : expr(xpr), attr(a), skipper(s), post_skip(skip_flag::postskip) {}
+
+        match_manip(Expr const& xpr, Skipper const& s
+            , BOOST_SCOPED_ENUM(skip_flag) ps, Attribute& a)
+          : expr(xpr), attr(a), skipper(s), post_skip(ps) {}
+
+        Expr const& expr;
         Skipper const& skipper;
+        BOOST_SCOPED_ENUM(skip_flag) const post_skip;
+        Attribute attr;
     };
 
     ///////////////////////////////////////////////////////////////////////////
-    template<typename Char, typename Traits, typename Expr> 
-    inline std::basic_istream<Char, Traits> & 
-    operator>> (std::basic_istream<Char, Traits> &is, 
-        match_manip<Expr> const& fm)
+    template<typename Char, typename Traits, typename Expr, typename Copy>
+    inline std::basic_istream<Char, Traits> &
+    operator>>(std::basic_istream<Char, Traits> &is,
+        match_manip<Expr, Copy> const& fm)
     {
         typedef std::istream_iterator<Char, Char, Traits> input_iterator;
         input_iterator f(is);
         input_iterator l;
-        if (!qi::parse (f, l, fm.expr))
+        if (!qi::parse(f, l, fm.expr))
         {
             is.setstate(std::ios_base::failbit);
         }
         return is;
     }
-    
+
     ///////////////////////////////////////////////////////////////////////////
-    template<typename Char, typename Traits, typename Expr, typename Attribute> 
-    inline std::basic_istream<Char, Traits> & 
-    operator>> (std::basic_istream<Char, Traits> &is, 
-        match_manip<Expr, Attribute> const& fm)
+    template<typename Char, typename Traits, typename Expr, typename Copy
+      , typename Attribute>
+    inline std::basic_istream<Char, Traits> &
+    operator>>(std::basic_istream<Char, Traits> &is,
+        match_manip<Expr, Copy, unused_type, Attribute> const& fm)
     {
         typedef std::istream_iterator<Char, Char, Traits> input_iterator;
         input_iterator f(is);
@@ -63,42 +87,45 @@
         }
         return is;
     }
-    
-    template<typename Char, typename Traits, typename Expr, typename Skipper> 
-    inline std::basic_istream<Char, Traits> & 
-    operator>> (std::basic_istream<Char, Traits> &is, 
-        match_manip<Expr, unused_type, Skipper> const& fm)
+
+    ///////////////////////////////////////////////////////////////////////////
+    template<typename Char, typename Traits, typename Expr, typename Copy
+      , typename Skipper>
+    inline std::basic_istream<Char, Traits> &
+    operator>>(std::basic_istream<Char, Traits> &is,
+        match_manip<Expr, Copy, Skipper> const& fm)
     {
         typedef std::istream_iterator<Char, Char, Traits> input_iterator;
         input_iterator f(is);
         input_iterator l;
-        if (!qi::phrase_parse(f, l, fm.expr, fm.skipper))
+        if (!qi::phrase_parse(
+                f, l, fm.expr, fm.skipper, fm.post_skip))
         {
             is.setstate(std::ios_base::failbit);
         }
         return is;
     }
-    
+
     ///////////////////////////////////////////////////////////////////////////
-    template<
-        typename Char, typename Traits, 
-        typename Expr, typename Attribute, typename Skipper
-    > 
-    inline std::basic_istream<Char, Traits> & 
-    operator>> (
-        std::basic_istream<Char, Traits> &is, 
-        match_manip<Expr, Attribute, Skipper> const& fm)
+    template<typename Char, typename Traits, typename Expr, typename Copy
+      , typename Attribute, typename Skipper
+    >
+    inline std::basic_istream<Char, Traits> &
+    operator>>(
+        std::basic_istream<Char, Traits> &is,
+        match_manip<Expr, Copy, Attribute, Skipper> const& fm)
     {
         typedef std::istream_iterator<Char, Char, Traits> input_iterator;
         input_iterator f(is);
         input_iterator l;
-        if (!qi::phrase_parse(f, l, fm.expr, fm.attr, fm.skipper))
+        if (!qi::phrase_parse(
+                f, l, fm.expr, fm.skipper, fm.post_skip, fm.attr))
         {
             is.setstate(std::ios_base::failbit);
         }
         return is;
     }
-    
+
 }}}}
 
 #endif
Modified: trunk/boost/spirit/home/qi/stream/match_manip.hpp
==============================================================================
--- trunk/boost/spirit/home/qi/stream/match_manip.hpp	(original)
+++ trunk/boost/spirit/home/qi/stream/match_manip.hpp	2009-04-26 10:42:24 EDT (Sun, 26 Apr 2009)
@@ -1,105 +1,121 @@
-//  Copyright (c) 2001-2009 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)
+/*=============================================================================
+    Copyright (c) 2001-2009 Hartmut Kaiser
+    Copyright (c) 2001-2009 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_MATCH_MANIP_MAY_05_2007_1202PM)
+#define BOOST_SPIRIT_MATCH_MANIP_MAY_05_2007_1202PM
 
-#if !defined(BOOST_SPIRIT_FORMAT_MANIP_MAY_05_2007_1202PM)
-#define BOOST_SPIRIT_FORMAT_MANIP_MAY_05_2007_1202PM
+#if defined(_MSC_VER)
+#pragma once
+#endif
 
 #include <boost/spirit/home/qi/parse.hpp>
+#include <boost/spirit/home/qi/parser.hpp>
 #include <boost/spirit/home/support/unused.hpp>
 #include <boost/spirit/home/qi/stream/detail/match_manip.hpp>
 
-#include <boost/mpl/assert.hpp>
-#include <boost/utility/enable_if.hpp>
-
 ///////////////////////////////////////////////////////////////////////////////
 namespace boost { namespace spirit { namespace qi
 {
     ///////////////////////////////////////////////////////////////////////////
     template <typename Expr>
     inline detail::match_manip<Expr>
-    match(Expr const& xpr)
+    match(
+        Expr const& xpr)
     {
-        typedef spirit::traits::is_component<qi::domain, Expr> is_component;
-
-        // report invalid expression error as early as possible
-        BOOST_MPL_ASSERT_MSG(is_component::value,
-            xpr_is_not_convertible_to_a_parser, (Expr));
-
+        // Report invalid expression error as early as possible.
+        // If you got an error_invalid_expression error message here,
+        // then the expression (expr) is not a valid spirit qi expression.
+        BOOST_SPIRIT_ASSERT_MATCH(qi::domain, Expr)
         return qi::detail::match_manip<Expr>(xpr, unused, unused);
     }
 
     template <typename Expr, typename Attribute>
-    inline detail::match_manip<Expr, Attribute>
-    match(Expr const& xpr, Attribute& p)
+    inline detail::match_manip<Expr, mpl::false_, unused_type, Attribute>
+    match(
+        Expr const& xpr
+      , Attribute& p)
     {
-        typedef spirit::traits::is_component<qi::domain, Expr> is_component;
-
-        // report invalid expression error as early as possible
-        BOOST_MPL_ASSERT_MSG(is_component::value,
-            xpr_is_not_convertible_to_a_parser, (Expr, Attribute));
+        using qi::detail::match_manip;
 
-        return qi::detail::match_manip<Expr, Attribute>(xpr, p, unused);
+        // Report invalid expression error as early as possible.
+        // If you got an error_invalid_expression error message here,
+        // then the expression (expr) is not a valid spirit qi expression.
+        BOOST_SPIRIT_ASSERT_MATCH(qi::domain, Expr)
+        return match_manip<Expr, mpl::false_, unused_type, Attribute>(
+            xpr, unused, p);
     }
 
     ///////////////////////////////////////////////////////////////////////////
     template <typename Expr, typename Skipper>
-    inline detail::match_manip<Expr, unused_type const, Skipper>
-    phrase_match(Expr const& xpr, Skipper const& s)
+    inline detail::match_manip<Expr, mpl::false_, Skipper>
+    phrase_match(
+        Expr const& xpr
+      , Skipper const& s
+      , BOOST_SCOPED_ENUM(skip_flag) post_skip = skip_flag::postskip)
+    {
+        using qi::detail::match_manip;
+
+        // Report invalid expression error as early as possible.
+        // If you got an error_invalid_expression error message here,
+        // then either the expression (expr) or skipper is not a valid
+        // spirit qi expression.
+        BOOST_SPIRIT_ASSERT_MATCH(qi::domain, Expr)
+        BOOST_SPIRIT_ASSERT_MATCH(qi::domain, Skipper)
+        return match_manip<Expr, mpl::false_, Skipper>(
+            xpr, s, post_skip, unused);
+    }
+
+    template <typename Expr, typename Skipper, typename Attribute>
+    inline detail::match_manip<Expr, mpl::false_, Skipper, Attribute>
+    phrase_match(
+        Expr const& xpr
+      , Skipper const& s
+      , BOOST_SCOPED_ENUM(skip_flag) post_skip
+      , Attribute& p)
     {
-        typedef
-            spirit::traits::is_component<qi::domain, Expr>
-        expr_is_component;
-        typedef
-            spirit::traits::is_component<qi::domain, Skipper>
-        skipper_is_component;
-
-        // report invalid expression errors as early as possible
-        BOOST_MPL_ASSERT_MSG(expr_is_component::value,
-            xpr_is_not_convertible_to_a_parser, (Expr, Skipper));
-
-        BOOST_MPL_ASSERT_MSG(skipper_is_component::value,
-            skipper_is_not_convertible_to_a_parser, (Expr, Skipper));
-
-        return qi::detail::match_manip<Expr, unused_type const, Skipper>(
-            xpr, unused, s);
-    }
-
-    template <typename Expr, typename Attribute, typename Skipper>
-    inline detail::match_manip<Expr, Attribute, Skipper>
-    phrase_match(Expr const& xpr, Attribute& p, Skipper const& s)
-    {
-        typedef
-            spirit::traits::is_component<qi::domain, Expr>
-        expr_is_component;
-        typedef
-            spirit::traits::is_component<qi::domain, Skipper>
-        skipper_is_component;
-
-        // report invalid expression errors as early as possible
-        BOOST_MPL_ASSERT_MSG(expr_is_component::value,
-            xpr_is_not_convertible_to_a_parser, (Expr, Attribute, Skipper));
+        using qi::detail::match_manip;
 
-        BOOST_MPL_ASSERT_MSG(skipper_is_component::value,
-            skipper_is_not_convertible_to_a_parser, (Expr, Attribute, Skipper));
+        // Report invalid expression error as early as possible.
+        // If you got an error_invalid_expression error message here,
+        // then either the expression (expr) or skipper is not a valid
+        // spirit qi expression.
+        BOOST_SPIRIT_ASSERT_MATCH(qi::domain, Expr)
+        BOOST_SPIRIT_ASSERT_MATCH(qi::domain, Skipper)
+        return match_manip<Expr, mpl::false_, Skipper, Attribute>(
+            xpr, s, post_skip, p);
+    }
+
+    template <typename Expr, typename Skipper, typename Attribute>
+    inline detail::match_manip<Expr, mpl::false_, Skipper, Attribute>
+    phrase_match(
+        Expr const& xpr
+      , Skipper const& s
+      , Attribute& p)
+    {
+        using qi::detail::match_manip;
 
-        return qi::detail::match_manip<Expr, Attribute, Skipper>(xpr, p, s);
+        // Report invalid expression error as early as possible.
+        // If you got an error_invalid_expression error message here,
+        // then either the expression (expr) or skipper is not a valid
+        // spirit qi expression.
+        BOOST_SPIRIT_ASSERT_MATCH(qi::domain, Expr)
+        BOOST_SPIRIT_ASSERT_MATCH(qi::domain, Skipper)
+        return match_manip<Expr, mpl::false_, Skipper, Attribute>(xpr, s, p);
     }
 
     ///////////////////////////////////////////////////////////////////////////
-    template<typename Char, typename Traits, typename Expr>
-    inline typename
-        enable_if<
-            spirit::traits::is_component<qi::domain, Expr>,
-            std::basic_istream<Char, Traits> &
-        >::type
-    operator>> (std::basic_istream<Char, Traits> &is, Expr& xpr)
+    template<typename Char, typename Traits, typename Derived>
+    inline std::basic_istream<Char, Traits>&
+    operator>>(std::basic_istream<Char, Traits>& is, parser<Derived> const& p)
     {
         typedef std::istream_iterator<Char, Char, Traits> input_iterator;
         input_iterator f(is);
         input_iterator l;
-        if (!qi::parse (f, l, xpr))
+        if (!p.derived().parse(f, l, unused, unused, unused))
         {
             is.setstate(std::ios_base::failbit);
         }
Added: trunk/boost/spirit/home/qi/stream/match_manip_attr.hpp
==============================================================================
--- (empty file)
+++ trunk/boost/spirit/home/qi/stream/match_manip_attr.hpp	2009-04-26 10:42:24 EDT (Sun, 26 Apr 2009)
@@ -0,0 +1,132 @@
+/*=============================================================================
+    Copyright (c) 2001-2009 Hartmut Kaiser
+    Copyright (c) 2001-2009 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_PP_IS_ITERATING)
+
+#if !defined(BOOST_SPIRIT_MATCH_MANIP_ATTR_MAY_05_2007_1202PM)
+#define BOOST_SPIRIT_MATCH_MANIP_ATTR_MAY_05_2007_1202PM
+
+#include <boost/spirit/home/qi/stream/detail/match_manip.hpp>
+
+#include <boost/fusion/include/vector.hpp>
+#include <boost/preprocessor/iterate.hpp>
+#include <boost/preprocessor/repetition/enum.hpp>
+#include <boost/preprocessor/repetition/enum_params.hpp>
+#include <boost/preprocessor/repetition/enum_binary_params.hpp>
+
+#define BOOST_PP_FILENAME_1                                                   \
+    <boost/spirit/home/qi/stream/match_manip_attr.hpp>
+#define BOOST_PP_ITERATION_LIMITS (2, SPIRIT_ARGUMENTS_LIMIT)
+#include BOOST_PP_ITERATE()
+
+#endif
+
+///////////////////////////////////////////////////////////////////////////////
+//
+//  Preprocessor vertical repetition code
+//
+///////////////////////////////////////////////////////////////////////////////
+#else // defined(BOOST_PP_IS_ITERATING)
+
+#define N BOOST_PP_ITERATION()
+#define BOOST_SPIRIT_QI_ATTRIBUTE_REFERENCE(z, n, A) BOOST_PP_CAT(A, n) &
+
+///////////////////////////////////////////////////////////////////////////////
+namespace boost { namespace spirit { namespace qi
+{
+    ///////////////////////////////////////////////////////////////////////////
+    template <typename Expr, BOOST_PP_ENUM_PARAMS(N, typename A)>
+    inline detail::match_manip<Expr, mpl::true_, unused_type
+      , fusion::vector<
+            BOOST_PP_ENUM(N, BOOST_SPIRIT_QI_ATTRIBUTE_REFERENCE, A)
+        > > 
+    match(
+        Expr const& xpr
+      , BOOST_PP_ENUM_BINARY_PARAMS(N, A, & attr))
+    {
+        using qi::detail::match_manip;
+
+        // Report invalid expression error as early as possible.
+        // If you got an error_invalid_expression error message here,
+        // then the expression (expr) is not a valid spirit qi expression.
+        BOOST_SPIRIT_ASSERT_MATCH(qi::domain, Expr)
+
+        typedef fusion::vector<
+            BOOST_PP_ENUM(N, BOOST_SPIRIT_QI_ATTRIBUTE_REFERENCE, A)
+        > vector_type;
+
+        vector_type attr (BOOST_PP_ENUM_PARAMS(N, attr));
+        return match_manip<Expr, mpl::true_, unused_type, vector_type>(
+            xpr, unused, attr);
+    }
+
+    ///////////////////////////////////////////////////////////////////////////
+    template <typename Expr, typename Skipper
+      , BOOST_PP_ENUM_PARAMS(N, typename A)>
+    inline detail::match_manip<Expr, mpl::true_, Skipper
+      , fusion::vector<
+            BOOST_PP_ENUM(N, BOOST_SPIRIT_QI_ATTRIBUTE_REFERENCE, A)
+        > > 
+    phrase_match(
+        Expr const& xpr
+      , Skipper const& s
+      , BOOST_SCOPED_ENUM(skip_flag) post_skip
+      , BOOST_PP_ENUM_BINARY_PARAMS(N, A, & attr))
+    {
+        using qi::detail::match_manip;
+
+        // Report invalid expression error as early as possible.
+        // If you got an error_invalid_expression error message here,
+        // then either the expression (expr) or skipper is not a valid
+        // spirit qi expression.
+        BOOST_SPIRIT_ASSERT_MATCH(qi::domain, Expr)
+        BOOST_SPIRIT_ASSERT_MATCH(qi::domain, Skipper)
+
+        typedef fusion::vector<
+            BOOST_PP_ENUM(N, BOOST_SPIRIT_QI_ATTRIBUTE_REFERENCE, A)
+        > vector_type;
+
+        vector_type attr (BOOST_PP_ENUM_PARAMS(N, attr));
+        return match_manip<Expr, mpl::true_, Skipper, vector_type>(
+            xpr, s, post_skip, attr);
+    }
+
+    template <typename Expr, typename Skipper
+      , BOOST_PP_ENUM_PARAMS(N, typename A)>
+    inline detail::match_manip<Expr, mpl::true_, Skipper
+      , fusion::vector<
+            BOOST_PP_ENUM(N, BOOST_SPIRIT_QI_ATTRIBUTE_REFERENCE, A)
+        > > 
+    phrase_match(
+        Expr const& xpr
+      , Skipper const& s
+      , BOOST_PP_ENUM_BINARY_PARAMS(N, A, & attr))
+    {
+        using qi::detail::match_manip;
+
+        // Report invalid expression error as early as possible.
+        // If you got an error_invalid_expression error message here,
+        // then either the expression (expr) or skipper is not a valid
+        // spirit qi expression.
+        BOOST_SPIRIT_ASSERT_MATCH(qi::domain, Expr)
+        BOOST_SPIRIT_ASSERT_MATCH(qi::domain, Skipper)
+
+        typedef fusion::vector<
+            BOOST_PP_ENUM(N, BOOST_SPIRIT_QI_ATTRIBUTE_REFERENCE, A)
+        > vector_type;
+
+        vector_type attr (BOOST_PP_ENUM_PARAMS(N, attr));
+        return match_manip<Expr, mpl::true_, Skipper, vector_type>(xpr, s, attr);
+    }
+
+}}}
+
+#undef BOOST_SPIRIT_QI_ATTRIBUTE_REFERENCE
+#undef N
+
+#endif
+
Deleted: trunk/boost/spirit/home/qi/stream/meta_grammar.hpp
==============================================================================
--- trunk/boost/spirit/home/qi/stream/meta_grammar.hpp	2009-04-26 10:42:24 EDT (Sun, 26 Apr 2009)
+++ (empty file)
@@ -1,134 +0,0 @@
-//  Copyright (c) 2001-2009 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_META_GRAMMAR_MAY_05_2007_1230PM)
-#define BOOST_SPIRIT_META_GRAMMAR_MAY_05_2007_1230PM
-
-#if defined(_MSC_VER) && (_MSC_VER >= 1020)
-#pragma once      // MS compatible compilers support #pragma once
-#endif
-
-#include <boost/spirit/home/qi/domain.hpp>
-#include <boost/spirit/home/support/placeholders.hpp>
-#include <boost/spirit/home/support/meta_grammar.hpp>
-#include <boost/utility/enable_if.hpp>
-
-namespace boost { namespace spirit 
-{
-    namespace qi
-    {
-        template <typename T, typename Char>
-        struct stream_tag;
-    }
-
-    template <typename T, typename Char>
-    struct is_stream_tag<qi::stream_tag<T, Char>, qi::domain> 
-      : mpl::true_ {};
-}}
-
-namespace boost { namespace spirit { namespace qi
-{
-    ///////////////////////////////////////////////////////////////////////////
-    // forwards
-    /////////////////////////////////////////////////////////////////////////// 
-    template <typename Char, typename T>
-    struct any_stream;
-    
-    template <typename Char>
-    struct stream_director;
-    
-    struct main_meta_grammar;
-
-    template <typename Expr, typename Enable>
-    struct is_valid_expr;
-
-    template <typename Expr, typename Enable>
-    struct expr_transform;
-
-    ///////////////////////////////////////////////////////////////////////////
-    // stream tag
-    ///////////////////////////////////////////////////////////////////////////
-    template <typename T, typename Char>
-    struct stream_tag
-    {
-    };
-
-    ///////////////////////////////////////////////////////////////////////////
-    // stream specs
-    ///////////////////////////////////////////////////////////////////////////
-    template <typename T, typename Char = char>
-    struct typed_stream
-      : proto::terminal<stream_tag<T, Char> >::type
-    {
-    };
-
-    ///////////////////////////////////////////////////////////////////////////
-    // get the director for a stream
-    ///////////////////////////////////////////////////////////////////////////
-    template <typename Tag>
-    struct extract_stream_director;
-    
-    template <>
-    struct extract_stream_director<tag::stream>
-    {
-        typedef any_stream<char> type;
-    };
-
-    template <>
-    struct extract_stream_director<tag::wstream>
-    {
-        typedef any_stream<wchar_t> type;
-    };
-
-    template <typename T, typename Char>
-    struct extract_stream_director<stream_tag<T, Char> >
-    {
-        typedef any_stream<Char, T> type;
-    };
-
-    ///////////////////////////////////////////////////////////////////////////
-    // utility meta-grammar
-    ///////////////////////////////////////////////////////////////////////////
-    struct utility_meta_grammar :  
-        // stream, wstream
-        meta_grammar::compose_empty<    
-            proto::if_<
-                is_stream_tag<proto::_child, qi::domain>()
-            >,
-            qi::domain,
-            mpl::identity<extract_stream_director<mpl::_> >
-        >
-    {
-    };
-
-    ///////////////////////////////////////////////////////////////////////////
-    //  These specializations non-intrusively hooks into the Qi meta-grammar.
-    //  (see qi/meta_grammar.hpp)
-    ///////////////////////////////////////////////////////////////////////////
-    template <typename Expr>
-    struct is_valid_expr<
-            Expr,
-            typename enable_if<
-                proto::matches<Expr, utility_meta_grammar> 
-            >::type
-        >
-      : mpl::true_
-    {
-    };
-
-    template <typename Expr>
-    struct expr_transform<
-            Expr,
-            typename enable_if<
-                proto::matches<Expr, utility_meta_grammar> 
-            >::type
-        >
-      : mpl::identity<utility_meta_grammar>
-    {
-    };
-    
-}}}
-
-#endif
Modified: trunk/boost/spirit/home/qi/stream/stream.hpp
==============================================================================
--- trunk/boost/spirit/home/qi/stream/stream.hpp	(original)
+++ trunk/boost/spirit/home/qi/stream/stream.hpp	2009-04-26 10:42:24 EDT (Sun, 26 Apr 2009)
@@ -1,18 +1,19 @@
-//  Copyright (c) 2001-2009 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)
+/*=============================================================================
+    Copyright (c) 2001-2009 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_STREAM_MAY_05_2007_1228PM)
 #define BOOST_SPIRIT_STREAM_MAY_05_2007_1228PM
 
-#if defined(_MSC_VER) && (_MSC_VER >= 1020)
-#pragma once      // MS compatible compilers support #pragma once
+#if defined(_MSC_VER)
+#pragma once
 #endif
 
 #include <boost/spirit/home/qi/detail/string_parse.hpp>
 #include <boost/spirit/home/qi/stream/detail/match_manip.hpp>
-#include <boost/spirit/home/qi/stream/detail/iterator_istream.hpp>
+#include <boost/spirit/home/qi/stream/detail/iterator_source.hpp>
 #include <boost/spirit/home/support/detail/hold_any.hpp>
 
 #include <iosfwd>
@@ -21,53 +22,80 @@
 ///////////////////////////////////////////////////////////////////////////////
 namespace boost { namespace spirit
 {
-    // overload the streaming operators for the unused_type
-    template <typename Char, typename Traits>
-    inline std::basic_istream<Char, Traits>&
-    operator>> (std::basic_istream<Char, Traits>& is, unused_type&)
-    {
-        return is;
-    }
+    ///////////////////////////////////////////////////////////////////////////
+    // Enablers
+    ///////////////////////////////////////////////////////////////////////////
+    template <>
+    struct use_terminal<qi::domain, tag::stream> // enables stream
+      : mpl::true_ {};
+
+    template <>
+    struct use_terminal<qi::domain, tag::wstream> // enables wstream
+      : mpl::true_ {};
 }}
 
 ///////////////////////////////////////////////////////////////////////////////
 namespace boost { namespace spirit { namespace qi
 {
+    using spirit::stream;
+    using spirit::wstream;
+
     template <typename Char, typename T = spirit::hold_any>
-    struct any_stream
+    struct stream_parser
+      : primitive_parser<stream_parser<Char, T> >
     {
-        template <typename Component, typename Context, typename Iterator>
+        template <typename Context, typename Iterator>
         struct attribute
         {
             typedef T type;
         };
 
-        template <
-            typename Component
-          , typename Iterator, typename Context
+        template <typename Iterator, typename Context
           , typename Skipper, typename Attribute>
-        static bool parse(
-            Component const& /*component*/
-          , Iterator& first, Iterator const& last
+        bool parse(Iterator& first, Iterator const& last
           , Context& /*context*/, Skipper const& skipper
-          , Attribute& attr)
+          , Attribute& attr) const
         {
             typedef qi::detail::iterator_source<Iterator> source_device;
             typedef boost::iostreams::stream<source_device> instream;
 
-            qi::skip(first, last, skipper);
-            instream in (first, last);
+            qi::skip_over(first, last, skipper);
+            instream in(first, last);
             in >> attr;                       // use existing operator>>()
             return in.good() || in.eof();
         }
 
-        template <typename Component, typename Context>
-        static std::string what(Component const& component, Context const& ctx)
+        template <typename Context>
+        info what(Context& /*context*/) const
         {
-            return "any-stream";
+            return info("stream");
         }
     };
 
+    template <typename T, typename Char = char>
+    struct typed_stream
+      : proto::terminal<stream_parser<Char, T> >::type
+    {
+    };
+
+    ///////////////////////////////////////////////////////////////////////////
+    // Parser generators: make_xxx function (objects)
+    ///////////////////////////////////////////////////////////////////////////
+    template <typename Char>
+    struct make_stream
+    {
+        typedef stream_parser<Char> result_type;
+        result_type operator()(unused_type, unused_type) const
+        {
+            return result_type();
+        }
+    };
+
+    template <typename Modifiers>
+    struct make_primitive<tag::stream, Modifiers> : make_stream<char> {};
+
+    template <typename Modifiers>
+    struct make_primitive<tag::wstream, Modifiers> : make_stream<wchar_t> {};
 }}}
 
 #endif
Modified: trunk/boost/spirit/home/qi/string.hpp
==============================================================================
--- trunk/boost/spirit/home/qi/string.hpp	(original)
+++ trunk/boost/spirit/home/qi/string.hpp	2009-04-26 10:42:24 EDT (Sun, 26 Apr 2009)
@@ -1,14 +1,17 @@
 /*=============================================================================
-    Copyright (c) 2001-2007 Joel de Guzman
+    Copyright (c) 2001-2009 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_STRING_FEB_03_2007_0355PM)
-#define BOOST_SPIRIT_STRING_FEB_03_2007_0355PM
+#if !defined(BOOST_SPIRIT_STRING_FEBRUARY_03_2007_0355PM)
+#define BOOST_SPIRIT_STRING_FEBRUARY_03_2007_0355PM
+
+#if defined(_MSC_VER)
+#pragma once
+#endif
 
 #include <boost/spirit/home/qi/string/lit.hpp>
 #include <boost/spirit/home/qi/string/symbols.hpp>
-#include <boost/spirit/home/qi/string/meta_grammar.hpp>
 
 #endif
Modified: trunk/boost/spirit/home/qi/string/detail/tst.hpp
==============================================================================
--- trunk/boost/spirit/home/qi/string/detail/tst.hpp	(original)
+++ trunk/boost/spirit/home/qi/string/detail/tst.hpp	2009-04-26 10:42:24 EDT (Sun, 26 Apr 2009)
@@ -1,5 +1,5 @@
 /*=============================================================================
-    Copyright (c) 2001-2007 Joel de Guzman
+    Copyright (c) 2001-2009 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)
@@ -7,6 +7,10 @@
 #if !defined(BOOST_SPIRIT_TST_MARCH_09_2007_0905AM)
 #define BOOST_SPIRIT_TST_MARCH_09_2007_0905AM
 
+#if defined(_MSC_VER)
+#pragma once
+#endif
+
 #include <boost/call_traits.hpp>
 #include <boost/detail/iterator.hpp>
 #include <boost/foreach.hpp>
@@ -207,198 +211,6 @@
         tst_node* eq;   // middle pointer
         tst_node* gt;   // right pointer
     };
-
-/*
-    template <typename Char, typename T>
-    struct tst
-    {
-        typedef Char char_type; // the character type
-        typedef T value_type; // the value associated with each entry
-        typedef tst_node<Char, T> tst_node;
-
-        tst()
-        {
-        }
-
-        ~tst()
-        {
-            // Nothing to do here.
-            // The pools do the right thing for us
-        }
-
-        tst(tst const& rhs)
-        {
-            copy(rhs);
-        }
-
-        tst& operator=(tst const& rhs)
-        {
-            return assign(rhs);
-        }
-
-        template <typename Iterator, typename Filter>
-        T* find(Iterator& first, Iterator last, Filter filter) const
-        {
-            if (first != last)
-            {
-                Iterator save = first;
-                typename map_type::const_iterator
-                    i = map.find(filter(*first++));
-                if (i == map.end())
-                {
-                    first = save;
-                    return 0;
-                }
-                if (T* p = detail::find(i->second.root, first, last, filter))
-                {
-                    return p;
-                }
-                return i->second.data;
-            }
-            return 0;
-        }
-
-        template <typename Iterator>
-        T* find(Iterator& first, Iterator last) const
-        {
-            return find(first, last, tst_pass_through());
-        }
-
-        template <typename Iterator>
-        bool add(
-            Iterator first
-          , Iterator last
-          , typename boost::call_traits<T>::param_type val)
-        {
-            if (first != last)
-            {
-                map_data x = {0, 0};
-                std::pair<typename map_type::iterator, bool>
-                    r = map.insert(std::pair<Char, map_data>(*first++, x));
-
-                if (first != last)
-                {
-                    return detail::add(r.first->second.root, first, last, val, this);
-                }
-                else
-                {
-                    if (r.first->second.data)
-                        return false;
-                    r.first->second.data = this->new_data(val);
-                }
-                return true;
-            }
-            return false;
-        }
-
-        template <typename Iterator>
-        void remove(Iterator first, Iterator last)
-        {
-            if (first != last)
-            {
-                typename map_type::iterator i = map.find(*first++);
-                if (i != map.end())
-                {
-                    if (first != last)
-                    {
-                        detail::remove(i->second.root, first, last, this);
-                    }
-                    else if (i->second.data)
-                    {
-                        this->delete_data(i->second.data);
-                        i->second.data = 0;
-                    }
-                    if (i->second.data == 0 && i->second.root == 0)
-                    {
-                        map.erase(i);
-                    }
-                }
-            }
-        }
-
-        void clear()
-        {
-            BOOST_FOREACH(typename map_type::value_type& x, map)
-            {
-                destruct_node(x.second.root, this);
-                if (x.second.data)
-                    this->delete_data(x.second.data);
-            }
-            map.clear();
-        }
-
-        template <typename F>
-        void for_each(F f) const
-        {
-            BOOST_FOREACH(typename map_type::value_type const& x, map)
-            {
-                std::basic_string<Char> s(1, x.first);
-                detail::for_each(x.second.root, s, f);
-                if (x.second.data)
-                    f(s, *x.second.data);
-            }
-        }
-
-        tst_node* new_node(Char id)
-        {
-            return node_pool.construct(id);
-        }
-
-        T* new_data(typename boost::call_traits<T>::param_type val)
-        {
-            return data_pool.construct(val);
-        }
-
-        void delete_node(tst_node* p)
-        {
-            node_pool.destroy(p);
-        }
-
-        void delete_data(T* p)
-        {
-            data_pool.destroy(p);
-        }
-
-    private:
-
-        struct map_data
-        {
-            tst_node* root;
-            T* data;
-        };
-
-        typedef unordered_map<Char, map_data> map_type;
-
-        void copy(tst const& rhs)
-        {
-            BOOST_FOREACH(typename map_type::value_type const& x, rhs.map)
-            {
-                map_data xx = {clone_node(x.second.root, this), 0};
-                if (x.second.data)
-                    xx.data = data_pool.construct(*x.second.data);
-                map[x.first] = xx;
-            }
-        }
-
-        tst& assign(tst const& rhs)
-        {
-            if (this != &rhs)
-            {
-                BOOST_FOREACH(typename map_type::value_type& x, map)
-                {
-                    destruct_node(x.second.root, this);
-                }
-                map.clear();
-                copy(rhs);
-            }
-            return *this;
-        }
-
-        map_type map;
-        object_pool<tst_node> node_pool;
-        object_pool<T> data_pool;
-    };
-*/
 }}}}
 
 #endif
Deleted: trunk/boost/spirit/home/qi/string/lit.hpp
==============================================================================
--- trunk/boost/spirit/home/qi/string/lit.hpp	2009-04-26 10:42:24 EDT (Sun, 26 Apr 2009)
+++ (empty file)
@@ -1,204 +0,0 @@
-/*=============================================================================
-    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_LIT_APR_18_2006_1125PM)
-#define BOOST_SPIRIT_LIT_APR_18_2006_1125PM
-
-#include <boost/spirit/home/qi/domain.hpp>
-#include <boost/spirit/home/qi/skip.hpp>
-#include <boost/spirit/home/qi/detail/string_parse.hpp>
-#include <boost/spirit/home/support/char_class.hpp>
-#include <boost/spirit/home/support/modifier.hpp>
-#include <boost/spirit/home/support/unused.hpp>
-#include <boost/spirit/home/support/detail/to_narrow.hpp>
-#include <boost/fusion/include/at.hpp>
-#include <boost/fusion/include/value_at.hpp>
-#include <boost/fusion/include/vector.hpp>
-#include <boost/type_traits/remove_reference.hpp>
-#include <string>
-
-namespace boost { namespace spirit { namespace qi
-{
-    ///////////////////////////////////////////////////////////////////////////
-    // parse literal strings
-    ///////////////////////////////////////////////////////////////////////////
-    template <typename Char>
-    struct literal_string
-    {
-        template <typename Component, typename Context, typename Iterator>
-        struct attribute
-        {
-            typedef unused_type type;   // literal parsers have no attribute
-        };
-
-        template <
-            typename Component
-          , typename Iterator, typename Context
-          , typename Skipper, typename Attribute>
-        static bool parse(
-            Component const& component
-          , Iterator& first, Iterator const& last
-          , Context& /*context*/, Skipper const& skipper
-          , Attribute& attr)
-        {
-            qi::skip(first, last, skipper);
-            return detail::string_parse(
-                fusion::at_c<0>(component.elements)
-              , first
-              , last
-              , attr
-            );
-        }
-
-        template <typename Component, typename Context>
-        static std::string what(Component const& component, Context const& ctx)
-        {
-            return std::string("\"")
-                + spirit::detail::to_narrow_string(
-                    fusion::at_c<0>(component.elements))
-                + std::string("\"")
-            ;
-        }
-    };
-
-    ///////////////////////////////////////////////////////////////////////////
-    // parse lazy strings
-    ///////////////////////////////////////////////////////////////////////////
-    struct lazy_string
-    {
-        template <typename Component, typename Context, typename Iterator>
-        struct attribute
-        {
-            typedef typename
-                result_of::subject<Component>::type
-            subject_type;
-
-            typedef typename
-                remove_reference<
-                    typename boost::result_of<subject_type(unused_type, Context)>::type
-                >::type
-            type;
-        };
-
-        template <
-            typename Component
-          , typename Iterator, typename Context
-          , typename Skipper, typename Attribute>
-        static bool parse(
-            Component const& component
-          , Iterator& first, Iterator const& last
-          , Context& context, Skipper const& skipper
-          , Attribute& attr)
-        {
-            qi::skip(first, last, skipper);
-            return detail::string_parse(
-                fusion::at_c<0>(component.elements)(unused, context)
-              , first
-              , last
-              , attr
-            );
-        }
-
-        template <typename Component, typename Context>
-        static std::string what(Component const& component, Context const& ctx)
-        {
-            return std::string("\"")
-                + spirit::detail::to_narrow_string(
-                    fusion::at_c<0>(component.elements)(unused, ctx))
-                + std::string("\"")
-            ;
-        }
-    };
-
-    ///////////////////////////////////////////////////////////////////////////
-    // no_case literal_string version
-    ///////////////////////////////////////////////////////////////////////////
-    template <typename Char>
-    struct no_case_literal_string
-    {
-        template <typename Component, typename Context, typename Iterator>
-        struct attribute
-        {
-            typedef unused_type type;   // literal parsers have no attribute
-        };
-
-        template <
-            typename Component
-          , typename Iterator, typename Context
-          , typename Skipper, typename Attribute>
-        static bool parse(
-            Component const& component
-          , Iterator& first, Iterator const& last
-          , Context& /*context*/, Skipper const& skipper
-          , Attribute& attr)
-        {
-            qi::skip(first, last, skipper);
-            return detail::string_parse(
-                fusion::at_c<0>(component.elements)
-              , fusion::at_c<1>(component.elements)
-              , first
-              , last
-              , attr
-            );
-        }
-
-        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(
-                    fusion::at_c<0>(component.elements))
-                + std::string("\"")
-            ;
-        }
-    };
-}}}
-
-namespace boost { namespace spirit { namespace traits
-{
-    ///////////////////////////////////////////////////////////////////////////
-    // no_case_literal_string generator
-    ///////////////////////////////////////////////////////////////////////////
-    template <
-        typename Domain, typename Elements, typename Modifier, typename Char
-    >
-    struct make_modified_component<
-        Domain, qi::literal_string<Char>, Elements, Modifier
-      , typename enable_if<
-            is_member_of_modifier<Modifier, spirit::char_class::no_case_base_tag>
-        >::type
-    >
-    {
-        typedef std::basic_string<Char> string_type;
-        typedef fusion::vector<string_type, string_type> vector_type;
-        typedef
-            component<qi::domain, qi::no_case_literal_string<Char>, vector_type>
-        type;
-
-        static type
-        call(Elements const& elements)
-        {
-            typedef typename Modifier::char_set char_set;
-
-            Char const* in = fusion::at_c<0>(elements);
-            string_type lo(in);
-            string_type hi(in);
-
-            typename string_type::iterator loi = lo.begin();
-            typename string_type::iterator hii = hi.begin();
-
-            for (; loi != lo.end(); ++loi, ++hii, ++in)
-            {
-                *loi = char_set::tolower(*loi);
-                *hii = char_set::toupper(*hii);
-            }
-
-            return type(vector_type(lo, hi));
-        }
-    };
-}}}
-
-#endif
Deleted: trunk/boost/spirit/home/qi/string/meta_grammar.hpp
==============================================================================
--- trunk/boost/spirit/home/qi/string/meta_grammar.hpp	2009-04-26 10:42:24 EDT (Sun, 26 Apr 2009)
+++ (empty file)
@@ -1,203 +0,0 @@
-/*=============================================================================
-    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_META_GRAMMAR_FEB_03_2007_0356PM)
-#define BOOST_SPIRIT_META_GRAMMAR_FEB_03_2007_0356PM
-
-#include <boost/spirit/home/qi/domain.hpp>
-#include <boost/spirit/home/support/placeholders.hpp>
-#include <boost/spirit/home/support/meta_grammar.hpp>
-#include <boost/utility/enable_if.hpp>
-#include <boost/type_traits/remove_const.hpp>
-#include <boost/type_traits/is_convertible.hpp>
-#include <string>
-
-namespace boost { namespace spirit { namespace qi
-{
-    ///////////////////////////////////////////////////////////////////////////
-    // forwards
-    ///////////////////////////////////////////////////////////////////////////
-    template<typename Char>
-    struct literal_string;
-
-    struct lazy_string;
-
-    template <typename Filter>
-    struct symbols_director;
-
-    struct string_meta_grammar;
-
-    template <typename Expr, typename Enable>
-    struct is_valid_expr;
-
-    template <typename Expr, typename Enable>
-    struct expr_transform;
-
-    template <typename Lookup>
-    struct symbols_lookup;
-
-    ///////////////////////////////////////////////////////////////////////////
-    // get the director of a string literal type
-    ///////////////////////////////////////////////////////////////////////////
-    template <typename T>
-    struct extract_char;
-
-    template <typename Char, typename Traits, typename Alloc>
-    struct extract_char<std::basic_string<Char, Traits, Alloc> >
-    {
-        typedef Char type;
-    };
-
-    template <typename Char, int N>
-    struct extract_char<Char[N]>
-    {
-        typedef typename remove_const<Char>::type type;
-    };
-
-    template <typename Char, int N>
-    struct extract_char<Char(&)[N]>
-    {
-        typedef typename remove_const<Char>::type type;
-    };
-
-    template <typename Char>
-    struct extract_char<Char*>
-    {
-        typedef typename remove_const<Char>::type type;
-    };
-
-    template <typename Tag, typename T>
-    struct extract_lit_director;
-
-    template <typename T>
-    struct extract_lit_director<tag::lit, T>
-    {
-        typedef typename extract_char<T>::type char_type;
-        typedef literal_string<char_type> type;
-    };
-
-    template <typename T>
-    struct extract_lit_director<tag::wlit, T>
-    {
-        typedef typename extract_char<T>::type char_type;
-        typedef literal_string<char_type> type;
-    };
-
-    ///////////////////////////////////////////////////////////////////////////
-    // string parser meta-grammars
-    ///////////////////////////////////////////////////////////////////////////
-
-    // literal strings: "hello"
-    struct string_literal_meta_grammar
-      : proto::or_<
-            meta_grammar::terminal_rule<
-                qi::domain, char const*, literal_string<char> >
-          , meta_grammar::terminal_rule<
-                qi::domain, char*, literal_string<char> >
-          , meta_grammar::terminal_rule<
-                qi::domain, wchar_t const*, literal_string<wchar_t> >
-          , meta_grammar::terminal_rule<
-                qi::domain, wchar_t*, literal_string<wchar_t> >
-
-        >
-    {
-    };
-
-    // literal strings: "hello"
-    struct basic_string_literal_meta_grammar
-      : proto::or_<
-            proto::terminal<char const*>
-          , proto::terminal<wchar_t const*>
-        >
-    {
-    };
-
-    // std::string(s)
-    struct basic_std_string_meta_grammar
-      : proto::or_<
-            proto::terminal<std::basic_string<char, proto::_, proto::_> >
-          , proto::terminal<std::basic_string<wchar_t, proto::_, proto::_> >
-        >
-    {
-    };
-
-    // std::string(s)
-    struct std_string_meta_grammar
-      : proto::or_<
-            meta_grammar::terminal_rule<
-                qi::domain
-              , std::basic_string<char, proto::_, proto::_>
-              , literal_string<char> >
-          , meta_grammar::terminal_rule<
-                qi::domain
-              , std::basic_string<wchar_t, proto::_, proto::_>
-              , literal_string<wchar_t> >
-        >
-    {
-    };
-
-    namespace detail
-    {
-        // we use this test to detect if the argument to lit is a callable
-        // function or not. Only types convertible to int or function/
-        // function objects are allowed. Therefore, if T is not convertible
-        // to an int, then we have a function/function object.
-        template <typename T>
-        struct is_not_convertible_to_int
-          : mpl::not_<is_convertible<T, int> >
-        {};
-    }
-
-    // strings: "hello", lit("hello"), lit(str), lit(f), symbols
-    struct string_meta_grammar
-      : proto::or_<
-            string_literal_meta_grammar
-          , std_string_meta_grammar
-          , meta_grammar::compose_function1_eval<
-                proto::function<
-                    proto::if_<
-                        is_lit_tag<proto::_child, qi::domain>()>
-                  , proto::or_<basic_string_literal_meta_grammar, basic_std_string_meta_grammar>
-                >
-              , qi::domain
-              , mpl::identity<extract_lit_director<mpl::_, mpl::_> >
-            >
-          , meta_grammar::function1_rule<
-                qi::domain
-              , tag::lit
-              , lazy_string
-              , proto::if_<
-                    detail::is_not_convertible_to_int<proto::_child >() >
-            >
-          , meta_grammar::terminal_rule<
-                qi::domain
-              , symbols_lookup<proto::_>
-              , symbols_director<>
-            >
-        >
-    {
-    };
-
-    ///////////////////////////////////////////////////////////////////////////
-    //  These specializations non-intrusively hooks into the RD meta-grammar.
-    //  (see qi/meta_grammar.hpp)
-    ///////////////////////////////////////////////////////////////////////////
-    template <typename Expr>
-    struct is_valid_expr<Expr
-      , typename enable_if<proto::matches<Expr, string_meta_grammar> >::type>
-      : mpl::true_
-    {
-    };
-
-    template <typename Expr>
-    struct expr_transform<Expr
-      , typename enable_if<proto::matches<Expr, string_meta_grammar> >::type>
-      : mpl::identity<string_meta_grammar>
-    {
-    };
-}}}
-
-#endif
Deleted: trunk/boost/spirit/home/qi/string/symbols.hpp
==============================================================================
--- trunk/boost/spirit/home/qi/string/symbols.hpp	2009-04-26 10:42:24 EDT (Sun, 26 Apr 2009)
+++ (empty file)
@@ -1,297 +0,0 @@
-/*=============================================================================
-    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_SYMBOL_MARCH_11_2007_1055AM)
-#define BOOST_SPIRIT_SYMBOL_MARCH_11_2007_1055AM
-
-#include <boost/spirit/home/qi/domain.hpp>
-#include <boost/spirit/home/qi/skip.hpp>
-#include <boost/spirit/home/qi/string/tst.hpp>
-#include <boost/spirit/home/support/modifier.hpp>
-#include <boost/spirit/home/qi/detail/assign_to.hpp>
-#include <boost/fusion/include/at.hpp>
-#include <boost/proto/core.hpp>
-#include <boost/shared_ptr.hpp>
-#include <boost/range.hpp>
-#include <boost/type_traits/add_reference.hpp>
-
-#if defined(BOOST_MSVC)
-# pragma warning(push)
-# pragma warning(disable: 4355) // 'this' : used in base member initializer list warning
-#endif
-
-namespace boost { namespace spirit { namespace qi
-{
-    template <typename Filter = tst_pass_through>
-    struct symbols_director
-    {
-        template <typename Component, typename Context, typename Iterator>
-        struct attribute
-        {
-            typedef typename
-                result_of::subject<Component>::type::ptr_type::element_type::value_type
-            type;
-        };
-
-        template <
-            typename Component
-          , typename Iterator, typename Context
-          , typename Skipper, typename Attribute>
-        static bool parse(
-            Component const& component
-          , Iterator& first, Iterator const& last
-          , Context& /*context*/, Skipper const& skipper
-          , Attribute& attr)
-        {
-            typedef typename
-                result_of::subject<Component>::type::ptr_type::element_type::value_type
-            value_type;
-
-            qi::skip(first, last, skipper);
-
-            if (value_type* val_ptr
-                = fusion::at_c<0>(component.elements)
-                    .lookup->find(first, last, Filter()))
-            {
-                detail::assign_to(*val_ptr, attr);
-                return true;
-            }
-            return false;
-        }
-
-        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";
-        }
-    };
-
-    template <typename Lookup>
-    struct symbols_lookup
-    {
-        typedef shared_ptr<Lookup> ptr_type;
-        ptr_type lookup;
-    };
-
-    template <typename Char, typename T, typename Lookup = tst<Char, T> >
-    struct symbols
-      : proto::extends<
-            typename proto::terminal<symbols_lookup<Lookup> >::type
-          , symbols<Char, T>
-        >
-    {
-        typedef Char char_type; // the character type
-        typedef T value_type; // the value associated with each entry
-        typedef shared_ptr<Lookup> ptr_type;
-
-        symbols()
-          : add(*this)
-          , remove(*this)
-        {
-            proto::child(*this).lookup = ptr_type(new Lookup());
-        }
-
-        template <typename Symbols>
-        symbols(Symbols const& syms)
-          : add(*this)
-          , remove(*this)
-        {
-            proto::child(*this).lookup = ptr_type(new Lookup());
-            typename range_const_iterator<Symbols>::type si = boost::begin(syms);
-            while (si != boost::end(syms))
-                add(*si++);
-        }
-
-        template <typename Symbols, typename Data>
-        symbols(Symbols const& syms, Data const& data)
-          : add(*this)
-          , remove(*this)
-        {
-            proto::child(*this).lookup = ptr_type(new Lookup());
-            typename range_const_iterator<Symbols>::type si = boost::begin(syms);
-            typename range_const_iterator<Data>::type di = boost::begin(data);
-            while (si != boost::end(syms))
-                add(*si++, *di++);
-        }
-
-        symbols&
-        operator=(symbols const& rhs)
-        {
-            proto::child(*this) = proto::child(rhs);
-            return *this;
-        }
-
-        void clear()
-        {
-            lookup()->clear();
-        }
-
-        struct adder;
-        struct remover;
-
-        adder const&
-        operator=(Char const* str)
-        {
-            lookup()->clear();
-            return add(str);
-        }
-
-        adder const&
-        operator+=(Char const* str)
-        {
-            return add(str);
-        }
-
-        remover const&
-        operator-=(Char const* str)
-        {
-            return remove(str);
-        }
-
-        ptr_type lookup() const
-        {
-            return proto::child(*this).lookup;
-        }
-
-        template <typename F>
-        void for_each(F f) const
-        {
-            lookup()->for_each(f);
-        }
-
-        struct adder
-        {
-            template <typename, typename = unused_type, typename = unused_type>
-            struct result { typedef adder const& type; };
-
-            adder(symbols& sym)
-              : sym(sym)
-            {
-            }
-
-            template <typename Iterator>
-            adder const&
-            operator()(Iterator const& first, Iterator const& last, T const& val = T()) const
-            {
-                sym.lookup()->add(first, last, val);
-                return *this;
-            }
-
-            adder const&
-            operator()(Char const* s, T const& val = T()) const
-            {
-                Char const* last = s;
-                while (*last)
-                    last++;
-                sym.lookup()->add(s, last, val);
-                return *this;
-            }
-
-            adder const&
-            operator,(Char const* s) const
-            {
-                Char const* last = s;
-                while (*last)
-                    last++;
-                sym.lookup()->add(s, last, T());
-                return *this;
-            }
-
-            symbols& sym;
-        };
-
-        struct remover
-        {
-            template <typename, typename = unused_type, typename = unused_type>
-            struct result { typedef adder const& type; };
-
-            remover(symbols& sym)
-              : sym(sym)
-            {
-            }
-
-            template <typename Iterator>
-            remover const&
-            operator()(Iterator const& first, Iterator const& last) const
-            {
-                sym.lookup()->remove(first, last);
-                return *this;
-            }
-
-            remover const&
-            operator()(Char const* s) const
-            {
-                Char const* last = s;
-                while (*last)
-                    last++;
-                sym.lookup()->remove(s, last);
-                return *this;
-            }
-
-            remover const&
-            operator,(Char const* s) const
-            {
-                Char const* last = s;
-                while (*last)
-                    last++;
-                sym.lookup()->remove(s, last);
-                return *this;
-            }
-
-            symbols& sym;
-        };
-
-        adder add;
-        remover remove;
-    };
-}}}
-
-
-namespace boost { namespace spirit { namespace traits
-{
-    namespace detail
-    {
-        template <typename CharSet>
-        struct no_case_filter
-        {
-            template <typename Char>
-            Char operator()(Char ch) const
-            {
-                return CharSet::tolower(ch);
-            }
-        };
-    }
-
-    ///////////////////////////////////////////////////////////////////////////
-    // generator for no-case symbols
-    ///////////////////////////////////////////////////////////////////////////
-    template <typename Domain, typename Elements, typename Modifier>
-    struct make_modified_component<Domain, qi::symbols_director<>, Elements, Modifier
-      , typename enable_if<
-            is_member_of_modifier<Modifier, spirit::char_class::no_case_base_tag>
-        >::type
-    >
-    {
-        typedef detail::no_case_filter<typename Modifier::char_set> filter;
-        typedef component<qi::domain, qi::symbols_director<filter>, Elements> type;
-
-        static type
-        call(Elements const& elements)
-        {
-            // we return the same lookup but this time we use a director
-            // with a filter that converts to lower-case.
-            return elements;
-        }
-    };
-}}}
-
-
-#if defined(BOOST_MSVC)
-# pragma warning(pop)
-#endif
-
-#endif
Deleted: trunk/boost/spirit/home/qi/string/tst.hpp
==============================================================================
--- trunk/boost/spirit/home/qi/string/tst.hpp	2009-04-26 10:42:24 EDT (Sun, 26 Apr 2009)
+++ (empty file)
@@ -1,133 +0,0 @@
-/*=============================================================================
-    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_TST_JUNE_03_2007_1031AM)
-#define BOOST_SPIRIT_TST_JUNE_03_2007_1031AM
-
-#include <boost/spirit/home/qi/string/detail/tst.hpp>
-
-namespace boost { namespace spirit { namespace qi
-{
-    struct tst_pass_through
-    {
-        template <typename Char>
-        Char operator()(Char ch) const
-        {
-            return ch;
-        }
-    };
-
-    template <typename Char, typename T>
-    struct tst
-    {
-        typedef Char char_type; // the character type
-        typedef T value_type; // the value associated with each entry
-        typedef detail::tst_node<Char, T> node;
-
-        tst()
-          : root(0)
-        {
-        }
-
-        ~tst()
-        {
-            clear();
-        }
-
-        tst(tst const& rhs)
-          : root(0)
-        {
-            copy(rhs);
-        }
-
-        tst& operator=(tst const& rhs)
-        {
-            return assign(rhs);
-        }
-
-        template <typename Iterator, typename Filter>
-        T* find(Iterator& first, Iterator last, Filter filter) const
-        {
-            return node::find(root, first, last, filter);
-        }
-
-        template <typename Iterator>
-        T* find(Iterator& first, Iterator last) const
-        {
-            return find(first, last, tst_pass_through());
-        }
-
-        template <typename Iterator>
-        bool add(
-            Iterator first
-          , Iterator last
-          , typename boost::call_traits<T>::param_type val)
-        {
-            return node::add(root, first, last, val, this);
-        }
-
-        template <typename Iterator>
-        void remove(Iterator first, Iterator last)
-        {
-            node::remove(root, first, last, this);
-        }
-
-        void clear()
-        {
-            node::destruct_node(root, this);
-            root = 0;
-        }
-
-        template <typename F>
-        void for_each(F f) const
-        {
-            node::for_each(root, std::basic_string<Char>(), f);
-        }
-
-    private:
-
-        friend struct detail::tst_node<Char, T>;
-
-        void copy(tst const& rhs)
-        {
-            root = node::clone_node(rhs.root, this);
-        }
-
-        tst& assign(tst const& rhs)
-        {
-            if (this != &rhs)
-            {
-                clear();
-                copy(rhs);
-            }
-            return *this;
-        }
-
-        node* root;
-
-        node* new_node(Char id)
-        {
-            return new node(id);
-        }
-
-        T* new_data(typename boost::call_traits<T>::param_type val)
-        {
-            return new T(val);
-        }
-
-        void delete_node(node* p)
-        {
-            delete p;
-        }
-
-        void delete_data(T* p)
-        {
-            delete p;
-        }
-    };
-}}}
-
-#endif
Deleted: trunk/boost/spirit/home/qi/string/tst_map.hpp
==============================================================================
--- trunk/boost/spirit/home/qi/string/tst_map.hpp	2009-04-26 10:42:24 EDT (Sun, 26 Apr 2009)
+++ (empty file)
@@ -1,211 +0,0 @@
-/*=============================================================================
-    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_TST_MAP_JUNE_03_2007_1143AM)
-#define BOOST_SPIRIT_TST_MAP_JUNE_03_2007_1143AM
-
-#include <boost/spirit/home/qi/string/detail/tst.hpp>
-#include <boost/unordered_map.hpp>
-#include <boost/pool/object_pool.hpp>
-
-namespace boost { namespace spirit { namespace qi
-{
-    struct tst_pass_through; // declared in tst.hpp
-
-    template <typename Char, typename T>
-    struct tst_map
-    {
-        typedef Char char_type; // the character type
-        typedef T value_type; // the value associated with each entry
-        typedef detail::tst_node<Char, T> node;
-
-        tst_map()
-        {
-        }
-
-        ~tst_map()
-        {
-            // Nothing to do here.
-            // The pools do the right thing for us
-        }
-
-        tst_map(tst_map const& rhs)
-        {
-            copy(rhs);
-        }
-
-        tst_map& operator=(tst_map const& rhs)
-        {
-            return assign(rhs);
-        }
-
-        template <typename Iterator, typename Filter>
-        T* find(Iterator& first, Iterator last, Filter filter) const
-        {
-            if (first != last)
-            {
-                Iterator save = first;
-                typename map_type::const_iterator
-                    i = map.find(filter(*first++));
-                if (i == map.end())
-                {
-                    first = save;
-                    return 0;
-                }
-                if (T* p = node::find(i->second.root, first, last, filter))
-                {
-                    return p;
-                }
-                return i->second.data;
-            }
-            return 0;
-        }
-
-        template <typename Iterator>
-        T* find(Iterator& first, Iterator last) const
-        {
-            return find(first, last, tst_pass_through());
-        }
-
-        template <typename Iterator>
-        bool add(
-            Iterator first
-          , Iterator last
-          , typename boost::call_traits<T>::param_type val)
-        {
-            if (first != last)
-            {
-                map_data x = {0, 0};
-                std::pair<typename map_type::iterator, bool>
-                    r = map.insert(std::pair<Char, map_data>(*first++, x));
-
-                if (first != last)
-                {
-                    return node::add(r.first->second.root, first, last, val, this);
-                }
-                else
-                {
-                    if (r.first->second.data)
-                        return false;
-                    r.first->second.data = this->new_data(val);
-                }
-                return true;
-            }
-            return false;
-        }
-
-        template <typename Iterator>
-        void remove(Iterator first, Iterator last)
-        {
-            if (first != last)
-            {
-                typename map_type::iterator i = map.find(*first++);
-                if (i != map.end())
-                {
-                    if (first != last)
-                    {
-                        node::remove(i->second.root, first, last, this);
-                    }
-                    else if (i->second.data)
-                    {
-                        this->delete_data(i->second.data);
-                        i->second.data = 0;
-                    }
-                    if (i->second.data == 0 && i->second.root == 0)
-                    {
-                        map.erase(i);
-                    }
-                }
-            }
-        }
-
-        void clear()
-        {
-            BOOST_FOREACH(typename map_type::value_type& x, map)
-            {
-                node::destruct_node(x.second.root, this);
-                if (x.second.data)
-                    this->delete_data(x.second.data);
-            }
-            map.clear();
-        }
-
-        template <typename F>
-        void for_each(F f) const
-        {
-            BOOST_FOREACH(typename map_type::value_type const& x, map)
-            {
-                std::basic_string<Char> s(1, x.first);
-                node::for_each(x.second.root, s, f);
-                if (x.second.data)
-                    f(s, *x.second.data);
-            }
-        }
-
-    private:
-
-        friend struct detail::tst_node<Char, T>;
-
-        struct map_data
-        {
-            node* root;
-            T* data;
-        };
-
-        typedef unordered_map<Char, map_data> map_type;
-
-        void copy(tst_map const& rhs)
-        {
-            BOOST_FOREACH(typename map_type::value_type const& x, rhs.map)
-            {
-                map_data xx = {node::clone_node(x.second.root, this), 0};
-                if (x.second.data)
-                    xx.data = data_pool.construct(*x.second.data);
-                map[x.first] = xx;
-            }
-        }
-
-        tst_map& assign(tst_map const& rhs)
-        {
-            if (this != &rhs)
-            {
-                BOOST_FOREACH(typename map_type::value_type& x, map)
-                {
-                    node::destruct_node(x.second.root, this);
-                }
-                map.clear();
-                copy(rhs);
-            }
-            return *this;
-        }
-
-        node* new_node(Char id)
-        {
-            return node_pool.construct(id);
-        }
-
-        T* new_data(typename boost::call_traits<T>::param_type val)
-        {
-            return data_pool.construct(val);
-        }
-
-        void delete_node(node* p)
-        {
-            node_pool.destroy(p);
-        }
-
-        void delete_data(T* p)
-        {
-            data_pool.destroy(p);
-        }
-
-        map_type map;
-        object_pool<node> node_pool;
-        object_pool<T> data_pool;
-    };
-}}}
-
-#endif
Modified: trunk/boost/spirit/home/qi/what.hpp
==============================================================================
--- trunk/boost/spirit/home/qi/what.hpp	(original)
+++ trunk/boost/spirit/home/qi/what.hpp	2009-04-26 10:42:24 EDT (Sun, 26 Apr 2009)
@@ -1,5 +1,5 @@
 /*=============================================================================
-    Copyright (c) 2001-2007 Joel de Guzman
+    Copyright (c) 2001-2009 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)
@@ -7,26 +7,21 @@
 #if !defined(BOOST_SPIRIT_WHAT_APRIL_21_2007_0732AM)
 #define BOOST_SPIRIT_WHAT_APRIL_21_2007_0732AM
 
-#include <boost/spirit/home/qi/meta_grammar.hpp>
 #include <boost/mpl/assert.hpp>
-#include <string>
+#include <boost/spirit/home/support/info.hpp>
+#include <boost/spirit/home/qi/meta_compiler.hpp>
 
 namespace boost { namespace spirit { namespace qi
 {
     template <typename Expr>
-    inline std::string what(Expr const& xpr)
+    inline info what(Expr const& expr)
     {
-        typedef spirit::traits::is_component<qi::domain, Expr> is_component;
-
-        // report invalid expression error as early as possible
-        BOOST_MPL_ASSERT_MSG(
-            is_component::value,
-            xpr_is_not_convertible_to_a_parser, ());
-
-        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, unused);
+        // Report invalid expression error as early as possible.
+        // If you got an error_expr_is_not_convertible_to_a_parser
+        // error message here, then the expression (expr) is not a
+        // valid spirit qi expression.
+        BOOST_SPIRIT_ASSERT_MATCH(qi::domain, Expr)
+        return compile<qi::domain>(expr).what(unused);
     }
 }}}
 
Modified: trunk/boost/spirit/home/support.hpp
==============================================================================
--- trunk/boost/spirit/home/support.hpp	(original)
+++ trunk/boost/spirit/home/support.hpp	2009-04-26 10:42:24 EDT (Sun, 26 Apr 2009)
@@ -1,28 +1,34 @@
 /*=============================================================================
-    Copyright (c) 2001-2007 Joel de Guzman
+    Copyright (c) 2001-2009 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_SUPPORT_SEPTEMBER_26_2008_0340AM)
 #define BOOST_SPIRIT_SUPPORT_SEPTEMBER_26_2008_0340AM
 
+#if defined(_MSC_VER)
+#pragma once
+#endif
+
+#include<boost/spirit/home/support/action_dispatch.hpp>
 #include<boost/spirit/home/support/argument.hpp>
-#include<boost/spirit/home/support/as_variant.hpp>
-#include<boost/spirit/home/support/ascii.hpp>
-#include<boost/spirit/home/support/attribute_of.hpp>
-#include<boost/spirit/home/support/attribute_transform.hpp>
+#include<boost/spirit/home/support/attributes.hpp>
 #include<boost/spirit/home/support/char_class.hpp>
-#include<boost/spirit/home/support/component.hpp>
-#include<boost/spirit/home/support/iso8859_1.hpp>
-#include<boost/spirit/home/support/meta_grammar.hpp>
-#include<boost/spirit/home/support/modifier.hpp>
-#include<boost/spirit/home/support/multi_pass.hpp>
-#include<boost/spirit/home/support/placeholders.hpp>
+#include<boost/spirit/home/support/common_terminals.hpp>
+#include<boost/spirit/home/support/container.hpp>
+#include<boost/spirit/home/support/context.hpp>
+#include<boost/spirit/home/support/info.hpp>
+#include<boost/spirit/home/support/lazy.hpp>
+#include<boost/spirit/home/support/make_component.hpp>
+#include<boost/spirit/home/support/meta_compiler.hpp>
+#include<boost/spirit/home/support/modify.hpp>
 #include<boost/spirit/home/support/safe_bool.hpp>
-#include<boost/spirit/home/support/standard.hpp>
-#include<boost/spirit/home/support/standard_wide.hpp>
+#include<boost/spirit/home/support/sequence_base_id.hpp>
+#include<boost/spirit/home/support/string_traits.hpp>
+#include<boost/spirit/home/support/terminal.hpp>
 #include<boost/spirit/home/support/unused.hpp>
+#include<boost/spirit/home/support/utf8.hpp>
+
 #endif
 
Added: trunk/boost/spirit/home/support/action_dispatch.hpp
==============================================================================
--- (empty file)
+++ trunk/boost/spirit/home/support/action_dispatch.hpp	2009-04-26 10:42:24 EDT (Sun, 26 Apr 2009)
@@ -0,0 +1,80 @@
+/*=============================================================================
+    Copyright (c) 2001-2009 Joel de Guzman
+    Copyright (c) 2001-2009 Hartmut Kaiser
+    http://spirit.sourceforge.net/
+
+    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_ACTION_DISPATCH_APRIL_18_2008_0720AM)
+#define BOOST_SPIRIT_ACTION_DISPATCH_APRIL_18_2008_0720AM
+
+#include <boost/spirit/home/phoenix/core/actor.hpp>
+#include <boost/spirit/home/support/attributes.hpp>
+
+namespace boost { namespace spirit { namespace traits
+{
+    template <typename Component>
+    struct action_dispatch
+    {
+        // general handler for everything not explicitly specialized below
+        template <typename F, typename Attribute, typename Context>
+        bool operator()(F const& f, Attribute& attr, Context& context)
+        {
+            bool pass = true;
+            f(attr, context, pass);
+            return pass;
+        }
+
+        // handler for phoenix actors
+
+        // If the component this action has to be invoked for is a tuple, we
+        // wrap any non-fusion tuple into a fusion tuple (done by pass_attribute)
+        // and pass through any fusion tuple.
+        template <typename Eval, typename Attribute, typename Context>
+        bool operator()(phoenix::actor<Eval> const& f
+          , Attribute& attr, Context& context)
+        {
+            bool pass = true;
+            typename pass_attribute<Component, Attribute>::type attr_wrap(attr);
+            f(attr_wrap, context, pass);
+            return pass;
+        }
+
+        // specializations for plain function pointers taking different number of
+        // arguments
+        template <typename RT, typename A0, typename A1, typename A2
+          , typename Attribute, typename Context>
+        bool operator()(RT(*f)(A0, A1, A2), Attribute& attr, Context& context)
+        {
+            bool pass = true;
+            f(attr, context, pass);
+            return pass;
+        }
+
+        template <typename RT, typename A0, typename A1
+          , typename Attribute, typename Context>
+        bool operator()(RT(*f)(A0, A1), Attribute& attr, Context& context)
+        {
+            f(attr, context);
+            return true;
+        }
+
+        template <typename RT, typename A0, typename Attribute, typename Context>
+        bool operator()(RT(*f)(A0), Attribute& attr, Context&)
+        {
+            f(attr);
+            return true;
+        }
+
+        template <typename RT, typename Attribute, typename Context>
+        bool operator()(RT(*f)(), Attribute&, Context&)
+        {
+            f();
+            return true;
+        }
+    };
+
+}}}
+
+#endif
Modified: trunk/boost/spirit/home/support/algorithm/any.hpp
==============================================================================
--- trunk/boost/spirit/home/support/algorithm/any.hpp	(original)
+++ trunk/boost/spirit/home/support/algorithm/any.hpp	2009-04-26 10:42:24 EDT (Sun, 26 Apr 2009)
@@ -1,11 +1,15 @@
 /*=============================================================================
-    Copyright (c) 2001-2007 Joel de Guzman
+    Copyright (c) 2001-2009 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_ANY_APR_22_2006_1147AM)
-#define BOOST_SPIRIT_ANY_APR_22_2006_1147AM
+#if !defined(BOOST_SPIRIT_ANY_APRIL_22_2006_1147AM)
+#define BOOST_SPIRIT_ANY_APRIL_22_2006_1147AM
+
+#if defined(_MSC_VER)
+#pragma once
+#endif
 
 #include <boost/mpl/bool.hpp>
 #include <boost/fusion/include/equal_to.hpp>
Modified: trunk/boost/spirit/home/support/algorithm/any_if.hpp
==============================================================================
--- trunk/boost/spirit/home/support/algorithm/any_if.hpp	(original)
+++ trunk/boost/spirit/home/support/algorithm/any_if.hpp	2009-04-26 10:42:24 EDT (Sun, 26 Apr 2009)
@@ -1,10 +1,16 @@
-//  Copyright (c) 2001-2009 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)
+/*=============================================================================
+    Copyright (c) 2001-2009 Hartmut Kaiser
+    Copyright (c) 2001-2009 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_ANY_IF_MARCH_30_2007_1220PM)
+#define BOOST_SPIRIT_ANY_IF_MARCH_30_2007_1220PM
 
-#if !defined(BOOST_SPIRIT_ANY_IF_MAR_30_2007_1220PM)
-#define BOOST_SPIRIT_ANY_IF_MAR_30_2007_1220PM
+#if defined(_MSC_VER)
+#pragma once
+#endif
 
 #include <boost/fusion/include/equal_to.hpp>
 #include <boost/fusion/include/next.hpp>
@@ -14,25 +20,21 @@
 #include <boost/fusion/include/end.hpp>
 #include <boost/fusion/include/is_sequence.hpp>
 #include <boost/fusion/include/any.hpp>
-#include <boost/fusion/include/make_cons.hpp>
 #include <boost/spirit/home/support/unused.hpp>
 
 #include <boost/mpl/bool.hpp>
-#include <boost/mpl/print.hpp>
 #include <boost/mpl/apply.hpp>
 #include <boost/mpl/if.hpp>
 #include <boost/mpl/identity.hpp>
-#include <boost/utility/enable_if.hpp>
 
 namespace boost { namespace spirit
 {
     ///////////////////////////////////////////////////////////////////////////
-    //  This is a special version for a binary fusion::any. The predicate is
-    //  used to decide, whether to advance the second iterator or not.
+    //  This is a special version for a binary fusion::any. The predicate
+    //  is used to decide whether to advance the second iterator or not.
     //  This is needed for sequences containing components with unused
-    //  attributes.
-    //  The second iterator is advanced only if the attribute of the 
-    //  corresponding component iterator is not unused.
+    //  attributes. The second iterator is advanced only if the attribute
+    //  of the corresponding component iterator is not unused.
     ///////////////////////////////////////////////////////////////////////////
     namespace detail
     {
@@ -177,7 +179,7 @@
     }
 
     template <typename Pred, typename Sequence1, typename Sequence2, typename F>
-    inline typename enable_if<fusion::traits::is_sequence<Sequence2>, bool>::type
+    inline bool
     any_if(Sequence1 const& seq1, Sequence2& seq2, F f, Pred)
     {
         return detail::any_if<Pred>(
@@ -190,24 +192,6 @@
                   , typename fusion::result_of::end<Sequence1>::type>());
     }
 
-    template <typename Pred, typename Sequence1, typename Attribute, typename F>
-    inline typename disable_if<fusion::traits::is_sequence<Attribute>, bool>::type
-    any_if(Sequence1 const& seq1, Attribute& attr, F f, Pred /*p*/)
-    {
-        typename
-            fusion::result_of::make_cons<Attribute&>::type
-        seq2(attr); // wrap attribute in a single element tuple
-
-        return detail::any_if<Pred>(
-                fusion::begin(seq1)
-              , fusion::begin(seq2)
-              , fusion::end(seq1)
-              , f
-              , fusion::result_of::equal_to<
-                    typename fusion::result_of::begin<Sequence1>::type
-                  , typename fusion::result_of::end<Sequence1>::type>());
-    }
-
     template <typename Pred, typename Sequence, typename F>
     inline bool
     any_if(Sequence const& seq, unused_type const, F f, Pred)
Modified: trunk/boost/spirit/home/support/algorithm/any_ns.hpp
==============================================================================
--- trunk/boost/spirit/home/support/algorithm/any_ns.hpp	(original)
+++ trunk/boost/spirit/home/support/algorithm/any_ns.hpp	2009-04-26 10:42:24 EDT (Sun, 26 Apr 2009)
@@ -1,5 +1,5 @@
 /*=============================================================================
-    Copyright (c) 2001-2007 Joel de Guzman
+    Copyright (c) 2001-2009 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)
@@ -7,6 +7,10 @@
 #if !defined(BOOST_SPIRIT_ANY_NS_MARCH_13_2007_0827AM)
 #define BOOST_SPIRIT_ANY_NS_MARCH_13_2007_0827AM
 
+#if defined(_MSC_VER)
+#pragma once
+#endif
+
 #include <boost/mpl/bool.hpp>
 #include <boost/fusion/include/equal_to.hpp>
 #include <boost/fusion/include/next.hpp>
@@ -18,7 +22,7 @@
 
 namespace boost { namespace spirit
 {
-    // A non-short circuiting (ns) version of the all algorithm (uses
+    // A non-short circuiting (ns) version of the any algorithm (uses
     // | instead of ||.
 
     namespace detail
Modified: trunk/boost/spirit/home/support/argument.hpp
==============================================================================
--- trunk/boost/spirit/home/support/argument.hpp	(original)
+++ trunk/boost/spirit/home/support/argument.hpp	2009-04-26 10:42:24 EDT (Sun, 26 Apr 2009)
@@ -1,11 +1,11 @@
 /*=============================================================================
-    Copyright (c) 2001-2007 Joel de Guzman
+    Copyright (c) 2001-2009 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_ARGUMENT_FEB_17_2007_0339PM)
-#define BOOST_SPIRIT_ARGUMENT_FEB_17_2007_0339PM
+#if !defined(BOOST_SPIRIT_ARGUMENT_FEBRUARY_17_2007_0339PM)
+#define BOOST_SPIRIT_ARGUMENT_FEBRUARY_17_2007_0339PM
 
 #include <boost/preprocessor/repetition/repeat_from_to.hpp>
 #include <boost/preprocessor/arithmetic/inc.hpp>
@@ -16,15 +16,15 @@
 #include <boost/mpl/size.hpp>
 #include <boost/mpl/at.hpp>
 
-#if !defined(SPIRIT_ARG_LIMIT)
-# define SPIRIT_ARG_LIMIT PHOENIX_LIMIT
+#if !defined(SPIRIT_ARGUMENTS_LIMIT)
+# define SPIRIT_ARGUMENTS_LIMIT PHOENIX_LIMIT
 #endif
 
 #define SPIRIT_DECLARE_ARG(z, n, data)                                          \
     phoenix::actor<argument<n> > const                                          \
-        BOOST_PP_CAT(_, BOOST_PP_INC(n)) = argument<n>();                       \
-    phoenix::actor<attribute<n> > const                                         \
-        BOOST_PP_CAT(_r, n) = attribute<n>();
+        BOOST_PP_CAT(_, BOOST_PP_INC(n)) = argument<n>();
+
+#define SPIRIT_USING_ARGUMENT(z, n, data) using spirit::BOOST_PP_CAT(_, n);
 
 namespace boost { namespace spirit
 {
@@ -111,127 +111,29 @@
         }
     };
 
-    template <int N>
-    struct attribute
-    {
-        typedef mpl::true_ no_nullary;
-
-        template <typename Env>
-        struct result
-        {
-            typedef typename
-                mpl::at_c<typename Env::args_type, 1>::type
-            arg_type;
-
-            typedef typename
-                result_of::get_arg<
-                    typename result_of::get_arg<arg_type, 0>::type
-                  , N
-                >::type
-            type;
-        };
-
-        template <typename Env>
-        typename result<Env>::type
-        eval(Env const& env) const
-        {
-            return get_arg<N>(get_arg<0>(fusion::at_c<1>(env.args())));
-        }
-    };
-
-    template <int N>
-    struct local_var
-    {
-        typedef mpl::true_ no_nullary;
-
-        template <typename Env>
-        struct result
-        {
-            typedef typename
-                mpl::at_c<typename Env::args_type, 1>::type
-            arg_type;
-
-            typedef typename
-                result_of::get_arg<
-                    typename result_of::get_arg<arg_type, 1>::type
-                  , N
-                >::type
-            type;
-        };
-
-        template <typename Env>
-        typename result<Env>::type
-        eval(Env const& env) const
-        {
-            return get_arg<N>(get_arg<1>(fusion::at_c<1>(env.args())));
-        }
-    };
-
-    struct lexer_state
-    {
-        typedef mpl::true_ no_nullary;
-
-        template <typename Env>
-        struct result
-        {
-            typedef typename 
-                mpl::at_c<typename Env::args_type, 3>::type::state_type 
-            type;
-        };
-
-        template <typename Env>
-        typename result<Env>::type
-        eval(Env const& env) const
-        {
-            return fusion::at_c<3>(env.args()).state;
-        }
-    };
-    
-    namespace arg_names
-    {
     // _0 refers to the whole attribute as generated by the lhs parser
-        phoenix::actor<attribute_context> const _0 = attribute_context();
+    phoenix::actor<attribute_context> const _0 = attribute_context();
 
-    // _1, _2, ... refer to the attributes of the single components the lhs 
+    // _1, _2, ... refer to the attributes of the single components the lhs
     // parser is composed of
-        phoenix::actor<argument<0> > const _1 = argument<0>();
-        phoenix::actor<argument<1> > const _2 = argument<1>();
-        phoenix::actor<argument<2> > const _3 = argument<2>();
+    phoenix::actor<argument<0> > const _1 = argument<0>();
+    phoenix::actor<argument<1> > const _2 = argument<1>();
+    phoenix::actor<argument<2> > const _3 = argument<2>();
 
     // 'pass' may be used to make a match fail in retrospective
-        phoenix::actor<phoenix::argument<2> > const pass = phoenix::argument<2>();
-
-    // 'id' may be used in a lexer semantic action to refer to the token id 
-    // of a matched token 
-        phoenix::actor<phoenix::argument<1> > const id = phoenix::argument<1>();
-        
-    // 'state' may be used in a lexer semantic action to refer to the 
-    // current lexer state 
-        phoenix::actor<lexer_state> const state = lexer_state();
-    
-    // _val refers to the 'return' value of a rule
-    // _r0, _r1, ... refer to the rule arguments
-        phoenix::actor<attribute<0> > const _val = attribute<0>();
-        phoenix::actor<attribute<0> > const _r0 = attribute<0>();
-        phoenix::actor<attribute<1> > const _r1 = attribute<1>();
-        phoenix::actor<attribute<2> > const _r2 = attribute<2>();
+    phoenix::actor<phoenix::argument<2> > const pass = phoenix::argument<2>();
 
     //  Bring in the rest of the arguments and attributes (_4 .. _N+1), using PP
-        BOOST_PP_REPEAT_FROM_TO(
-            3, SPIRIT_ARG_LIMIT, SPIRIT_DECLARE_ARG, _)
+    BOOST_PP_REPEAT_FROM_TO(
+        3, SPIRIT_ARGUMENTS_LIMIT, SPIRIT_DECLARE_ARG, _)
 
-    // _a, _b, ... refer to the local variables of a rule
-        phoenix::actor<local_var<0> > const _a = local_var<0>();
-        phoenix::actor<local_var<1> > const _b = local_var<1>();
-        phoenix::actor<local_var<2> > const _c = local_var<2>();
-        phoenix::actor<local_var<3> > const _d = local_var<3>();
-        phoenix::actor<local_var<4> > const _e = local_var<4>();
-        phoenix::actor<local_var<5> > const _f = local_var<5>();
-        phoenix::actor<local_var<6> > const _g = local_var<6>();
-        phoenix::actor<local_var<7> > const _h = local_var<7>();
-        phoenix::actor<local_var<8> > const _i = local_var<8>();
-        phoenix::actor<local_var<9> > const _j = local_var<9>();
+    // You can bring these in with the using directive
+    // without worrying about bringing in too much.
+    namespace labels
+    {
+        BOOST_PP_REPEAT(SPIRIT_ARGUMENTS_LIMIT, SPIRIT_USING_ARGUMENT, _)
     }
+
 }}
 
 #undef SPIRIT_DECLARE_ARG
Deleted: trunk/boost/spirit/home/support/as_variant.hpp
==============================================================================
--- trunk/boost/spirit/home/support/as_variant.hpp	2009-04-26 10:42:24 EDT (Sun, 26 Apr 2009)
+++ (empty file)
@@ -1,128 +0,0 @@
-/*=============================================================================
-    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)
-==============================================================================*/
-#ifndef BOOST_PP_IS_ITERATING
-#if !defined(BOOST_SPIRIT_AS_VARIANT_NOV_16_2007_0420PM)
-#define BOOST_SPIRIT_AS_VARIANT_NOV_16_2007_0420PM
-
-#include <boost/preprocessor/iterate.hpp>
-#include <boost/preprocessor/repetition/enum_params.hpp>
-#include <boost/preprocessor/repetition/enum_binary_params.hpp>
-#include <boost/preprocessor/repetition/enum_params_with_a_default.hpp>
-#include <boost/preprocessor/repetition/repeat_from_to.hpp>
-#include <boost/variant/variant_fwd.hpp>
-#include <boost/mpl/fold.hpp>
-#include <boost/mpl/vector.hpp>
-#include <boost/mpl/push_back.hpp>
-#include <boost/mpl/contains.hpp>
-#include <boost/type_traits/is_same.hpp>
-
-namespace boost { namespace spirit { namespace detail
-{
-    template <int size>
-    struct as_variant;
-
-    template <>
-    struct as_variant<0>
-    {
-        template <typename Iterator>
-        struct apply
-        {
-            typedef variant<> type;
-        };
-    };
-
-#define BOOST_FUSION_NEXT_ITERATOR(z, n, data)                                  \
-    typedef typename fusion::result_of::next<BOOST_PP_CAT(I, n)>::type          \
-        BOOST_PP_CAT(I, BOOST_PP_INC(n));
-
-#define BOOST_FUSION_NEXT_CALL_ITERATOR(z, n, data)                             \
-    typename gen::BOOST_PP_CAT(I, BOOST_PP_INC(n))                              \
-        BOOST_PP_CAT(i, BOOST_PP_INC(n)) = fusion::next(BOOST_PP_CAT(i, n));
-
-#define BOOST_FUSION_VALUE_OF_ITERATOR(z, n, data)                              \
-    typedef typename fusion::result_of::value_of<BOOST_PP_CAT(I, n)>::type      \
-        BOOST_PP_CAT(T, n);
-
-#define BOOST_PP_FILENAME_1 <boost/spirit/home/support/as_variant.hpp>
-#define BOOST_PP_ITERATION_LIMITS (1, BOOST_VARIANT_LIMIT_TYPES)
-#include BOOST_PP_ITERATE()
-
-#undef BOOST_FUSION_NEXT_ITERATOR
-#undef BOOST_FUSION_NEXT_CALL_ITERATOR
-#undef BOOST_FUSION_VALUE_OF_ITERATOR
-
-    template <typename Sequence>
-    struct generate_variant
-    {
-        // build a variant generator being able to generate a variant holding 
-        // all of the types as given in the typelist 
-        typedef typename
-            detail::as_variant<fusion::result_of::size<Sequence>::value>
-        gen;
-        
-        // use this generator to create the actual variant
-        typedef typename gen::template apply<
-                typename fusion::result_of::begin<Sequence>::type
-            >::type 
-        type;
-    };
-    
-}}}
-
-namespace boost { namespace spirit
-{
-    template <typename Sequence>
-    struct as_variant
-    {
-        // make sure each of the types occurs only once in the type list
-        typedef typename 
-            mpl::fold<
-                Sequence, mpl::vector<>,
-                mpl::if_<
-                    mpl::contains<mpl::_1, mpl::_2>, 
-                    mpl::_1, mpl::push_back<mpl::_1, mpl::_2> 
-                > 
-            >::type 
-        new_sequence;
-
-        // if there is only one type in the list of types we strip off the 
-        // variant all together
-        typedef typename 
-            mpl::eval_if<
-                mpl::equal_to<mpl::size<new_sequence>, mpl::int_<1> >,
-                mpl::deref<mpl::front<Sequence> >,
-                detail::generate_variant<new_sequence>
-            >::type 
-        type;
-    };
-}}
-
-#endif
-#else // defined(BOOST_PP_IS_ITERATING)
-///////////////////////////////////////////////////////////////////////////////
-//
-//  Preprocessor vertical repetition code
-//
-///////////////////////////////////////////////////////////////////////////////
-
-#define N BOOST_PP_ITERATION()
-
-    template <>
-    struct as_variant<N>
-    {
-        template <typename I0>
-        struct apply
-        {
-            BOOST_PP_REPEAT(N, BOOST_FUSION_NEXT_ITERATOR, _)
-            BOOST_PP_REPEAT(N, BOOST_FUSION_VALUE_OF_ITERATOR, _)
-            typedef variant<BOOST_PP_ENUM_PARAMS(N, T)> type;
-        };
-    };
-
-#undef N
-#endif // defined(BOOST_PP_IS_ITERATING)
-
Deleted: trunk/boost/spirit/home/support/ascii.hpp
==============================================================================
--- trunk/boost/spirit/home/support/ascii.hpp	2009-04-26 10:42:24 EDT (Sun, 26 Apr 2009)
+++ (empty file)
@@ -1,70 +0,0 @@
-/*=============================================================================
-    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(SPIRIT_ASCII_JAN_31_2006_0529PM)
-#define SPIRIT_ASCII_JAN_31_2006_0529PM
-
-#include <boost/spirit/home/support/char_class.hpp>
-#include <boost/proto/core.hpp>
-
-namespace boost { namespace spirit { namespace ascii
-{
-    typedef spirit::char_class::ascii char_set;
-    namespace tag = spirit::char_class::tag;
-
-    template <typename Class>
-    struct make_tag 
-      : proto::terminal<spirit::char_class::key<char_set, Class> > {};
-
-    typedef make_tag<tag::alnum>::type alnum_type;
-    typedef make_tag<tag::alpha>::type alpha_type;
-    typedef make_tag<tag::blank>::type blank_type;
-    typedef make_tag<tag::cntrl>::type cntrl_type;
-    typedef make_tag<tag::digit>::type digit_type;
-    typedef make_tag<tag::graph>::type graph_type;
-    typedef make_tag<tag::print>::type print_type;
-    typedef make_tag<tag::punct>::type punct_type;
-    typedef make_tag<tag::space>::type space_type;
-    typedef make_tag<tag::xdigit>::type xdigit_type;
-
-    alnum_type const alnum = {{}};
-    alpha_type const alpha = {{}};
-    blank_type const blank = {{}};
-    cntrl_type const cntrl = {{}};
-    digit_type const digit = {{}};
-    graph_type const graph = {{}};
-    print_type const print = {{}};
-    punct_type const punct = {{}};
-    space_type const space = {{}};
-    xdigit_type const xdigit = {{}};
-
-    typedef proto::terminal<
-        spirit::char_class::no_case_tag<char_set> >::type 
-    no_case_type;
-
-    no_case_type const no_case = no_case_type();
-
-    typedef proto::terminal<
-        spirit::char_class::lower_case_tag<char_set> >::type 
-    lower_type;
-    typedef proto::terminal<
-        spirit::char_class::upper_case_tag<char_set> >::type 
-    upper_type;
-
-    lower_type const lower = lower_type();
-    upper_type const upper = upper_type();
-
-#if defined(__GNUC__)
-    inline void silence_unused_warnings__ascii()
-    {
-        (void) alnum; (void) alpha; (void) blank; (void) cntrl; (void) digit; 
-        (void) graph; (void) print; (void) punct; (void) space; (void) xdigit;
-    }
-#endif
-    
-}}}
-
-#endif
Deleted: trunk/boost/spirit/home/support/attribute_of.hpp
==============================================================================
--- trunk/boost/spirit/home/support/attribute_of.hpp	2009-04-26 10:42:24 EDT (Sun, 26 Apr 2009)
+++ (empty file)
@@ -1,49 +0,0 @@
-/*=============================================================================
-    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_ATTRIBUTE_OF_JAN_29_2007_0954AM)
-#define BOOST_SPIRIT_ATTRIBUTE_OF_JAN_29_2007_0954AM
-
-#include <boost/spirit/home/support/component.hpp>
-#include <boost/spirit/home/support/unused.hpp>
-
-namespace boost { namespace spirit { namespace traits
-{
-    template <
-        typename Domain, typename T
-      , typename Context, typename Iterator = unused_type>
-    struct attribute_of :
-        attribute_of<
-            Domain
-          , typename result_of::as_component<Domain, T>::type
-          , Context
-          , Iterator
-        >
-    {
-    };
-
-    template <
-        typename Domain, typename Director, typename Elements
-      , typename Context, typename Iterator>
-    struct attribute_of<
-            Domain
-          , component<Domain, Director, Elements>
-          , Context
-          , Iterator
-        >
-    {
-        typedef
-            component<Domain, Director, Elements>
-        component_type;
-
-        typedef typename Director::template
-            attribute<component_type, Context, Iterator>::type
-        type;
-    };
-
-}}}
-
-#endif
Deleted: trunk/boost/spirit/home/support/attribute_transform.hpp
==============================================================================
--- trunk/boost/spirit/home/support/attribute_transform.hpp	2009-04-26 10:42:24 EDT (Sun, 26 Apr 2009)
+++ (empty file)
@@ -1,195 +0,0 @@
-/*=============================================================================
-    Copyright (c) 2001-2007 Joel de Guzman
-    http://spirit.sourceforge.net/
-
-    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_ATTRIBUTE_TRANSFORM_DEC_17_2007_0718AM)
-#define BOOST_SPIRIT_ATTRIBUTE_TRANSFORM_DEC_17_2007_0718AM
-
-#include <boost/spirit/home/support/unused.hpp>
-#include <boost/spirit/home/support/component.hpp>
-#include <boost/spirit/home/support/attribute_of.hpp>
-#include <boost/spirit/home/support/detail/values.hpp>
-#include <boost/fusion/include/vector.hpp>
-#include <boost/fusion/include/is_sequence.hpp>
-#include <boost/variant/variant_fwd.hpp>
-#include <boost/fusion/include/transform.hpp>
-#include <boost/fusion/include/filter_if.hpp>
-#include <boost/mpl/if.hpp>
-#include <boost/type_traits/is_same.hpp>
-
-namespace boost { namespace spirit
-{
-    // Generalized attribute transformation utilities for Qi parsers
-
-    namespace traits
-    {
-        using boost::spirit::detail::not_is_variant;
-
-        // Here, we provide policies for stripping single element fusion
-        // sequences. Add more specializations as needed.
-        template <typename T, typename IsSequence, typename Enable = void>
-        struct strip_single_element_sequence
-        {
-            typedef T type;
-        };
-
-        template <typename T>
-        struct strip_single_element_sequence<
-            fusion::vector<T>, mpl::false_,
-            typename boost::enable_if<not_is_variant<T> >::type
-        >
-        {
-            //  Strips single element fusion vectors into its 'naked'
-            //  form: vector<T> --> T
-            typedef T type;
-        };
-
-        template <typename T>
-        struct strip_single_element_sequence<
-            fusion::vector<T>, mpl::true_,
-            typename boost::enable_if<not_is_variant<T> >::type
-        >
-        {
-            //  Strips single element fusion vectors into its 'naked'
-            //  form: vector<T> --> T, but does so only if T is not a fusion 
-            //  sequence itself
-            typedef typename 
-                mpl::if_<
-                    fusion::traits::is_sequence<T>,
-                    fusion::vector<T>,
-                    T
-                >::type 
-            type;
-        };
-
-        template <BOOST_VARIANT_ENUM_PARAMS(typename T), typename IsSequence>
-        struct strip_single_element_sequence<
-                fusion::vector<boost::variant<BOOST_VARIANT_ENUM_PARAMS(T)> > 
-              , IsSequence
-            >
-        {
-            //  Exception: Single element variants are not stripped!
-            typedef fusion::vector<boost::variant<BOOST_VARIANT_ENUM_PARAMS(T)> > type;
-        };
-    }
-
-    // Use this when building heterogeneous fusion sequences
-    // Note:
-    //
-    //      Director should have these nested metafunctions
-    //
-    //      1:  build_container<All, Filtered>
-    //
-    //          All: all child attributes
-    //          Filtered: all child attributes except unused
-    //
-    //      2:  transform_child<T>
-    //
-    //          T: child attribute
-    //
-    template <
-        typename Director, typename Component
-      , typename Iterator, typename Context
-      , typename IsSequence = mpl::false_>
-    struct build_fusion_sequence
-    {
-        template <
-            typename Domain, typename Director_
-          , typename Iterator_, typename Context_>
-        struct child_attribute
-        {
-            template <typename T>
-            struct result;
-
-            template <typename F, typename ChildComponent>
-            struct result<F(ChildComponent)>
-            {
-                typedef typename
-                    Director_::template transform_child<
-                        typename traits::attribute_of<
-                            Domain, ChildComponent, Context_, Iterator_>::type
-                    >::type
-                type;
-            };
-        };
-
-        // Compute the list of attributes of all sub-parsers
-        typedef
-            typename fusion::result_of::transform<
-                typename Component::elements_type
-              , child_attribute<
-                    typename Component::domain, Director, Iterator, Context>
-            >::type
-        all;
-
-        // Compute the list of all *used* attributes of sub-parsers
-        // (filter all unused parsers from the list)
-        typedef
-            typename fusion::result_of::filter_if<
-                all
-              , spirit::traits::is_not_unused<mpl::_>
-            >::type
-        filtered;
-
-        // Ask the director to build the actual fusion sequence.
-        // But *only if* the filtered sequence is not empty. i.e.
-        // if the sequence has all unused elements, our result
-        // will also be unused.
-        typedef
-            typename mpl::eval_if<
-                fusion::result_of::empty<filtered>
-              , mpl::identity<unused_type>
-              , typename Director::template build_container<all, filtered>
-            >::type
-        attribute_sequence;
-
-        // Finally, strip single element sequences into its
-        // naked form (e.g. vector<T> --> T)
-        typedef typename
-            traits::strip_single_element_sequence<attribute_sequence, IsSequence>::type
-        type;
-    };
-
-    // Use this when building homogeneous containers. Component
-    // is assumed to be a unary. Note:
-    //
-    //      Director should have this nested metafunction
-    //
-    //      1:  build_attribute_container<T>
-    //
-    //          T: the data-type for the container
-    //
-    template <
-        typename Director, typename Component
-      , typename Iterator, typename Context>
-    struct build_container
-    {
-        // Get the component's subject.
-        typedef typename
-            result_of::subject<Component>::type
-        subject_type;
-
-        // Get the subject's attribute
-        typedef typename
-            traits::attribute_of<
-                typename Component::domain, subject_type, Context, Iterator>::type
-        attr_type;
-
-        // If attribute is unused_type, return it as it is.
-        // If not, then ask the director to build the actual
-        // container for the attribute type.
-        typedef typename
-            mpl::if_<
-                is_same<unused_type, attr_type>
-              , unused_type
-              , typename Director::template
-                    build_attribute_container<attr_type>::type
-            >::type
-        type;
-    };
-}}
-
-#endif
Added: trunk/boost/spirit/home/support/attributes.hpp
==============================================================================
--- (empty file)
+++ trunk/boost/spirit/home/support/attributes.hpp	2009-04-26 10:42:24 EDT (Sun, 26 Apr 2009)
@@ -0,0 +1,420 @@
+/*=============================================================================
+    Copyright (c) 2001-2009 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_ATTRIBUTES_JANUARY_29_2007_0954AM)
+#define BOOST_SPIRIT_ATTRIBUTES_JANUARY_29_2007_0954AM
+
+#if defined(_MSC_VER)
+#pragma once
+#endif
+
+#include <boost/spirit/home/support/unused.hpp>
+#include <boost/spirit/home/support/detail/as_variant.hpp>
+#include <boost/optional/optional.hpp>
+#include <boost/fusion/include/transform.hpp>
+#include <boost/fusion/include/filter_if.hpp>
+#include <boost/fusion/include/as_vector.hpp>
+#include <boost/fusion/include/push_front.hpp>
+#include <boost/fusion/include/is_sequence.hpp>
+#include <boost/utility/value_init.hpp>
+#include <boost/type_traits/is_same.hpp>
+#include <boost/mpl/eval_if.hpp>
+#include <boost/mpl/end.hpp>
+#include <boost/mpl/find_if.hpp>
+#include <boost/mpl/identity.hpp>
+#include <boost/variant.hpp>
+#include <vector>
+#include <utility>
+
+namespace boost { namespace spirit { namespace traits
+{
+    ///////////////////////////////////////////////////////////////////////////
+    // This file deals with attribute related functions and metafunctions
+    // including generalized attribute transformation utilities for Spirit
+    // components.
+    ///////////////////////////////////////////////////////////////////////////
+
+    ///////////////////////////////////////////////////////////////////////////
+    // attribute_of
+    //
+    // Get the component's attribute
+    ///////////////////////////////////////////////////////////////////////////
+    template <typename Component
+      , typename Context = unused_type, typename Iterator = unused_type>
+    struct attribute_of
+    {
+        typedef typename Component::template
+            attribute<Context, Iterator>::type type;
+    };
+
+    ///////////////////////////////////////////////////////////////////////////
+    // attribute_not_unused
+    //
+    // An mpl metafunction class that determines whether a component's
+    // attribute is not unused.
+    ///////////////////////////////////////////////////////////////////////////
+    template <typename Context, typename Iterator = unused_type>
+    struct attribute_not_unused
+    {
+        template <typename Component>
+        struct apply
+          : is_not_unused<typename
+                attribute_of<Component, Context, Iterator>::type>
+        {};
+    };
+
+    ///////////////////////////////////////////////////////////////////////////
+    // pass_attribute
+    //
+    // Determines how we pass attributes to semantic actions. This
+    // may be specialized. By default, all attributes are wrapped in
+    // a fusion sequence, because the attribute has to be treated as being
+    // a single value in any case (even if it actually already is a fusion
+    // sequence in its own).
+    ///////////////////////////////////////////////////////////////////////////
+    template <typename Component, typename Attribute, typename Enable = void>
+    struct pass_attribute
+    {
+        typedef fusion::vector1<Attribute&> type;
+    };
+
+    ///////////////////////////////////////////////////////////////////////////
+    // Subclass a pass_attribute specialization from this to wrap
+    // the attribute in a tuple only IFF it is not already a fusion tuple.
+    ///////////////////////////////////////////////////////////////////////////
+    template <typename Attribute>
+    struct wrap_if_not_tuple
+    {
+        typedef typename
+            mpl::if_<
+                fusion::traits::is_sequence<Attribute>
+              , Attribute&
+              , fusion::vector1<Attribute&>
+            >::type
+        type;
+    };
+
+    template <>
+    struct wrap_if_not_tuple<unused_type>
+    {
+        typedef unused_type type;
+    };
+
+    template <>
+    struct wrap_if_not_tuple<unused_type const>
+    {
+        typedef unused_type type;
+    };
+
+    ///////////////////////////////////////////////////////////////////////////
+    // build_optional
+    //
+    // Build a boost::optional from T. Return unused_type if T is unused_type.
+    ///////////////////////////////////////////////////////////////////////////
+    template <typename T>
+    struct build_optional
+    {
+        typedef optional<T> type;
+    };
+
+    template <>
+    struct build_optional<unused_type>
+    {
+        typedef unused_type type;
+    };
+
+    ///////////////////////////////////////////////////////////////////////////
+    // build_std_vector
+    //
+    // Build a std::vector from T. Return unused_type if T is unused_type.
+    ///////////////////////////////////////////////////////////////////////////
+    template <typename T>
+    struct build_std_vector
+    {
+        typedef std::vector<T> type;
+    };
+
+    template <>
+    struct build_std_vector<unused_type>
+    {
+        typedef unused_type type;
+    };
+
+    ///////////////////////////////////////////////////////////////////////////
+    // filter_unused_attributes
+    //
+    // Remove unused_types from a sequence
+    ///////////////////////////////////////////////////////////////////////////
+    template <typename Sequence>
+    struct filter_unused_attributes
+    {
+        // Compute the list of all *used* attributes of sub-components
+        // (filter all unused attributes from the list)
+        typedef typename fusion::result_of::filter_if<
+                Sequence
+              , is_not_unused<mpl::_>
+            >::type
+        type;
+    };
+
+    ///////////////////////////////////////////////////////////////////////////
+    // build_fusion_vector
+    //
+    // Build a fusion vector from a fusion sequence. All unused attributes
+    // are filtered out. If the result is empty after the removal of unused
+    // types, return unused_type. If the input sequence is an unused_type,
+    // also return unused_type.
+    ///////////////////////////////////////////////////////////////////////////
+    template <typename Sequence>
+    struct build_fusion_vector
+    {
+        // Remove all unused attributes
+        typedef typename
+            filter_unused_attributes<Sequence>::type
+        filtered_attributes;
+
+        // Build a fusion vector from a fusion sequence (Sequence),
+        // But *only if* the sequence is not empty. i.e. if the
+        // sequence is empty, our result will be unused_type.
+
+        typedef typename
+            mpl::eval_if<
+                fusion::result_of::empty<filtered_attributes>
+              , mpl::identity<unused_type>
+              , fusion::result_of::as_vector<filtered_attributes>
+            >::type
+        type;
+    };
+
+    template <>
+    struct build_fusion_vector<unused_type>
+    {
+        typedef unused_type type;
+    };
+
+    ///////////////////////////////////////////////////////////////////////////
+    // build_attribute_sequence
+    //
+    // Build a fusion sequence attribute sequence from a sequence of
+    // components. Transform<T>::type is called on each element.
+    ///////////////////////////////////////////////////////////////////////////
+    template <typename Sequence, typename Context
+      , template <typename T> class Transform, typename Iterator = unused_type>
+    struct build_attribute_sequence
+    {
+        struct element_attribute
+        {
+            template <typename T>
+            struct result;
+
+            template <typename F, typename Element>
+            struct result<F(Element)>
+            {
+                typedef typename
+                    Transform<
+                        typename attribute_of<Element, Context, Iterator>::type
+                    >::type
+                type;
+            };
+        };
+
+        // Compute the list of attributes of all sub-components
+        typedef typename
+            fusion::result_of::transform<Sequence, element_attribute>::type
+        type;
+    };
+
+    ///////////////////////////////////////////////////////////////////////////
+    // has_no_unused
+    //
+    // Test if there are no unused attributes in Sequence
+    ///////////////////////////////////////////////////////////////////////////
+    template <typename Sequence>
+    struct has_no_unused
+      : is_same<
+            typename mpl::find_if<Sequence, is_same<mpl::_, unused_type> >::type
+          , typename mpl::end<Sequence>::type>
+    {};
+
+    ///////////////////////////////////////////////////////////////////////////
+    // build_variant
+    //
+    // Build a boost::variant from a fusion sequence. build_variant makes sure
+    // that 1) all attributes in the variant are unique 2) puts the unused
+    // attribute, if there is any, to the front and 3) collapses single element
+    // variants, variant<T> to T.
+    ///////////////////////////////////////////////////////////////////////////
+    template <typename Sequence>
+    struct build_variant
+    {
+        // Remove all unused attributes.
+        typedef typename
+            filter_unused_attributes<Sequence>::type
+        filtered_attributes;
+
+        // If the original attribute list does not contain any unused
+        // attributes, it is used, otherwise a single unused_type is
+        // pushed to the front of the list. This is to make sure that if
+        // there is an unused_type in the list, it is the first one.
+        typedef typename
+            mpl::eval_if<
+                has_no_unused<Sequence>,
+                mpl::identity<Sequence>,
+                fusion::result_of::push_front<filtered_attributes, unused_type>
+            >::type
+        attribute_sequence;
+
+        // Make sure each of the types occur only once in the type list
+        typedef typename
+            mpl::fold<
+                attribute_sequence, mpl::vector<>,
+                mpl::if_<
+                    mpl::contains<mpl::_1, mpl::_2>,
+                    mpl::_1, mpl::push_back<mpl::_1, mpl::_2>
+                >
+            >::type
+        new_sequence;
+
+        // If there is only one type in the list of types we strip off the
+        // variant. IOTW, collapse single element variants, variant<T> to T.
+        typedef typename
+            mpl::eval_if<
+                mpl::equal_to<mpl::size<new_sequence>, mpl::int_<1> >,
+                mpl::deref<mpl::front<attribute_sequence> >,
+                spirit::detail::as_variant<new_sequence>
+            >::type
+        type;
+    };
+
+    ///////////////////////////////////////////////////////////////////////////
+    // make_attribute
+    //
+    // All parsers and generators have specific attribute or parameter types.
+    // Spirit parsers are passed an attribute and Spirit generators
+    // are passed a parameter; these are either references to the expected
+    // type, or an unused_type -- to flag that we do not care about the
+    // attribute/parameter. For semantic actions, however, we need to have a
+    // real value to pass to the semantic action. If the client did not
+    // provide one, we will have to synthesize the value. This class
+    // takes care of that.
+    ///////////////////////////////////////////////////////////////////////////
+    template <typename Attribute, typename ActualAttribute>
+    struct make_attribute
+    {
+        typedef typename
+            mpl::if_<
+                is_same<typename remove_const<ActualAttribute>::type, unused_type>
+              , typename remove_const<Attribute>::type
+              , ActualAttribute&>::type
+        type;
+
+        typedef typename
+            mpl::if_<
+                is_same<typename remove_const<ActualAttribute>::type, unused_type>
+              , typename remove_const<Attribute>::type
+              , ActualAttribute>::type
+        value_type;
+
+        static Attribute call(unused_type)
+        {
+             // synthesize the attribute/parameter
+            return boost::get(value_initialized<Attribute>());
+        }
+
+        template <typename T>
+        static T& call(T& value)
+        {
+            return value; // just pass the one provided
+        }
+
+        template <typename T>
+        static T const& call(T const& value)
+        {
+            return value; // just pass the one provided
+        }
+    };
+
+    template <typename Attribute, typename ActualAttribute>
+    struct make_attribute<Attribute&, ActualAttribute>
+      : make_attribute<Attribute, ActualAttribute>
+    {
+    };
+
+    template <typename Attribute, typename ActualAttribute>
+    struct make_attribute<Attribute const&, ActualAttribute>
+      : make_attribute<Attribute, ActualAttribute>
+    {
+    };
+
+    template <typename ActualAttribute>
+    struct make_attribute<unused_type, ActualAttribute>
+    {
+        typedef unused_type type;
+        static unused_type call(unused_type)
+        {
+            return unused;
+        }
+    };
+
+    ///////////////////////////////////////////////////////////////////////////
+    // swap_impl
+    //
+    // Swap (with proper handling of unused_types)
+    ///////////////////////////////////////////////////////////////////////////
+    template <typename A, typename B>
+    void swap_impl(A& a, B& b)
+    {
+        A temp = a;
+        a = b;
+        b = temp;
+    }
+
+    template <typename T>
+    void swap_impl(T& a, T& b)
+    {
+        using namespace std;
+        swap(a, b);
+    }
+
+    template <typename A>
+    void swap_impl(A& a, unused_type)
+    {
+    }
+
+    template <typename A>
+    void swap_impl(unused_type, A& a)
+    {
+    }
+
+    inline void swap_impl(unused_type, unused_type)
+    {
+    }
+
+    ///////////////////////////////////////////////////////////////////////////
+    //  Strips single element fusion vectors into its 'naked'
+    //  form: vector<T> --> T
+    ///////////////////////////////////////////////////////////////////////////
+    template <typename T>
+    struct strip_single_element_vector
+    {
+        typedef T type;
+    };
+
+    template <typename T>
+    struct strip_single_element_vector<fusion::vector1<T> >
+    {
+        typedef T type;
+    };
+
+    template <typename T>
+    struct strip_single_element_vector<fusion::vector<T> >
+    {
+        typedef T type;
+    };
+
+}}}
+
+#endif
Modified: trunk/boost/spirit/home/support/char_class.hpp
==============================================================================
--- trunk/boost/spirit/home/support/char_class.hpp	(original)
+++ trunk/boost/spirit/home/support/char_class.hpp	2009-04-26 10:42:24 EDT (Sun, 26 Apr 2009)
@@ -1,195 +1,216 @@
 /*=============================================================================
-    Copyright (c) 2001-2007 Joel de Guzman
+    Copyright (c) 2001-2009 Joel de Guzman
     Copyright (c) 2001-2009 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_CHAR_CLASS_NOV_10_2006_0907AM)
-#define BOOST_SPIRIT_CHAR_CLASS_NOV_10_2006_0907AM
+#if !defined(BOOST_SPIRIT_CHAR_CLASS_NOVEMBER_10_2006_0907AM)
+#define BOOST_SPIRIT_CHAR_CLASS_NOVEMBER_10_2006_0907AM
 
-#include <string>
+#if defined(_MSC_VER)
+#pragma once
+#endif
 
-#include <boost/spirit/home/support/char_class/standard.hpp>
-#include <boost/spirit/home/support/char_class/standard_wide.hpp>
-#include <boost/spirit/home/support/char_class/ascii.hpp>
-#include <boost/spirit/home/support/char_class/iso8859_1.hpp>
+#include <string>
 
+#include <boost/proto/proto.hpp>
 #include <boost/config.hpp>
 #if defined(BOOST_MSVC)
 # pragma warning(push)
 # pragma warning(disable: 4800) // 'int' : forcing value to bool 'true' or 'false' warning
 #endif
 
-namespace boost { namespace spirit { namespace char_class
+namespace boost { namespace spirit { namespace tag
 {
-    namespace tag
-    {
-        // classification
-        struct alnum {};
-        struct alpha {};
-        struct digit {};
-        struct xdigit {};
-        struct cntrl {};
-        struct graph {};
-        struct lower {};
-        struct print {};
-        struct punct {};
-        struct space {};
-        struct blank {};
-        struct upper {};
-    }
+    struct char_ {};
+    struct string {};
 
-    // This composite tag type encodes both the character
-    // set and the specific char classification.
-    template <typename CharSet, typename CharClass>
-    struct key
-    {
-        typedef CharSet char_set;
-        typedef CharClass char_class;
-    };
+    ///////////////////////////////////////////////////////////////////////////
+    // classification tags
+    struct alnum {};
+    struct alpha {};
+    struct digit {};
+    struct xdigit {};
+    struct cntrl {};
+    struct graph {};
+    struct print {};
+    struct punct {};
+    struct space {};
+    struct blank {};
+
+    ///////////////////////////////////////////////////////////////////////////
+    // classification/conversion tags
+    struct no_case {};
+    struct lower {};
+    struct upper {};
+    struct ucs4 {};
 
-    // This identity tag types encode the character set.
-    struct no_case_base_tag {};
-    struct lower_case_base_tag {};
-    struct upper_case_base_tag {};
-
-    template <typename CharSet>
-    struct no_case_tag : no_case_base_tag
-    {
-        typedef CharSet char_set;
-    };
+    ///////////////////////////////////////////////////////////////////////////
+    // This composite tag type encodes both the character
+    // set and the specific char tag (used for classification
+    // or conversion). char_code_base can be used to test for
+    // modifier membership (see modifier.hpp)
+    template <typename CharClass>
+    struct char_code_base {};
 
-    template <typename CharSet>
-    struct lower_case_tag : lower_case_base_tag
+    template <typename CharClass, typename CharEncoding>
+    struct char_code : char_code_base<CharClass>
     {
-        typedef CharSet char_set;
-        typedef tag::lower char_class;
+        typedef CharEncoding char_encoding; // e.g. ascii
+        typedef CharClass char_class;       // e.g. tag::alnum
     };
 
-    template <typename CharSet>
-    struct upper_case_tag : upper_case_base_tag
-    {
-        typedef CharSet char_set;
-        typedef tag::upper char_class;
-    };
+}}}
 
+namespace boost { namespace spirit { namespace char_class
+{
+    ///////////////////////////////////////////////////////////////////////////
     // Test characters for classification
-    template <typename CharSet>
+    template <typename CharEncoding>
     struct classify
     {
-        typedef typename CharSet::char_type char_type;
+        typedef typename CharEncoding::char_type char_type;
+
+        template <typename Char>
+        static bool
+        is(tag::char_, Char ch)
+        {
+            return CharEncoding::ischar(char_type(ch));
+        }
 
         template <typename Char>
         static bool
         is(tag::alnum, Char ch)
         {
-            return CharSet::isalnum(char_type(ch));
+            return CharEncoding::isalnum(char_type(ch));
         }
 
         template <typename Char>
         static bool
         is(tag::alpha, Char ch)
         {
-            return CharSet::isalpha(char_type(ch));
+            return CharEncoding::isalpha(char_type(ch));
         }
 
         template <typename Char>
         static bool
         is(tag::digit, Char ch)
         {
-            return CharSet::isdigit(char_type(ch));
+            return CharEncoding::isdigit(char_type(ch));
         }
 
         template <typename Char>
         static bool
         is(tag::xdigit, Char ch)
         {
-            return CharSet::isxdigit(char_type(ch));
+            return CharEncoding::isxdigit(char_type(ch));
         }
 
         template <typename Char>
         static bool
         is(tag::cntrl, Char ch)
         {
-            return CharSet::iscntrl(char_type(ch));
+            return CharEncoding::iscntrl(char_type(ch));
         }
 
         template <typename Char>
         static bool
         is(tag::graph, Char ch)
         {
-            return CharSet::isgraph(char_type(ch));
+            return CharEncoding::isgraph(char_type(ch));
         }
 
         template <typename Char>
         static bool
         is(tag::lower, Char ch)
         {
-            return CharSet::islower(char_type(ch));
+            return CharEncoding::islower(char_type(ch));
         }
 
         template <typename Char>
         static bool
         is(tag::print, Char ch)
         {
-            return CharSet::isprint(char_type(ch));
+            return CharEncoding::isprint(char_type(ch));
         }
 
         template <typename Char>
         static bool
         is(tag::punct, Char ch)
         {
-            return CharSet::ispunct(char_type(ch));
+            return CharEncoding::ispunct(char_type(ch));
         }
 
         template <typename Char>
         static bool
         is(tag::space, Char ch)
         {
-            return CharSet::isspace(char_type(ch));
+            return CharEncoding::isspace(char_type(ch));
         }
 
         template <typename Char>
         static bool
         is(tag::blank, Char ch)
         {
-            return CharSet::isblank BOOST_PREVENT_MACRO_SUBSTITUTION (char_type(ch));
+            return CharEncoding::isblank
+                BOOST_PREVENT_MACRO_SUBSTITUTION (char_type(ch));
         }
 
         template <typename Char>
         static bool
         is(tag::upper, Char ch)
         {
-            return CharSet::isupper(char_type(ch));
+            return CharEncoding::isupper(char_type(ch));
         }
     };
 
+    ///////////////////////////////////////////////////////////////////////////
     // Convert characters
-    template <typename CharSet>
+    template <typename CharEncoding>
     struct convert
     {
-        typedef typename CharSet::char_type char_type;
+        typedef typename CharEncoding::char_type char_type;
 
         template <typename Char>
         static Char
         to(tag::lower, Char ch)
         {
-            return CharSet::tolower(char_type(ch));
+            return CharEncoding::tolower(char_type(ch));
         }
 
         template <typename Char>
         static Char
         to(tag::upper, Char ch)
         {
-            return CharSet::toupper(char_type(ch));
+            return CharEncoding::toupper(char_type(ch));
+        }
+
+        template <typename Char>
+        static Char
+        to(tag::ucs4, Char ch)
+        {
+            return CharEncoding::toucs4(char_type(ch));
+        }
+
+        template <typename Char>
+        static Char
+        to(unused_type, Char ch)
+        {
+            return ch;
         }
     };
 
+    ///////////////////////////////////////////////////////////////////////////
     // Info on character classification
-    template <typename CharSet>
+    template <typename CharEncoding>
     struct what
     {
+        static char const* is(tag::char_)
+        {
+            return "char";
+        }
+
         static char const* is(tag::alnum)
         {
             return "alnum";
@@ -249,6 +270,11 @@
         {
             return "upper";
         }
+
+        static char const* is(tag::ucs4)
+        {
+            return "ucs4";
+        }
     };
 }}}
 
Added: trunk/boost/spirit/home/support/common_terminals.hpp
==============================================================================
--- (empty file)
+++ trunk/boost/spirit/home/support/common_terminals.hpp	2009-04-26 10:42:24 EDT (Sun, 26 Apr 2009)
@@ -0,0 +1,137 @@
+/*=============================================================================
+  Copyright (c) 2001-2009 Joel de Guzman
+  http://spirit.sourceforge.net/
+
+  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)
+=============================================================================*/
+#ifndef BOOST_SPIRIT_COMMON_PLACEHOLDERS_OCTOBER_16_2008_0102PM
+#define BOOST_SPIRIT_COMMON_PLACEHOLDERS_OCTOBER_16_2008_0102PM
+
+#if defined(_MSC_VER)
+#pragma once
+#endif
+
+#include <boost/spirit/home/support/terminal.hpp>
+#include <boost/spirit/home/support/char_encoding/standard.hpp>
+#include <boost/spirit/home/support/char_encoding/standard_wide.hpp>
+#include <boost/spirit/home/support/char_encoding/ascii.hpp>
+#include <boost/spirit/home/support/char_encoding/iso8859_1.hpp>
+#include <boost/spirit/home/support/char_class.hpp>
+
+namespace boost { namespace spirit
+{
+    // Our basic terminals
+    BOOST_SPIRIT_DEFINE_TERMINALS(
+        ( verbatim )
+        ( none )
+        ( lexeme )
+        ( omit )
+        ( raw )
+        ( inf )
+        ( eol )
+        ( eoi )
+    )
+
+    // Here we are reusing proto::lit
+    using proto::lit;
+
+    // Our extended terminals
+    BOOST_SPIRIT_DEFINE_TERMINALS_EX(
+        ( bin )
+        ( oct )
+        ( hex )
+        ( ushort_ )
+        ( ulong_ )
+        ( uint_ )
+        ( short_ )
+        ( long_ )
+        ( int_ )
+        ( ulong_long )
+        ( long_long )
+        ( float_ )
+        ( double_ )
+        ( long_double )
+        ( repeat )
+        ( eps )
+        ( pad )
+        ( byte_ )
+        ( word )
+        ( big_word )
+        ( little_word )
+        ( dword )
+        ( big_dword )
+        ( little_dword )
+        ( qword )
+        ( big_qword )
+        ( little_qword )
+        ( skip )
+        ( delimit )
+        ( stream )
+        ( wstream )
+        ( left_align )
+        ( right_align )
+        ( center )
+        ( maxwidth )
+        ( set_state )
+        ( in_state )
+        ( token )
+    )
+}}
+
+///////////////////////////////////////////////////////////////////////////////
+// Here we place the character-set sensitive placeholders. We have one set
+// each for ascii, iso8859_1, standard and standard_wide. These placeholders
+// are placed in its char-set namespace. For example, there exist a placeholder
+// spirit::ascii::alnum for ascii versions of alnum.
+
+#define BOOST_SPIRIT_CHAR_SPEC(charset)                                         \
+    typedef spirit::terminal<                                                   \
+        tag::char_code<tag::char_, charset> > char__type;                       \
+    char__type const char_ = char__type();                                      \
+                                                                                \
+    inline void silence_unused_warnings__##char_() { (void) char_; }            \
+                                                                                \
+    typedef spirit::terminal<                                                   \
+        tag::char_code<tag::string, charset> > string_type;                     \
+    string_type const string = string_type();                                   \
+                                                                                \
+    inline void silence_unused_warnings__##string() { (void) string; }          \
+    /***/
+
+#define BOOST_SPIRIT_CHAR_CODE(name, charset)                                   \
+    typedef proto::terminal<tag::char_code<tag::name, charset> >::type          \
+        name##_type;                                                            \
+    name##_type const name = name##_type();                                     \
+                                                                                \
+    inline void silence_unused_warnings__##name() { (void) name; }              \
+    /***/
+
+#define BOOST_SPIRIT_DEFINE_CHAR_CODES(charset)                                 \
+    namespace boost { namespace spirit { namespace charset                      \
+    {                                                                           \
+        BOOST_SPIRIT_CHAR_SPEC(spirit::char_encoding::charset)                  \
+                                                                                \
+        BOOST_SPIRIT_CHAR_CODE(alnum, spirit::char_encoding::charset)           \
+        BOOST_SPIRIT_CHAR_CODE(alpha, spirit::char_encoding::charset)           \
+        BOOST_SPIRIT_CHAR_CODE(blank, spirit::char_encoding::charset)           \
+        BOOST_SPIRIT_CHAR_CODE(cntrl, spirit::char_encoding::charset)           \
+        BOOST_SPIRIT_CHAR_CODE(digit, spirit::char_encoding::charset)           \
+        BOOST_SPIRIT_CHAR_CODE(graph, spirit::char_encoding::charset)           \
+        BOOST_SPIRIT_CHAR_CODE(print, spirit::char_encoding::charset)           \
+        BOOST_SPIRIT_CHAR_CODE(punct, spirit::char_encoding::charset)           \
+        BOOST_SPIRIT_CHAR_CODE(space, spirit::char_encoding::charset)           \
+        BOOST_SPIRIT_CHAR_CODE(xdigit, spirit::char_encoding::charset)          \
+                                                                                \
+        BOOST_SPIRIT_CHAR_CODE(no_case, spirit::char_encoding::charset)         \
+        BOOST_SPIRIT_CHAR_CODE(lower, spirit::char_encoding::charset)           \
+        BOOST_SPIRIT_CHAR_CODE(upper, spirit::char_encoding::charset)           \
+    }}}                                                                         \
+    /***/
+
+BOOST_SPIRIT_DEFINE_CHAR_CODES(ascii)
+BOOST_SPIRIT_DEFINE_CHAR_CODES(iso8859_1)
+BOOST_SPIRIT_DEFINE_CHAR_CODES(standard)
+BOOST_SPIRIT_DEFINE_CHAR_CODES(standard_wide)
+
+#endif
Deleted: trunk/boost/spirit/home/support/component.hpp
==============================================================================
--- trunk/boost/spirit/home/support/component.hpp	2009-04-26 10:42:24 EDT (Sun, 26 Apr 2009)
+++ (empty file)
@@ -1,291 +0,0 @@
-/*=============================================================================
-    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_COMPONENT_JAN_14_2007_1102AM)
-#define BOOST_SPIRIT_COMPONENT_JAN_14_2007_1102AM
-
-#include <boost/spirit/home/support/unused.hpp>
-#include <boost/spirit/home/support/meta_grammar/grammar.hpp>
-#include <boost/proto/core.hpp>
-#include <boost/fusion/include/at.hpp>
-#include <boost/fusion/include/value_at.hpp>
-#include <boost/mpl/void.hpp>
-#include <boost/mpl/identity.hpp>
-#include <boost/mpl/apply.hpp>
-
-namespace boost { namespace spirit
-{
-    ///////////////////////////////////////////////////////////////////////////
-    //  component generalizes a spirit component. A component can be a parser,
-    //  a primitive-parser, a composite-parser, a generator, etc.
-    //  A component has:
-    //
-    //      1) Domain: The world it operates on (purely a type e.g. qi::domain).
-    //      2) Director: Its Director (purely a type e.g. qi::sequence)
-    //      3) Elements: For composites, a tuple of components
-    //                   For primitives, a tuple of arbitrary information
-    //
-    ///////////////////////////////////////////////////////////////////////////
-    template <typename Domain, typename Director, typename Elements>
-    struct component
-    {
-        typedef Domain domain;
-        typedef Director director;
-        typedef Elements elements_type;
-
-        component()
-        {
-        }
-
-        component(Elements const& elements)
-          : elements(elements)
-        {
-        }
-
-        template <typename Elements2>
-        component(component<Domain, Director, Elements2> const& other)
-          : elements(other.elements)
-        {
-            // allow copy from components with compatible elements
-        }
-
-        elements_type elements;
-    };
-
-    ///////////////////////////////////////////////////////////////////////////
-    //  Utils for extracting child components
-    ///////////////////////////////////////////////////////////////////////////
-    namespace result_of
-    {
-        template <typename Component>
-        struct subject
-        {
-            typedef typename
-                fusion::result_of::value_at_c<
-                    typename Component::elements_type, 0>::type
-            type;
-        };
-
-        template <typename Component>
-        struct left
-        {
-            typedef typename
-                fusion::result_of::value_at_c<
-                    typename Component::elements_type, 0>::type
-            type;
-        };
-
-        template <typename Component>
-        struct right
-        {
-            typedef typename
-                fusion::result_of::value_at_c<
-                    typename Component::elements_type, 1>::type
-            type;
-        };
-
-        template <typename Component>
-        struct argument1
-        {
-            typedef typename
-                fusion::result_of::value_at_c<
-                    typename Component::elements_type, 1>::type
-            type;
-        };
-
-        template <typename Component>
-        struct argument2
-        {
-            typedef typename
-                fusion::result_of::value_at_c<
-                    typename Component::elements_type, 2>::type
-            type;
-        };
-
-        template<typename Component, int N>
-        struct arg_c
-            : fusion::result_of::value_at_c<
-                    typename Component::elements_type, N>
-        {};
-
-    }
-
-    template <typename Component>
-    typename fusion::result_of::at_c<
-        typename Component::elements_type const, 0>::type
-    inline subject(Component const& c)
-    {
-        return fusion::at_c<0>(c.elements);
-    }
-
-    template <typename Component>
-    typename fusion::result_of::at_c<
-        typename Component::elements_type const, 0>::type
-    inline left(Component const& c)
-    {
-        return fusion::at_c<0>(c.elements);
-    }
-
-    template <typename Component>
-    typename fusion::result_of::at_c<
-        typename Component::elements_type const, 1>::type
-    inline right(Component const& c)
-    {
-        return fusion::at_c<1>(c.elements);
-    }
-
-    template <typename Component>
-    typename fusion::result_of::at_c<
-        typename Component::elements_type const, 1>::type
-    inline argument1(Component const& c)
-    {
-        return fusion::at_c<1>(c.elements);
-    }
-
-    template <typename Component>
-    typename fusion::result_of::at_c<
-        typename Component::elements_type const, 2>::type
-    inline argument2(Component const& c)
-    {
-        return fusion::at_c<2>(c.elements);
-    }
-
-    template <int N, typename Component>
-    typename fusion::result_of::at_c<
-        typename Component::elements_type const, N>::type
-    inline arg_c(Component const& c)
-    {
-        return fusion::at_c<N>(c.elements);
-    }
-
-    ///////////////////////////////////////////////////////////////////////////
-    //  Test if Expr conforms to the grammar of Domain. If Expr is already
-    //  a component, return mpl::true_.
-    ///////////////////////////////////////////////////////////////////////////
-    namespace traits
-    {
-        template <typename Domain, typename Expr>
-        struct is_component
-          : proto::matches<
-                typename proto::result_of::as_expr<Expr>::type
-              , typename meta_grammar::grammar<Domain>::type
-            >
-        {
-        };
-
-        template <typename Domain, typename Director, typename Elements>
-        struct is_component<Domain, component<Domain, Director, Elements> > :
-            mpl::true_
-        {
-        };
-    }
-
-    ///////////////////////////////////////////////////////////////////////////
-    //  Convert an arbitrary expression to a spirit component. There's
-    //  a metafunction in namespace result_of and a function in main
-    //  spirit namespace. If Expr is already a component, return it as-is.
-    ///////////////////////////////////////////////////////////////////////////
-    namespace result_of
-    {
-        template <
-            typename Domain, typename Expr, typename State = unused_type,
-            typename Visitor = unused_type
-        >
-        struct as_component
-        {
-            typedef typename meta_grammar::grammar<Domain>::type grammar;
-            typedef typename proto::result_of::as_expr<Expr>::type proto_xpr;
-            typedef typename grammar::template impl<proto_xpr, State, Visitor> callable;
-            typedef typename callable::result_type type;
-        };
-
-        // special case for arrays
-        template <
-            typename Domain, typename T, int N,
-            typename State, typename Visitor>
-        struct as_component<Domain, T[N], State, Visitor>
-        {
-            typedef typename meta_grammar::grammar<Domain>::type grammar;
-            typedef typename proto::result_of::as_expr<T const*>::type proto_xpr;
-            typedef typename grammar::template impl<proto_xpr, State, Visitor> callable;
-            typedef typename callable::result_type type;
-        };
-
-        // special case for components
-        template <typename Domain, typename Director, typename Elements>
-        struct as_component<Domain, component<Domain, Director, Elements> > :
-            mpl::identity<component<Domain, Director, Elements> >
-        {
-        };
-    }
-    
-    namespace detail
-    {
-        template<typename T>
-        T &decay(T &t)
-        {
-            return t;
-        }
-
-        template<typename T, int N>
-        T *decay(T (&t)[N])
-        {
-            return t;
-        }
-    }
-
-    template <typename Domain, typename Expr>
-    inline typename result_of::as_component<Domain, Expr>::type
-    as_component(Domain, Expr const& xpr)
-    {
-        typedef typename result_of::as_component<Domain, Expr>::callable callable;
-        return callable()(proto::as_expr(detail::decay(xpr)), unused_type(), unused_type());
-    }
-
-    template <typename Domain, typename Expr, typename State, typename Visitor>
-    inline typename result_of::as_component<Domain, Expr>::type
-    as_component(Domain, Expr const& xpr, State const& state, Visitor& visitor)
-    {
-        typedef typename result_of::as_component<Domain, Expr, State, Visitor>::callable callable;
-        return callable()(proto::as_expr(detail::decay(xpr)), state, visitor);
-    }
-
-    template <typename Domain, typename Director, typename Elements>
-    inline component<Domain, Director, Elements> const&
-    as_component(Domain, component<Domain, Director, Elements> const& component)
-    {
-        return component;
-    }
-
-    ///////////////////////////////////////////////////////////////////////////
-    //  Create a component. This is a customization point. Components are
-    //  not created directly; they are created through make_component.
-    //  Clients may customize this to direct the creation of a component.
-    //
-    //  The extra Modifier template parameter may be used to direct the
-    //  creation of the component. This is the Visitor parameter in Proto
-    //  transforms.
-    //
-    //  (see also: modifier.hpp)
-    ///////////////////////////////////////////////////////////////////////////
-    namespace traits
-    {
-        template <
-            typename Domain, typename Director
-          , typename Elements, typename Modifier, typename Enable = void>
-        struct make_component
-          : mpl::identity<component<Domain, Director, Elements> >
-        {
-            static component<Domain, Director, Elements>
-            call(Elements const& elements)
-            {
-                return component<Domain, Director, Elements>(elements);
-            }
-        };
-    }
-}}
-
-#endif
Added: trunk/boost/spirit/home/support/container.hpp
==============================================================================
--- (empty file)
+++ trunk/boost/spirit/home/support/container.hpp	2009-04-26 10:42:24 EDT (Sun, 26 Apr 2009)
@@ -0,0 +1,276 @@
+/*=============================================================================
+    Copyright (c) 2001-2009 Joel de Guzman
+    Copyright (c) 2001-2009 Hartmut Kaiser
+    http://spirit.sourceforge.net/
+
+    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_CONTAINER_FEBRUARY_06_2007_1001AM)
+#define BOOST_SPIRIT_CONTAINER_FEBRUARY_06_2007_1001AM
+
+#if defined(_MSC_VER)
+#pragma once
+#endif
+
+#include <boost/spirit/home/support/unused.hpp>
+#include <boost/detail/iterator.hpp> // for boost::detail::iterator_traits
+#include <boost/mpl/has_xxx.hpp>
+#include <boost/mpl/bool.hpp>
+#include <boost/optional.hpp>
+//#include <boost/variant.hpp>
+//#include <boost/preprocessor/cat.hpp>
+//#include <boost/preprocessor/repeat.hpp>
+
+namespace boost { namespace spirit { namespace traits
+{
+    ///////////////////////////////////////////////////////////////////////////
+    //  This file contains some container utils for stl containers. The
+    //  utilities provided also accept spirit's unused_type; all no-ops.
+    //  Compiler optimization will easily strip these away.
+    ///////////////////////////////////////////////////////////////////////////
+
+    namespace detail
+    {
+        BOOST_MPL_HAS_XXX_TRAIT_DEF(value_type);
+        BOOST_MPL_HAS_XXX_TRAIT_DEF(iterator);
+        BOOST_MPL_HAS_XXX_TRAIT_DEF(size_type);
+        BOOST_MPL_HAS_XXX_TRAIT_DEF(reference);
+    }
+
+    template <typename T>
+    struct is_container :
+        mpl::bool_<
+            detail::has_value_type<T>::value &&
+            detail::has_iterator<T>::value &&
+            detail::has_size_type<T>::value &&
+            detail::has_reference<T>::value
+        >
+    {};
+
+//    template <typename T>
+//    struct is_container<optional<T> > 
+//      : is_container<T> {};
+
+//#define BOOST_SPIRIT_IS_CONTAINER(z, N, data)                                 \
+//        is_container<BOOST_PP_CAT(T, N)>::value ||                            \
+//    /***/
+
+//    template <BOOST_VARIANT_ENUM_PARAMS(typename T)>
+//    struct is_container<boost::variant<BOOST_VARIANT_ENUM_PARAMS(T)> > 
+//      : mpl::bool_<BOOST_PP_REPEAT(BOOST_VARIANT_LIMIT_TYPES
+//          , BOOST_SPIRIT_IS_CONTAINER, _) false> {};
+
+//#undef BOOST_SPIRIT_IS_CONTAINER
+
+    ///////////////////////////////////////////////////////////////////////////
+//    template <typename T>
+//    struct container_type 
+//    {
+//        typedef T type;
+//    };
+
+//    template <typename T>
+//    struct container_type<optional<T> > 
+//      : container_type<T> {};
+
+//    template <BOOST_VARIANT_ENUM_PARAMS(typename T)>
+//    struct container_type<boost::variant<BOOST_VARIANT_ENUM_PARAMS(T)> > 
+//    {
+//        typedef typename 
+//            boost::variant<BOOST_VARIANT_ENUM_PARAMS(T)>::types 
+//        types;
+
+//        typedef typename mpl::find_if<types, is_container<mpl::_1> >::type iter;
+//        typedef typename mpl::deref<iter>::type type;
+//    };
+
+    ///////////////////////////////////////////////////////////////////////////
+    namespace result_of
+    {
+        template <typename Container>
+        struct value
+        {
+            typedef typename Container::value_type type;
+        };
+
+        template <>
+        struct value<unused_type>
+        {
+            typedef unused_type type;
+        };
+
+        template <>
+        struct value<unused_type const>
+        {
+            typedef unused_type type;
+        };
+
+        template <typename Container>
+        struct iterator
+        {
+            typedef typename Container::iterator type;
+        };
+
+        template <typename Container>
+        struct iterator<Container const>
+        {
+            typedef typename Container::const_iterator type;
+        };
+
+        template <>
+        struct iterator<unused_type>
+        {
+            typedef unused_type const* type;
+        };
+
+        template <>
+        struct iterator<unused_type const>
+        {
+            typedef unused_type const* type;
+        };
+
+        template <typename T>
+        struct optional_value
+        {
+            typedef T type;
+        };
+
+        template <typename T>
+        struct optional_value<optional<T> >
+        {
+            typedef T type;
+        };
+
+        template <>
+        struct optional_value<unused_type>
+        {
+            typedef unused_type type;
+        };
+
+        template <>
+        struct optional_value<unused_type const>
+        {
+            typedef unused_type type;
+        };
+    }
+
+    ///////////////////////////////////////////////////////////////////////////
+    template <typename Container, typename T>
+    inline void push_back(Container& c, T const& val)
+    {
+        c.push_back(val);
+    }
+
+    template <typename Container>
+    inline void push_back(Container&, unused_type)
+    {
+    }
+
+    template <typename T>
+    inline void push_back(unused_type, T const&)
+    {
+    }
+
+    inline void push_back(unused_type, unused_type)
+    {
+    }
+
+    ///////////////////////////////////////////////////////////////////////////
+    template <typename Container>
+    inline typename result_of::iterator<Container>::type
+    begin(Container& c)
+    {
+        return c.begin();
+    }
+
+    template <typename Container>
+    inline typename result_of::iterator<Container const>::type
+    begin(Container const& c)
+    {
+        return c.begin();
+    }
+
+    inline unused_type const*
+    begin(unused_type)
+    {
+        return &unused;
+    }
+
+    template <typename Container>
+    inline typename result_of::iterator<Container>::type
+    end(Container& c)
+    {
+        return c.end();
+    }
+
+    template <typename Container>
+    inline typename result_of::iterator<Container const>::type
+    end(Container const& c)
+    {
+        return c.end();
+    }
+
+    inline unused_type const*
+    end(unused_type)
+    {
+        return &unused;
+    }
+
+    ///////////////////////////////////////////////////////////////////////////
+    template <typename Iterator>
+    inline typename boost::detail::iterator_traits<Iterator>::value_type
+    deref(Iterator& it)
+    {
+        return *it;
+    }
+
+    inline unused_type
+    deref(unused_type*)
+    {
+        return unused;
+    }
+
+    inline unused_type
+    deref(unused_type const*)
+    {
+        return unused;
+    }
+
+    ///////////////////////////////////////////////////////////////////////////
+    template <typename Iterator>
+    inline Iterator
+    next(Iterator& it)
+    {
+        return ++it;
+    }
+
+    inline unused_type
+    next(unused_type*)
+    {
+        return &unused;
+    }
+
+    inline unused_type
+    next(unused_type const*)
+    {
+        return &unused;
+    }
+
+    ///////////////////////////////////////////////////////////////////////////
+    template <typename Iterator>
+    inline bool
+    compare(Iterator const& it1, Iterator const& it2)
+    {
+        return it1 == it2;
+    }
+
+    inline bool
+    compare(unused_type*, unused_type*)
+    {
+        return true;
+    }
+
+}}}
+
+#endif
Added: trunk/boost/spirit/home/support/context.hpp
==============================================================================
--- (empty file)
+++ trunk/boost/spirit/home/support/context.hpp	2009-04-26 10:42:24 EDT (Sun, 26 Apr 2009)
@@ -0,0 +1,214 @@
+/*=============================================================================
+    Copyright (c) 2001-2009 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_CONTEXT_OCTOBER_31_2008_0654PM)
+#define BOOST_SPIRIT_CONTEXT_OCTOBER_31_2008_0654PM
+
+#if defined(_MSC_VER)
+#pragma once
+#endif
+
+#include <boost/preprocessor/repetition/repeat_from_to.hpp>
+#include <boost/spirit/home/support/nonterminal/expand_arg.hpp>
+#include <boost/spirit/home/phoenix/core/actor.hpp>
+#include <boost/spirit/home/phoenix/core/argument.hpp>
+#include <boost/fusion/include/at.hpp>
+#include <boost/fusion/include/size.hpp>
+#include <boost/fusion/include/as_list.hpp>
+#include <boost/fusion/include/transform.hpp>
+#include <boost/mpl/size.hpp>
+#include <boost/mpl/at.hpp>
+
+#if !defined(SPIRIT_ATTRIBUTES_LIMIT)
+# define SPIRIT_ATTRIBUTES_LIMIT PHOENIX_LIMIT
+#endif
+
+#define SPIRIT_DECLARE_ATTRIBUTE(z, n, data)                                    \
+    phoenix::actor<attribute<n> > const                                         \
+        BOOST_PP_CAT(_r, n) = attribute<n>();
+
+#define SPIRIT_USING_ATTRIBUTE(z, n, data) using spirit::BOOST_PP_CAT(_r, n);
+
+namespace boost { namespace spirit
+{
+    template <typename Attributes, typename Locals>
+    struct context
+    {
+        typedef Attributes attributes_type;
+        typedef Locals locals_type;
+
+        context(typename Attributes::car_type attribute)
+          : attributes(attribute, fusion::nil()), locals() {}
+
+        template <typename Args, typename Context>
+        context(
+            typename Attributes::car_type attribute
+          , Args const& args
+          , Context& caller_context
+        ) : attributes(
+                attribute
+              , fusion::as_list(
+                    fusion::transform(
+                        args
+                      , detail::expand_arg<Context>(caller_context)
+                    )
+                )
+            )
+          , locals() {}
+
+        context(Attributes const& attributes)
+          : attributes(attributes), locals() {}
+
+        Attributes attributes;  // The attributes
+        Locals locals;          // Local variables
+    };
+
+    template <typename Context>
+    struct attributes_of;
+
+    template <typename Attributes, typename Locals>
+    struct attributes_of<context<Attributes, Locals> >
+    {
+        typedef typename context<Attributes, Locals>::attributes_type type;
+    };
+
+    template <typename Attributes, typename Locals>
+    struct attributes_of<context<Attributes, Locals> const>
+    {
+        typedef typename context<Attributes, Locals>::attributes_type const type;
+    };
+
+    template <typename Context>
+    struct locals_of;
+
+    template <typename Attributes, typename Locals>
+    struct locals_of<context<Attributes, Locals> >
+    {
+        typedef typename context<Attributes, Locals>::locals_type type;
+    };
+
+    template <typename Attributes, typename Locals>
+    struct locals_of<context<Attributes, Locals> const>
+    {
+        typedef typename context<Attributes, Locals>::locals_type const type;
+    };
+
+    template <int N>
+    struct attribute
+    {
+        typedef mpl::true_ no_nullary;
+
+        template <typename Env>
+        struct result
+        {
+            typedef typename
+                attributes_of<typename
+                    mpl::at_c<typename Env::args_type, 1>::type
+                >::type
+            attributes_type;
+
+            typedef typename
+                fusion::result_of::size<attributes_type>::type
+            attributes_size;
+
+            // report invalid argument not found (N is out of bounds)
+            BOOST_MPL_ASSERT_MSG(
+                (N < attributes_size::value),
+                index_is_out_of_bounds, ());
+
+            typedef typename
+                fusion::result_of::at_c<attributes_type, N>::type
+            type;
+        };
+
+        template <typename Env>
+        typename result<Env>::type
+        eval(Env const& env) const
+        {
+            return fusion::at_c<N>((fusion::at_c<1>(env.args())).attributes);
+        }
+    };
+
+    template <int N>
+    struct local_variable
+    {
+        typedef mpl::true_ no_nullary;
+
+        template <typename Env>
+        struct result
+        {
+            typedef typename
+                locals_of<typename
+                    mpl::at_c<typename Env::args_type, 1>::type
+                >::type
+            locals_type;
+
+            typedef typename
+                fusion::result_of::size<locals_type>::type
+            locals_size;
+
+            // report invalid argument not found (N is out of bounds)
+            BOOST_MPL_ASSERT_MSG(
+                (N < locals_size::value),
+                index_is_out_of_bounds, ());
+
+            typedef typename
+                fusion::result_of::at_c<locals_type, N>::type
+            type;
+        };
+
+        template <typename Env>
+        typename result<Env>::type
+        eval(Env const& env) const
+        {
+            return get_arg<N>((fusion::at_c<1>(env.args())).locals);
+        }
+    };
+
+    // _val refers to the 'return' value of a rule (same as _r0)
+    // _r1, _r2, ... refer to the rule arguments
+    phoenix::actor<attribute<0> > const _val = attribute<0>();
+    phoenix::actor<attribute<0> > const _r0 = attribute<0>();
+    phoenix::actor<attribute<1> > const _r1 = attribute<1>();
+    phoenix::actor<attribute<2> > const _r2 = attribute<2>();
+
+    //  Bring in the rest of the attributes (_4 .. _N+1), using PP
+    BOOST_PP_REPEAT_FROM_TO(
+        3, SPIRIT_ATTRIBUTES_LIMIT, SPIRIT_DECLARE_ATTRIBUTE, _)
+
+    // _a, _b, ... refer to the local variables of a rule
+    phoenix::actor<local_variable<0> > const _a = local_variable<0>();
+    phoenix::actor<local_variable<1> > const _b = local_variable<1>();
+    phoenix::actor<local_variable<2> > const _c = local_variable<2>();
+    phoenix::actor<local_variable<3> > const _d = local_variable<3>();
+    phoenix::actor<local_variable<4> > const _e = local_variable<4>();
+    phoenix::actor<local_variable<5> > const _f = local_variable<5>();
+    phoenix::actor<local_variable<6> > const _g = local_variable<6>();
+    phoenix::actor<local_variable<7> > const _h = local_variable<7>();
+    phoenix::actor<local_variable<8> > const _i = local_variable<8>();
+    phoenix::actor<local_variable<9> > const _j = local_variable<9>();
+
+    // You can bring these in with the using directive
+    // without worrying about bringing in too much.
+    namespace labels
+    {
+        BOOST_PP_REPEAT(SPIRIT_ARGUMENTS_LIMIT, SPIRIT_USING_ARGUMENT, _)
+        BOOST_PP_REPEAT(SPIRIT_ATTRIBUTES_LIMIT, SPIRIT_USING_ATTRIBUTE, _)
+        using spirit::_val;
+        using spirit::_a;
+        using spirit::_b;
+        using spirit::_c;
+        using spirit::_d;
+        using spirit::_e;
+        using spirit::_f;
+        using spirit::_g;
+        using spirit::_h;
+        using spirit::_i;
+        using spirit::_j;
+    }
+}}
+
+#endif
Deleted: trunk/boost/spirit/home/support/detail/action_dispatch.hpp
==============================================================================
--- trunk/boost/spirit/home/support/detail/action_dispatch.hpp	2009-04-26 10:42:24 EDT (Sun, 26 Apr 2009)
+++ (empty file)
@@ -1,96 +0,0 @@
-/*=============================================================================
-    Copyright (c) 2001-2008 Joel de Guzman
-    Copyright (c) 2001-2008 Hartmut Kaiser
-    http://spirit.sourceforge.net/
-
-    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_ACTION_DISPATCH_APR_18_2008_0720AM)
-#define BOOST_SPIRIT_ACTION_DISPATCH_APR_18_2008_0720AM
-
-#include <boost/spirit/home/support/detail/values.hpp>
-#include <boost/spirit/home/phoenix/core/actor.hpp>
-
-namespace boost { namespace spirit { namespace detail
-{
-    // general handler for everything not explicitly specialized below
-    template <typename F, typename Attribute, typename Context, bool IsSequence>
-    bool action_dispatch(F const& f, Attribute& attr, Context& context
-      , mpl::bool_<IsSequence>)
-    {
-        bool pass = true;
-        f(attr, context, pass);
-        return pass;
-    }
-
-    // handler for phoenix actors
-
-    // If the component this action has to be invoked for is a sequence, we 
-    // wrap any non-fusion sequence into a fusion sequence (done by pass_value)
-    // and pass through any fusion sequence.
-    template <typename Eval, typename Attribute, typename Context>
-    bool action_dispatch(phoenix::actor<Eval> const& f
-      , Attribute& attr, Context& context, mpl::true_)
-    {
-        bool pass = true;
-        f (pass_value<Attribute>::call(attr), context, pass);
-        return pass;
-    }
-
-    // If this action has to be invoked for anything but a sequence, we always 
-    // need to wrap the attribute into a fusion sequence, because the attribute
-    // has to be treated as being a single value in any case (even if it 
-    // actually already is a fusion sequence on its own).
-    template <typename Eval, typename Attribute, typename Context>
-    bool action_dispatch(phoenix::actor<Eval> const& f
-      , Attribute& attr, Context& context, mpl::false_)
-    {
-        bool pass = true;
-        fusion::vector<Attribute&> wrapped_attr(attr);
-        f (wrapped_attr, context, pass);
-        return pass;
-    }
-
-    // specializations for plain function pointers taking a different number of
-    // arguments
-    template <typename RT, typename A0, typename A1, typename A2
-      , typename Attribute, typename Context, bool IsSequence>
-    bool action_dispatch(RT(*f)(A0, A1, A2)
-      , Attribute& attr, Context& context, mpl::bool_<IsSequence>)
-    {
-        bool pass = true;
-        f(attr, context, pass);
-        return pass;
-    }
-
-    template <typename RT, typename A0, typename A1
-      , typename Attribute, typename Context, bool IsSequence>
-    bool action_dispatch(RT(*f)(A0, A1)
-      , Attribute& attr, Context& context, mpl::bool_<IsSequence>)
-    {
-        f(attr, context);
-        return true;
-    }
-
-    template <typename RT, typename A0
-      , typename Attribute, typename Context, bool IsSequence>
-    bool action_dispatch(RT(*f)(A0)
-      , Attribute& attr, Context&, mpl::bool_<IsSequence>)
-    {
-        f(attr);
-        return true;
-    }
-
-    template <typename RT
-      , typename Attribute, typename Context, bool IsSequence>
-    bool action_dispatch(RT(*f)()
-      , Attribute&, Context&, mpl::bool_<IsSequence>)
-    {
-        f();
-        return true;
-    }
-    
-}}}
-
-#endif
Added: trunk/boost/spirit/home/support/detail/as_variant.hpp
==============================================================================
--- (empty file)
+++ trunk/boost/spirit/home/support/detail/as_variant.hpp	2009-04-26 10:42:24 EDT (Sun, 26 Apr 2009)
@@ -0,0 +1,104 @@
+/*=============================================================================
+    Copyright (c) 2001-2009 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)
+==============================================================================*/
+#ifndef BOOST_PP_IS_ITERATING
+#if !defined(BOOST_SPIRIT_AS_VARIANT_NOVEMBER_16_2007_0420PM)
+#define BOOST_SPIRIT_AS_VARIANT_NOVEMBER_16_2007_0420PM
+
+#include <boost/preprocessor/iterate.hpp>
+#include <boost/preprocessor/repetition/enum_params.hpp>
+#include <boost/preprocessor/repetition/enum_binary_params.hpp>
+#include <boost/preprocessor/repetition/enum_params_with_a_default.hpp>
+#include <boost/preprocessor/repetition/repeat_from_to.hpp>
+#include <boost/variant/variant_fwd.hpp>
+#include <boost/fusion/include/size.hpp>
+#include <boost/fusion/include/begin.hpp>
+#include <boost/fusion/include/next.hpp>
+#include <boost/fusion/include/value_of.hpp>
+#include <boost/mpl/fold.hpp>
+#include <boost/mpl/vector.hpp>
+#include <boost/mpl/push_back.hpp>
+#include <boost/mpl/equal_to.hpp>
+#include <boost/mpl/contains.hpp>
+#include <boost/type_traits/is_same.hpp>
+
+namespace boost { namespace spirit { namespace detail
+{
+    template <int size>
+    struct as_variant_impl;
+
+    template <>
+    struct as_variant_impl<0>
+    {
+        template <typename Iterator>
+        struct apply
+        {
+            typedef variant<> type;
+        };
+    };
+
+#define BOOST_FUSION_NEXT_ITERATOR(z, n, data)                                  \
+    typedef typename fusion::result_of::next<BOOST_PP_CAT(I, n)>::type          \
+        BOOST_PP_CAT(I, BOOST_PP_INC(n));
+
+#define BOOST_FUSION_NEXT_CALL_ITERATOR(z, n, data)                             \
+    typename gen::BOOST_PP_CAT(I, BOOST_PP_INC(n))                              \
+        BOOST_PP_CAT(i, BOOST_PP_INC(n)) = fusion::next(BOOST_PP_CAT(i, n));
+
+#define BOOST_FUSION_VALUE_OF_ITERATOR(z, n, data)                              \
+    typedef typename fusion::result_of::value_of<BOOST_PP_CAT(I, n)>::type      \
+        BOOST_PP_CAT(T, n);
+
+#define BOOST_PP_FILENAME_1 <boost/spirit/home/support/detail/as_variant.hpp>
+#define BOOST_PP_ITERATION_LIMITS (1, BOOST_VARIANT_LIMIT_TYPES)
+#include BOOST_PP_ITERATE()
+
+#undef BOOST_FUSION_NEXT_ITERATOR
+#undef BOOST_FUSION_NEXT_CALL_ITERATOR
+#undef BOOST_FUSION_VALUE_OF_ITERATOR
+
+    template <typename Sequence>
+    struct as_variant
+    {
+        // build a variant generator being able to generate a variant holding
+        // all of the types as given in the typelist
+        typedef typename
+            detail::as_variant_impl<fusion::result_of::size<Sequence>::value>
+        gen;
+
+        // use this generator to create the actual variant
+        typedef typename gen::template apply<
+                typename fusion::result_of::begin<Sequence>::type
+            >::type
+        type;
+    };
+}}}
+
+#endif
+#else // defined(BOOST_PP_IS_ITERATING)
+///////////////////////////////////////////////////////////////////////////////
+//
+//  Preprocessor vertical repetition code
+//
+///////////////////////////////////////////////////////////////////////////////
+
+#define N BOOST_PP_ITERATION()
+
+    template <>
+    struct as_variant_impl<N>
+    {
+        template <typename I0>
+        struct apply
+        {
+            BOOST_PP_REPEAT(N, BOOST_FUSION_NEXT_ITERATOR, _)
+            BOOST_PP_REPEAT(N, BOOST_FUSION_VALUE_OF_ITERATOR, _)
+            typedef variant<BOOST_PP_ENUM_PARAMS(N, T)> type;
+        };
+    };
+
+#undef N
+#endif // defined(BOOST_PP_IS_ITERATING)
+
Deleted: trunk/boost/spirit/home/support/detail/container.hpp
==============================================================================
--- trunk/boost/spirit/home/support/detail/container.hpp	2009-04-26 10:42:24 EDT (Sun, 26 Apr 2009)
+++ (empty file)
@@ -1,186 +0,0 @@
-/*=============================================================================
-    Copyright (c) 2001-2007 Joel de Guzman
-    Copyright (c) 2001-2009 Hartmut Kaiser
-    http://spirit.sourceforge.net/
-
-    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_CONTAINER_FEB_06_2007_1001AM)
-#define BOOST_SPIRIT_CONTAINER_FEB_06_2007_1001AM
-
-#include <boost/spirit/home/support/unused.hpp>
-#include <boost/detail/iterator.hpp> // for boost::detail::iterator_traits
-
-namespace boost { namespace spirit { namespace container
-{
-    ///////////////////////////////////////////////////////////////////////////
-    //  This file contains some container utils for stl containers. The
-    //  utilities provided also accept spirit's unused_type; all no-ops.
-    //  Compiler optimization will easily strip these away.
-    ///////////////////////////////////////////////////////////////////////////
-
-    namespace result_of 
-    {
-        template <typename Container>
-        struct value
-        {
-            typedef typename Container::value_type type;
-        };
-
-        template <>
-        struct value<unused_type>
-        {
-            typedef unused_type type;
-        };
-
-        template <>
-        struct value<unused_type const>
-        {
-            typedef unused_type type;
-        };
-
-        template <typename Container>
-        struct iterator
-        {
-            typedef typename Container::iterator type;
-        };
-        
-        template <typename Container>
-        struct iterator<Container const>
-        {
-            typedef typename Container::const_iterator type;
-        };
-        
-        template <>
-        struct iterator<unused_type>
-        {
-            typedef unused_type const* type;
-        };
-
-        template <>
-        struct iterator<unused_type const>
-        {
-            typedef unused_type const* type;
-        };
-    }
-    
-    ///////////////////////////////////////////////////////////////////////////
-    template <typename Container, typename T>
-    inline void push_back(Container& c, T const& val)
-    {
-        c.push_back(val);
-    }
-
-    template <typename Container>
-    inline void push_back(Container&, unused_type)
-    {
-    }
-    
-    template <typename T>
-    inline void push_back(unused_type, T const&)
-    {
-    }
-    
-    inline void push_back(unused_type, unused_type)
-    {
-    }
-    
-    ///////////////////////////////////////////////////////////////////////////
-    template <typename Container>
-    inline typename result_of::iterator<Container>::type
-    begin(Container& c)
-    {
-        return c.begin();
-    }
-    
-    template <typename Container>
-    inline typename result_of::iterator<Container const>::type
-    begin(Container const& c)
-    {
-        return c.begin();
-    }
-    
-    inline unused_type const*
-    begin(unused_type)
-    {
-        return &unused;
-    }
-    
-    template <typename Container>
-    inline typename result_of::iterator<Container>::type
-    end(Container& c)
-    {
-        return c.end();
-    }
-
-    template <typename Container>
-    inline typename result_of::iterator<Container const>::type
-    end(Container const& c)
-    {
-        return c.end();
-    }
-
-    inline unused_type const*
-    end(unused_type)
-    {
-        return &unused;
-    }
-
-    ///////////////////////////////////////////////////////////////////////////
-    template <typename Iterator>
-    inline typename boost::detail::iterator_traits<Iterator>::value_type
-    deref(Iterator& it)
-    {
-        return *it;
-    }
-    
-    inline unused_type
-    deref(unused_type*)
-    {
-        return unused;
-    }
-    
-    inline unused_type
-    deref(unused_type const*)
-    {
-        return unused;
-    }
-    
-    ///////////////////////////////////////////////////////////////////////////
-    template <typename Iterator>
-    inline Iterator
-    next(Iterator& it)
-    {
-        return ++it;
-    }
-    
-    inline unused_type
-    next(unused_type*)
-    {
-        return &unused;
-    }
-        
-    inline unused_type
-    next(unused_type const*)
-    {
-        return &unused;
-    }
-        
-    ///////////////////////////////////////////////////////////////////////////
-    template <typename Iterator>
-    inline bool
-    compare(Iterator const& it1, Iterator const& it2)
-    {
-        return it1 == it2;
-    }
-    
-    inline bool
-    compare(unused_type*, unused_type*)
-    {
-        return true;
-    }
-        
-}}}
-
-#endif
Added: trunk/boost/spirit/home/support/detail/endian.hpp
==============================================================================
--- (empty file)
+++ trunk/boost/spirit/home/support/detail/endian.hpp	2009-04-26 10:42:24 EDT (Sun, 26 Apr 2009)
@@ -0,0 +1,27 @@
+//  Copyright (c) 2001-2009 Hartmut Kaiser
+//  http://spirit.sourceforge.net/
+// 
+//  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(SPIRIT_ENDIAN_MAR_21_2009_0349PM)
+#define SPIRIT_ENDIAN_MAR_21_2009_0349PM
+
+#if defined(_MSC_VER)
+#pragma once
+#endif
+
+#include <boost/version.hpp>
+
+// We need to treat the endian number types as PODs
+#define BOOST_ENDIAN_FORCE_PODNESS
+
+// If Boost has the endian library use it, otherwise use an adapted version 
+// included with Spirit
+#if BOOST_VERSION >= 104000
+#include <boost/integer/endian.hpp>
+#else
+#include <boost/spirit/home/support/detail/integer/endian.hpp>
+#endif
+
+#endif
Added: trunk/boost/spirit/home/support/detail/get_encoding.hpp
==============================================================================
--- (empty file)
+++ trunk/boost/spirit/home/support/detail/get_encoding.hpp	2009-04-26 10:42:24 EDT (Sun, 26 Apr 2009)
@@ -0,0 +1,27 @@
+//  Copyright (c) 2001-2009 Hartmut Kaiser
+//  Copyright (c) 2001-2009 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_GET_ENCODING_JANUARY_13_2009_1255PM)
+#define BOOST_SPIRIT_GET_ENCODING_JANUARY_13_2009_1255PM
+
+#if defined(_MSC_VER)
+#pragma once
+#endif
+
+#include <boost/mpl/identity.hpp>
+
+namespace boost { namespace spirit { namespace detail
+{
+    template <typename Modifiers, typename Encoding, bool case_modifier = false>
+    struct get_encoding : mpl::identity<Encoding> {};
+
+    template <typename Modifiers, typename Encoding>
+    struct get_encoding<Modifiers, Encoding, true>
+      : mpl::identity<typename Modifiers::char_encoding> {};
+
+}}}
+
+#endif
Modified: trunk/boost/spirit/home/support/detail/hold_any.hpp
==============================================================================
--- trunk/boost/spirit/home/support/detail/hold_any.hpp	(original)
+++ trunk/boost/spirit/home/support/detail/hold_any.hpp	2009-04-26 10:42:24 EDT (Sun, 26 Apr 2009)
@@ -1,15 +1,16 @@
-//  Copyright (c) 2008-2009 Hartmut Kaiser
-//  Copyright (c) Christopher Diggins 2005
-//  Copyright (c) Pablo Aguilar 2005
-//  Copyright (c) Kevlin Henney 2001
-//
-//  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)
-//
-//  The class boost::spirit::hold_any is built based on the any class
-//  published here: http://www.codeproject.com/cpp/dynamic_typing.asp. It adds
-//  support for std streaming operator<<() and operator>>().
-
+/*=============================================================================
+    Copyright (c) 2007-2009 Hartmut Kaiser
+    Copyright (c) Christopher Diggins 2005
+    Copyright (c) Pablo Aguilar 2005
+    Copyright (c) Kevlin Henney 2001
+
+    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)
+
+    The class boost::spirit::hold_any is built based on the any class
+    published here: http://www.codeproject.com/cpp/dynamic_typing.asp. It adds
+    support for std streaming operator<<() and operator>>().
+==============================================================================*/
 #if !defined(BOOST_SPIRIT_HOLD_ANY_MAY_02_2007_0857AM)
 #define BOOST_SPIRIT_HOLD_ANY_MAY_02_2007_0857AM
 
@@ -27,11 +28,11 @@
 #include <iosfwd>
 
 ///////////////////////////////////////////////////////////////////////////////
-#if BOOST_WORKAROUND(BOOST_MSVC, >= 1400)  
-# pragma warning(push)  
-# pragma warning(disable: 4100)   // 'x': unreferenced formal parameter  
+#if BOOST_WORKAROUND(BOOST_MSVC, >= 1400)
+# pragma warning(push)
+# pragma warning(disable: 4100)   // 'x': unreferenced formal parameter
 # pragma warning(disable: 4127)   // conditional expression is constant
-#endif 
+#endif
 
 ///////////////////////////////////////////////////////////////////////////////
 namespace boost { namespace spirit
@@ -253,7 +254,7 @@
         hold_any& assign(T const& x)
         {
             // are we copying between the same type?
-            spirit::detail::fxn_ptr_table* x_table = 
+            spirit::detail::fxn_ptr_table* x_table =
                 spirit::detail::get_table<T>::get();
             if (table == x_table) {
             // if so, we can avoid deallocating and re-use memory
@@ -271,7 +272,7 @@
                 if (spirit::detail::get_table<T>::is_small::value) {
                     // create copy on-top of object pointer itself
                     table->destruct(&object); // first destruct the old content
-                    new (&object) T(x); 
+                    new (&object) T(x);
                 }
                 else {
                     reset();                  // first delete the old content
@@ -418,8 +419,8 @@
 }}    // namespace boost::spirit
 
 ///////////////////////////////////////////////////////////////////////////////
-#if BOOST_WORKAROUND(BOOST_MSVC, >= 1400)  
-# pragma warning(pop)  
-#endif 
+#if BOOST_WORKAROUND(BOOST_MSVC, >= 1400)
+# pragma warning(pop)
+#endif
 
 #endif
Modified: trunk/boost/spirit/home/support/detail/integer/cover_operators.hpp
==============================================================================
--- trunk/boost/spirit/home/support/detail/integer/cover_operators.hpp	(original)
+++ trunk/boost/spirit/home/support/detail/integer/cover_operators.hpp	2009-04-26 10:42:24 EDT (Sun, 26 Apr 2009)
@@ -1,16 +1,28 @@
 //  boost/integer/cover_operators.hpp ----------------------------------------//
 
-//  (C) Copyright Darin Adler 2000
+//  Copyright Darin Adler 2000
+//  Copyright Beman Dawes 2008
 
 //  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 the class being covered has a non-explicit conversion to an integer type
+//  then a smaller number of cover operations are needed. Define the macro
+//  BOOST_MINIMAL_INTEGER_COVER_OPERATORS to indicate this.
+
+//  Define BOOST_NO_IO_COVER_OPERATORS if I/O cover operations are not desired.
+
+//----------------------------------------------------------------------------//
+
 #ifndef BOOST_INTEGER_COVER_OPERATORS_HPP
 #define BOOST_INTEGER_COVER_OPERATORS_HPP
 
-#include <boost/operators.hpp>
+# ifndef BOOST_MINIMAL_INTEGER_COVER_OPERATORS
+#   include <boost/operators.hpp>
+# endif
+
 #include <iosfwd>
 
 namespace boost
@@ -21,13 +33,17 @@
   // A class that adds integer operators to an integer cover class
 
     template <typename T, typename IntegerType>
-    class cover_operators : boost::operators<T>
+    class cover_operators
+#    ifndef BOOST_MINIMAL_INTEGER_COVER_OPERATORS
+      : boost::operators<T>
+#    endif
     {
       // The other operations take advantage of the type conversion that's
       // built into unary +.
 
       // Unary operations.
       friend IntegerType operator+(const T& x) { return x; }
+#   ifndef BOOST_MINIMAL_INTEGER_COVER_OPERATORS
       friend IntegerType operator-(const T& x) { return -+x; }
       friend IntegerType operator~(const T& x) { return ~+x; }
       friend IntegerType operator!(const T& x) { return !+x; }
@@ -35,6 +51,7 @@
       // The basic ordering operations.
       friend bool operator==(const T& x, IntegerType y) { return +x == y; }
       friend bool operator<(const T& x, IntegerType y) { return +x < y; }
+#   endif
       
       // The basic arithmetic operations.
       friend T& operator+=(T& x, IntegerType y) { return x = +x + y; }
@@ -57,8 +74,24 @@
       friend T& operator++(T& x) { return x += 1; }
       friend T& operator--(T& x) { return x -= 1; }
 
-  /// TODO: stream I/O needs to be templatized on the stream type, so will
-  /// work with wide streams, etc.
+#   ifdef BOOST_MINIMAL_INTEGER_COVER_OPERATORS
+      friend T operator++(T& x, int)
+      { 
+        T tmp(x);
+        x += 1;
+        return tmp;
+      }
+      friend T operator--(T& x, int)
+      { 
+        T tmp(x);
+        x -= 1;
+        return tmp;
+      }
+#   endif
+
+#   ifndef BOOST_NO_IO_COVER_OPERATORS
+  // TODO: stream I/O needs to be templatized on the stream type, so will
+  // work with wide streams, etc.
 
       // Stream input and output.
       friend std::ostream& operator<<(std::ostream& s, const T& x)
@@ -70,6 +103,7 @@
             x = i;
           return s;
         }
+#   endif
     };
   } // namespace integer
 } // namespace boost
Modified: trunk/boost/spirit/home/support/detail/integer/endian.hpp
==============================================================================
--- trunk/boost/spirit/home/support/detail/integer/endian.hpp	(original)
+++ trunk/boost/spirit/home/support/detail/integer/endian.hpp	2009-04-26 10:42:24 EDT (Sun, 26 Apr 2009)
@@ -1,29 +1,45 @@
-//  Boost endian.hpp header file (proposed) ----------------------------------//
+//  Boost endian.hpp header file -------------------------------------------------------//
 
 //  (C) Copyright Darin Adler 2000
-//  (C) Copyright Beman Dawes 2006
+//  (C) Copyright Beman Dawes 2006, 2009
 
-//  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)
+//  Distributed under the Boost Software License, Version 1.0.
+//  See http://www.boost.org/LICENSE_1_0.txt
 
 //  See library home page at http://www.boost.org/libs/endian
 
-//----------------------------------------------------------------------------//
+//--------------------------------------------------------------------------------------//
 
 //  Original design developed by Darin Adler based on classes developed by Mark
-//  Borgerding. Four original class templates combined into a single endian
+//  Borgerding. Four original class templates were combined into a single endian
 //  class template by Beman Dawes, who also added the unrolled_byte_loops sign
 //  partial specialization to correctly extend the sign when cover integer size
 //  differs from endian representation size.
 
-#ifndef BOOST_ENDIAN_HPP
-#define BOOST_ENDIAN_HPP
+// TODO: When a compiler supporting constexpr becomes available, try possible uses.
 
+#ifndef BOOST_SPIRIT_ENDIAN_HPP
+#define BOOST_SPIRIT_ENDIAN_HPP
+
+#ifdef BOOST_ENDIAN_LOG
+# include <iostream>
+#endif
+
+#if defined(__BORLANDC__) || defined( __CODEGEARC__)
+# pragma pack(push, 1)
+#endif
+
+#include <boost/config.hpp>
 #include <boost/detail/endian.hpp>
+#define BOOST_MINIMAL_INTEGER_COVER_OPERATORS
+#define BOOST_NO_IO_COVER_OPERATORS
 #include <boost/spirit/home/support/detail/integer/cover_operators.hpp>
+#undef  BOOST_NO_IO_COVER_OPERATORS
+#undef  BOOST_MINIMAL_INTEGER_COVER_OPERATORS
 #include <boost/type_traits/is_signed.hpp>
 #include <boost/cstdint.hpp>
 #include <boost/static_assert.hpp>
+#include <boost/spirit/home/support/detail/scoped_enum_emulation.hpp>
 #include <iosfwd>
 #include <climits>
 
@@ -31,6 +47,13 @@
 #   error Platforms with CHAR_BIT != 8 are not supported
 # endif
 
+# define BOOST_ENDIAN_DEFAULT_CONSTRUCT {}          // C++03
+
+# if defined(BOOST_ENDIAN_FORCE_PODNESS)
+#   define BOOST_ENDIAN_NO_CTORS
+# endif
+
+
 namespace boost
 {
   namespace detail
@@ -124,14 +147,18 @@
   namespace integer
   {
 
-  //  endian class template and specializations  -----------------------------//
+# ifdef BOOST_ENDIAN_LOG
+    bool endian_log(true);
+# endif
+
 
-    enum endianness { big, little, native };
+  //  endian class template and specializations  ---------------------------------------//
 
-    enum alignment { unaligned, aligned };
+  BOOST_SCOPED_ENUM_START(endianness) { big, little, native }; BOOST_SCOPED_ENUM_END
+  BOOST_SCOPED_ENUM_START(alignment) { unaligned, aligned }; BOOST_SCOPED_ENUM_END
 
-    template <endianness E, typename T, std::size_t n_bits,
-      alignment A = unaligned>
+  template <BOOST_SCOPED_ENUM(endianness) E, typename T, std::size_t n_bits,
+    BOOST_SCOPED_ENUM(alignment) A = alignment::unaligned>
     class endian;
 
     //  Specializations that represent unaligned bytes.
@@ -139,164 +166,217 @@
     //  the size and signedness of the desired integer and get the appropriate
     //  corresponding integer type for the interface.
 
+    //  unaligned big endian specialization
     template <typename T, std::size_t n_bits>
-    class endian< big, T, n_bits, unaligned >
-      : cover_operators< endian< big, T, n_bits >, T >
+    class endian< endianness::big, T, n_bits, alignment::unaligned >
+      : cover_operators< endian< endianness::big, T, n_bits >, T >
     {
         BOOST_STATIC_ASSERT( (n_bits/8)*8 == n_bits );
       public:
         typedef T value_type;
-        endian() {}
-        endian(T i) { detail::store_big_endian<T, n_bits/8>(bytes, i); }
-        operator T() const 
-          { return detail::load_big_endian<T, n_bits/8>(bytes); }
+#     ifndef BOOST_ENDIAN_NO_CTORS
+        endian() BOOST_ENDIAN_DEFAULT_CONSTRUCT
+        explicit endian(T val)
+        { 
+#       ifdef BOOST_ENDIAN_LOG
+          if ( endian_log )
+            std::clog << "big, unaligned, " << n_bits << "-bits, construct(" << val << ")\n";
+#       endif
+          detail::store_big_endian<T, n_bits/8>(m_value, val);
+        }
+#     endif
+        endian & operator=(T val) { detail::store_big_endian<T, n_bits/8>(m_value, val); return *this; }
+        operator T() const
+        { 
+#       ifdef BOOST_ENDIAN_LOG
+          if ( endian_log )
+            std::clog << "big, unaligned, " << n_bits << "-bits, convert(" << detail::load_big_endian<T, n_bits/8>(m_value) << ")\n";
+#       endif
+          return detail::load_big_endian<T, n_bits/8>(m_value);
+        }
       private:
-        char bytes[n_bits/8];
+  	    char m_value[n_bits/8];
     };
 
+    //  unaligned little endian specialization
     template <typename T, std::size_t n_bits>
-    class endian< little, T, n_bits, unaligned >
-      : cover_operators< endian< little, T, n_bits >, T >
+    class endian< endianness::little, T, n_bits, alignment::unaligned >
+      : cover_operators< endian< endianness::little, T, n_bits >, T >
     {
         BOOST_STATIC_ASSERT( (n_bits/8)*8 == n_bits );
       public:
         typedef T value_type;
-        endian() {}
-        endian(T i) { detail::store_little_endian<T, n_bits/8>(bytes, i); }
+#     ifndef BOOST_ENDIAN_NO_CTORS
+        endian() BOOST_ENDIAN_DEFAULT_CONSTRUCT
+        explicit endian(T val)
+        { 
+#       ifdef BOOST_ENDIAN_LOG
+          if ( endian_log )
+            std::clog << "little, unaligned, " << n_bits << "-bits, construct(" << val << ")\n";
+#       endif
+          detail::store_little_endian<T, n_bits/8>(m_value, val);
+        }
+#     endif
+        endian & operator=(T val) { detail::store_little_endian<T, n_bits/8>(m_value, val); return *this; }
         operator T() const
-          { return detail::load_little_endian<T, n_bits/8>(bytes); }
+        { 
+#       ifdef BOOST_ENDIAN_LOG
+          if ( endian_log )
+            std::clog << "little, unaligned, " << n_bits << "-bits, convert(" << detail::load_little_endian<T, n_bits/8>(m_value) << ")\n";
+#       endif
+          return detail::load_little_endian<T, n_bits/8>(m_value);
+        }
       private:
-        char bytes[n_bits/8];
+  	    char m_value[n_bits/8];
     };
 
+    //  unaligned native endian specialization
     template <typename T, std::size_t n_bits>
-    class endian< native, T, n_bits, unaligned >
-      : cover_operators< endian< native, T, n_bits >, T >
+    class endian< endianness::native, T, n_bits, alignment::unaligned >
+      : cover_operators< endian< endianness::native, T, n_bits >, T >
     {
         BOOST_STATIC_ASSERT( (n_bits/8)*8 == n_bits );
       public:
         typedef T value_type;
-        endian() {}
+#   ifndef BOOST_ENDIAN_NO_CTORS
+        endian() BOOST_ENDIAN_DEFAULT_CONSTRUCT
 #     ifdef BOOST_BIG_ENDIAN
-        endian(T i) { detail::store_big_endian<T, n_bits/8>(bytes, i); }
-        operator T() const
-          { return detail::load_big_endian<T, n_bits/8>(bytes); }
+        explicit endian(T val)    { detail::store_big_endian<T, n_bits/8>(m_value, val); }
 #     else
-        endian(T i) { detail::store_little_endian<T, n_bits/8>(bytes, i); }
-        operator T() const
-          { return detail::load_little_endian<T, n_bits/8>(bytes); }
+        explicit endian(T val)    { detail::store_little_endian<T, n_bits/8>(m_value, val); }
 #     endif
+#   endif
+#   ifdef BOOST_BIG_ENDIAN  
+        endian & operator=(T val) { detail::store_big_endian<T, n_bits/8>(m_value, val); return *this; }
+        operator T() const        { return detail::load_big_endian<T, n_bits/8>(m_value); }
+#   else
+        endian & operator=(T val) { detail::store_little_endian<T, n_bits/8>(m_value, val); return *this; }
+        operator T() const        { return detail::load_little_endian<T, n_bits/8>(m_value); }
+#   endif
       private:
-        char bytes[n_bits/8];
+  	    char m_value[n_bits/8];
     };
 
     //  Specializations that mimic built-in integer types.
     //  These typically have the same alignment as the underlying types.
 
+    //  aligned big endian specialization
     template <typename T, std::size_t n_bits>
-    class endian< big, T, n_bits, aligned  >
-      : cover_operators< endian< big, T, n_bits, aligned >, T >
+    class endian< endianness::big, T, n_bits, alignment::aligned  >
+      : cover_operators< endian< endianness::big, T, n_bits, alignment::aligned >, T >
     {
         BOOST_STATIC_ASSERT( (n_bits/8)*8 == n_bits );
         BOOST_STATIC_ASSERT( sizeof(T) == n_bits/8 );
       public:
         typedef T value_type;
-        endian() {}
-    #ifdef BOOST_BIG_ENDIAN
-        endian(T i) : integer(i) { }
-        operator T() const { return integer; }
-    #else
-        endian(T i) { detail::store_big_endian<T, sizeof(T)>(&integer, i); }
-        operator T() const
-          { return detail::load_big_endian<T, sizeof(T)>(&integer); }
-    #endif
+#   ifndef BOOST_ENDIAN_NO_CTORS
+        endian() BOOST_ENDIAN_DEFAULT_CONSTRUCT
+#     ifdef BOOST_BIG_ENDIAN
+        endian(T val) : m_value(val) { }
+#     else
+        explicit endian(T val)    { detail::store_big_endian<T, sizeof(T)>(&m_value, val); }
+#     endif
+#   endif
+#   ifdef BOOST_BIG_ENDIAN  
+        endian & operator=(T val) { m_value = val); return *this; }
+        operator T() const        { return m_value; }
+#   else  
+        endian & operator=(T val) { detail::store_big_endian<T, sizeof(T)>(&m_value, val); return *this; }
+        operator T() const        { return detail::load_big_endian<T, sizeof(T)>(&m_value); }
+#   endif  
       private:
-       T integer;
+  	    T m_value;
     };
 
+    //  aligned little endian specialization
     template <typename T, std::size_t n_bits>
-    class endian< little, T, n_bits, aligned  >
-      : cover_operators< endian< little, T, n_bits, aligned >, T >
+    class endian< endianness::little, T, n_bits, alignment::aligned  >
+      : cover_operators< endian< endianness::little, T, n_bits, alignment::aligned >, T >
     {
         BOOST_STATIC_ASSERT( (n_bits/8)*8 == n_bits );
         BOOST_STATIC_ASSERT( sizeof(T) == n_bits/8 );
       public:
         typedef T value_type;
-        endian() {}
-    #ifdef BOOST_LITTLE_ENDIAN
-        endian(T i) : integer(i) { }
-        operator T() const { return integer; }
+#   ifndef BOOST_ENDIAN_NO_CTORS
+        endian() BOOST_ENDIAN_DEFAULT_CONSTRUCT
+#     ifdef BOOST_LITTLE_ENDIAN
+        endian(T val) : m_value(val) { }
+#     else
+        explicit endian(T val)    { detail::store_little_endian<T, sizeof(T)>(&m_value, val); }
+#     endif
+#   endif
+#   ifdef BOOST_LITTLE_ENDIAN
+        endian & operator=(T val) { m_value = val; return *this; }
+        operator T() const        { return m_value; }
     #else
-        endian(T i)
-          { detail::store_little_endian<T, sizeof(T)>(&integer, i); }
-        operator T() const
-          { return detail::load_little_endian<T, sizeof(T)>(&integer); }
+        endian & operator=(T val) { detail::store_little_endian<T, sizeof(T)>(&m_value, val); return *this; }
+        operator T() const        { return detail::load_little_endian<T, sizeof(T)>(&m_value); }
     #endif
       private:
-        T integer;
+  	    T m_value;
     };
 
-  //  naming convention typedefs  --------------------------------------------//
+  //  naming convention typedefs  ------------------------------------------------------//
 
     // unaligned big endian signed integer types
-    typedef endian< big, int_least8_t, 8 >           big8_t;
-    typedef endian< big, int_least16_t, 16 >         big16_t;
-    typedef endian< big, int_least32_t, 24 >         big24_t;
-    typedef endian< big, int_least32_t, 32 >         big32_t;
-    typedef endian< big, int_least64_t, 40 >         big40_t;
-    typedef endian< big, int_least64_t, 48 >         big48_t;
-    typedef endian< big, int_least64_t, 56 >         big56_t;
-    typedef endian< big, int_least64_t, 64 >         big64_t;
+    typedef endian< endianness::big, int_least8_t, 8 >           big8_t;
+    typedef endian< endianness::big, int_least16_t, 16 >         big16_t;
+    typedef endian< endianness::big, int_least32_t, 24 >         big24_t;
+    typedef endian< endianness::big, int_least32_t, 32 >         big32_t;
+    typedef endian< endianness::big, int_least64_t, 40 >         big40_t;
+    typedef endian< endianness::big, int_least64_t, 48 >         big48_t;
+    typedef endian< endianness::big, int_least64_t, 56 >         big56_t;
+    typedef endian< endianness::big, int_least64_t, 64 >         big64_t;
 
     // unaligned big endian unsigned integer types
-    typedef endian< big, uint_least8_t, 8 >          ubig8_t;
-    typedef endian< big, uint_least16_t, 16 >        ubig16_t;
-    typedef endian< big, uint_least32_t, 24 >        ubig24_t;
-    typedef endian< big, uint_least32_t, 32 >        ubig32_t;
-    typedef endian< big, uint_least64_t, 40 >        ubig40_t;
-    typedef endian< big, uint_least64_t, 48 >        ubig48_t;
-    typedef endian< big, uint_least64_t, 56 >        ubig56_t;
-    typedef endian< big, uint_least64_t, 64 >        ubig64_t;
+    typedef endian< endianness::big, uint_least8_t, 8 >          ubig8_t;
+    typedef endian< endianness::big, uint_least16_t, 16 >        ubig16_t;
+    typedef endian< endianness::big, uint_least32_t, 24 >        ubig24_t;
+    typedef endian< endianness::big, uint_least32_t, 32 >        ubig32_t;
+    typedef endian< endianness::big, uint_least64_t, 40 >        ubig40_t;
+    typedef endian< endianness::big, uint_least64_t, 48 >        ubig48_t;
+    typedef endian< endianness::big, uint_least64_t, 56 >        ubig56_t;
+    typedef endian< endianness::big, uint_least64_t, 64 >        ubig64_t;
 
     // unaligned little endian signed integer types
-    typedef endian< little, int_least8_t, 8 >        little8_t;
-    typedef endian< little, int_least16_t, 16 >      little16_t;
-    typedef endian< little, int_least32_t, 24 >      little24_t;
-    typedef endian< little, int_least32_t, 32 >      little32_t;
-    typedef endian< little, int_least64_t, 40 >      little40_t;
-    typedef endian< little, int_least64_t, 48 >      little48_t;
-    typedef endian< little, int_least64_t, 56 >      little56_t;
-    typedef endian< little, int_least64_t, 64 >      little64_t;
+    typedef endian< endianness::little, int_least8_t, 8 >        little8_t;
+    typedef endian< endianness::little, int_least16_t, 16 >      little16_t;
+    typedef endian< endianness::little, int_least32_t, 24 >      little24_t;
+    typedef endian< endianness::little, int_least32_t, 32 >      little32_t;
+    typedef endian< endianness::little, int_least64_t, 40 >      little40_t;
+    typedef endian< endianness::little, int_least64_t, 48 >      little48_t;
+    typedef endian< endianness::little, int_least64_t, 56 >      little56_t;
+    typedef endian< endianness::little, int_least64_t, 64 >      little64_t;
 
     // unaligned little endian unsigned integer types
-    typedef endian< little, uint_least8_t, 8 >       ulittle8_t;
-    typedef endian< little, uint_least16_t, 16 >     ulittle16_t;
-    typedef endian< little, uint_least32_t, 24 >     ulittle24_t;
-    typedef endian< little, uint_least32_t, 32 >     ulittle32_t;
-    typedef endian< little, uint_least64_t, 40 >     ulittle40_t;
-    typedef endian< little, uint_least64_t, 48 >     ulittle48_t;
-    typedef endian< little, uint_least64_t, 56 >     ulittle56_t;
-    typedef endian< little, uint_least64_t, 64 >     ulittle64_t;
+    typedef endian< endianness::little, uint_least8_t, 8 >       ulittle8_t;
+    typedef endian< endianness::little, uint_least16_t, 16 >     ulittle16_t;
+    typedef endian< endianness::little, uint_least32_t, 24 >     ulittle24_t;
+    typedef endian< endianness::little, uint_least32_t, 32 >     ulittle32_t;
+    typedef endian< endianness::little, uint_least64_t, 40 >     ulittle40_t;
+    typedef endian< endianness::little, uint_least64_t, 48 >     ulittle48_t;
+    typedef endian< endianness::little, uint_least64_t, 56 >     ulittle56_t;
+    typedef endian< endianness::little, uint_least64_t, 64 >     ulittle64_t;
 
     // unaligned native endian signed integer types
-    typedef endian< native, int_least8_t, 8 >        native8_t;
-    typedef endian< native, int_least16_t, 16 >      native16_t;
-    typedef endian< native, int_least32_t, 24 >      native24_t;
-    typedef endian< native, int_least32_t, 32 >      native32_t;
-    typedef endian< native, int_least64_t, 40 >      native40_t;
-    typedef endian< native, int_least64_t, 48 >      native48_t;
-    typedef endian< native, int_least64_t, 56 >      native56_t;
-    typedef endian< native, int_least64_t, 64 >      native64_t;
+    typedef endian< endianness::native, int_least8_t, 8 >        native8_t;
+    typedef endian< endianness::native, int_least16_t, 16 >      native16_t;
+    typedef endian< endianness::native, int_least32_t, 24 >      native24_t;
+    typedef endian< endianness::native, int_least32_t, 32 >      native32_t;
+    typedef endian< endianness::native, int_least64_t, 40 >      native40_t;
+    typedef endian< endianness::native, int_least64_t, 48 >      native48_t;
+    typedef endian< endianness::native, int_least64_t, 56 >      native56_t;
+    typedef endian< endianness::native, int_least64_t, 64 >      native64_t;
 
     // unaligned native endian unsigned integer types
-    typedef endian< native, uint_least8_t, 8 >       unative8_t;
-    typedef endian< native, uint_least16_t, 16 >     unative16_t;
-    typedef endian< native, uint_least32_t, 24 >     unative24_t;
-    typedef endian< native, uint_least32_t, 32 >     unative32_t;
-    typedef endian< native, uint_least64_t, 40 >     unative40_t;
-    typedef endian< native, uint_least64_t, 48 >     unative48_t;
-    typedef endian< native, uint_least64_t, 56 >     unative56_t;
-    typedef endian< native, uint_least64_t, 64 >     unative64_t;
+    typedef endian< endianness::native, uint_least8_t, 8 >       unative8_t;
+    typedef endian< endianness::native, uint_least16_t, 16 >     unative16_t;
+    typedef endian< endianness::native, uint_least32_t, 24 >     unative24_t;
+    typedef endian< endianness::native, uint_least32_t, 32 >     unative32_t;
+    typedef endian< endianness::native, uint_least64_t, 40 >     unative40_t;
+    typedef endian< endianness::native, uint_least64_t, 48 >     unative48_t;
+    typedef endian< endianness::native, uint_least64_t, 56 >     unative56_t;
+    typedef endian< endianness::native, uint_least64_t, 64 >     unative64_t;
 
 #define BOOST_HAS_INT16_T
 #define BOOST_HAS_INT32_T
@@ -312,27 +392,31 @@
   //     <cstdint> types are superior for this use case
 
 # if defined(BOOST_HAS_INT16_T)
-    typedef endian< big, int16_t, 16, aligned >      aligned_big16_t;
-    typedef endian< big, uint16_t, 16, aligned >     aligned_ubig16_t;
-    typedef endian< little, int16_t, 16, aligned >   aligned_little16_t;
-    typedef endian< little, uint16_t, 16, aligned >  aligned_ulittle16_t;
+    typedef endian< endianness::big, int16_t, 16, alignment::aligned >      aligned_big16_t;
+    typedef endian< endianness::big, uint16_t, 16, alignment::aligned >     aligned_ubig16_t;
+    typedef endian< endianness::little, int16_t, 16, alignment::aligned >   aligned_little16_t;
+    typedef endian< endianness::little, uint16_t, 16, alignment::aligned >  aligned_ulittle16_t;
 # endif
 
 # if defined(BOOST_HAS_INT32_T)
-    typedef endian< big, int32_t, 32, aligned >      aligned_big32_t;
-    typedef endian< big, uint32_t, 32, aligned >     aligned_ubig32_t;
-    typedef endian< little, int32_t, 32, aligned >   aligned_little32_t;
-    typedef endian< little, uint32_t, 32, aligned >  aligned_ulittle32_t;
+    typedef endian< endianness::big, int32_t, 32, alignment::aligned >      aligned_big32_t;
+    typedef endian< endianness::big, uint32_t, 32, alignment::aligned >     aligned_ubig32_t;
+    typedef endian< endianness::little, int32_t, 32, alignment::aligned >   aligned_little32_t;
+    typedef endian< endianness::little, uint32_t, 32, alignment::aligned >  aligned_ulittle32_t;
 # endif
 
 # if defined(BOOST_HAS_INT64_T)
-    typedef endian< big, int64_t, 64, aligned >      aligned_big64_t;
-    typedef endian< big, uint64_t, 64, aligned >     aligned_ubig64_t;
-    typedef endian< little, int64_t, 64, aligned >   aligned_little64_t;
-    typedef endian< little, uint64_t, 64, aligned >  aligned_ulittle64_t;
+    typedef endian< endianness::big, int64_t, 64, alignment::aligned >      aligned_big64_t;
+    typedef endian< endianness::big, uint64_t, 64, alignment::aligned >     aligned_ubig64_t;
+    typedef endian< endianness::little, int64_t, 64, alignment::aligned >   aligned_little64_t;
+    typedef endian< endianness::little, uint64_t, 64, alignment::aligned >  aligned_ulittle64_t;
 # endif
 
   } // namespace integer
 } // namespace boost
 
-#endif // BOOST_ENDIAN_HPP
+#if defined(__BORLANDC__) || defined( __CODEGEARC__)
+# pragma pack(pop)
+#endif
+
+#endif // BOOST_SPIRIT_ENDIAN_HPP
Modified: trunk/boost/spirit/home/support/detail/lexer/input.hpp
==============================================================================
--- trunk/boost/spirit/home/support/detail/lexer/input.hpp	(original)
+++ trunk/boost/spirit/home/support/detail/lexer/input.hpp	2009-04-26 10:42:24 EDT (Sun, 26 Apr 2009)
@@ -478,7 +478,7 @@
 };
 
 typedef basic_input<std::string::iterator> iter_input;
-typedef basic_input<std::wstring::iterator> iter_winput;
+typedef basic_input<std::basic_string<wchar_t>::iterator> iter_winput;
 typedef basic_input<const char *> ptr_input;
 typedef basic_input<const wchar_t *> ptr_winput;
 }
Added: trunk/boost/spirit/home/support/detail/make_cons.hpp
==============================================================================
--- (empty file)
+++ trunk/boost/spirit/home/support/detail/make_cons.hpp	2009-04-26 10:42:24 EDT (Sun, 26 Apr 2009)
@@ -0,0 +1,78 @@
+/*=============================================================================
+  Copyright (c) 2001-2009 Joel de Guzman
+  http://spirit.sourceforge.net/
+
+  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)
+=============================================================================*/
+#ifndef BOOST_SPIRIT_MAKE_CONS_OCTOBER_16_2008_1252PM
+#define BOOST_SPIRIT_MAKE_CONS_OCTOBER_16_2008_1252PM
+
+#if defined(_MSC_VER)
+#pragma once
+#endif
+
+#include <boost/proto/proto.hpp>
+#include <boost/mpl/eval_if.hpp>
+#include <boost/fusion/include/cons.hpp>
+#include <boost/type_traits/remove_const.hpp>
+#include <boost/type_traits/is_abstract.hpp>
+#include <boost/type_traits/is_function.hpp>
+#include <boost/type_traits/add_reference.hpp>
+
+namespace boost { namespace spirit { namespace detail
+{
+    template <typename T>
+    struct as_meta_element
+    {
+        typedef typename
+            mpl::eval_if_c<is_abstract<T>::value || is_function<T>::value
+              , add_reference<T>
+              , remove_const<T>
+            >::type
+        type;
+    };
+
+    template <typename T>
+    struct as_meta_element<T&>
+    {
+        // always store by value
+        typedef typename as_meta_element<T>::type type;
+    };
+
+    template <typename T, int N>
+    struct as_meta_element<T[N]>
+    {
+        typedef const T(&type)[N];
+    };
+
+    namespace result_of
+    {
+        template <typename Car, typename Cdr = fusion::nil>
+        struct make_cons
+        {
+            typedef typename as_meta_element<Car>::type car_type;
+            typedef typename fusion::cons<car_type, Cdr> type;
+        };
+    }
+
+    template <typename Car, typename Cdr>
+    fusion::cons<typename as_meta_element<Car>::type, Cdr>
+    make_cons(Car const& car, Cdr const& cdr)
+    {
+        typedef typename as_meta_element<Car>::type car_type;
+        typedef typename fusion::cons<car_type, Cdr> result;
+        return result(car, cdr);
+    }
+
+    template <typename Car>
+    fusion::cons<typename as_meta_element<Car>::type>
+    make_cons(Car const& car)
+    {
+        typedef typename as_meta_element<Car>::type car_type;
+        typedef typename fusion::cons<car_type> result;
+        return result(car);
+    }
+}}}
+
+#endif
Added: trunk/boost/spirit/home/support/detail/make_vector.hpp
==============================================================================
--- (empty file)
+++ trunk/boost/spirit/home/support/detail/make_vector.hpp	2009-04-26 10:42:24 EDT (Sun, 26 Apr 2009)
@@ -0,0 +1,114 @@
+/*=============================================================================
+    Copyright (c) 2001-2009 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)
+==============================================================================*/
+#include <boost/version.hpp>
+
+// This is the same as the one in fusion in Boost 1.40. This is provided
+// for compatibility with Boost 1.39 and below.
+
+#if (BOOST_VERSION > 103900)
+
+#include <boost/fusion/include/make_vector.hpp>
+
+namespace boost { namespace spirit { namespace detail
+{
+    namespace result_of
+    {
+        using fusion::make_vector;
+    }
+    using fusion::make_vector;
+}}}
+
+#else
+
+#ifndef BOOST_PP_IS_ITERATING
+#if !defined(SPIRIT_MAKE_VECTOR_07162005_0243)
+#define SPIRIT_MAKE_VECTOR_07162005_0243
+
+#include <boost/preprocessor/iterate.hpp>
+#include <boost/preprocessor/repetition/enum_params.hpp>
+#include <boost/preprocessor/repetition/enum_binary_params.hpp>
+#include <boost/preprocessor/repetition/enum_params_with_a_default.hpp>
+#include <boost/preprocessor/repetition/repeat_from_to.hpp>
+#include <boost/fusion/container/vector/vector.hpp>
+#include <boost/fusion/support/detail/as_fusion_element.hpp>
+
+namespace boost { namespace fusion
+{
+    struct void_;
+}}
+
+namespace boost { namespace spirit { namespace detail
+{
+    namespace result_of
+    {
+        template <
+            BOOST_PP_ENUM_PARAMS_WITH_A_DEFAULT(
+                FUSION_MAX_VECTOR_SIZE, typename T, fusion::void_)
+          , typename Extra = fusion::void_
+        >
+        struct make_vector;
+
+        template <>
+        struct make_vector<>
+        {
+            typedef fusion::vector0 type;
+        };
+    }
+
+    inline fusion::vector0
+    make_vector()
+    {
+        return fusion::vector0();
+    }
+
+#define BOOST_FUSION_AS_FUSION_ELEMENT(z, n, data)                               \
+    typename fusion::detail::as_fusion_element<BOOST_PP_CAT(T, n)>::type
+
+#define BOOST_PP_FILENAME_1 <boost/spirit/home/support/detail/make_vector.hpp>
+#define BOOST_PP_ITERATION_LIMITS (1, FUSION_MAX_VECTOR_SIZE)
+#include BOOST_PP_ITERATE()
+
+#undef BOOST_FUSION_AS_FUSION_ELEMENT
+
+}}}
+
+#endif
+#else // defined(BOOST_PP_IS_ITERATING)
+///////////////////////////////////////////////////////////////////////////////
+//
+//  Preprocessor vertical repetition code
+//
+///////////////////////////////////////////////////////////////////////////////
+
+#define N BOOST_PP_ITERATION()
+
+    namespace result_of
+    {
+        template <BOOST_PP_ENUM_PARAMS(N, typename T)>
+#if defined(BOOST_NO_PARTIAL_SPECIALIZATION_IMPLICIT_DEFAULT_ARGS)
+        #define TEXT(z, n, text) , text
+        struct make_vector< BOOST_PP_ENUM_PARAMS(N, T) BOOST_PP_REPEAT_FROM_TO(BOOST_PP_DEC(N), FUSION_MAX_VECTOR_SIZE, TEXT, fusion::void_) >
+        #undef TEXT
+#else
+        struct make_vector<BOOST_PP_ENUM_PARAMS(N, T)>
+#endif
+        {
+            typedef BOOST_PP_CAT(fusion::vector, N)<BOOST_PP_ENUM(N, BOOST_FUSION_AS_FUSION_ELEMENT, _)> type;
+        };
+    }
+
+    template <BOOST_PP_ENUM_PARAMS(N, typename T)>
+    inline BOOST_PP_CAT(fusion::vector, N)<BOOST_PP_ENUM(N, BOOST_FUSION_AS_FUSION_ELEMENT, _)>
+    make_vector(BOOST_PP_ENUM_BINARY_PARAMS(N, T, const& _))
+    {
+        return BOOST_PP_CAT(fusion::vector, N)<BOOST_PP_ENUM(N, BOOST_FUSION_AS_FUSION_ELEMENT, _)>(
+            BOOST_PP_ENUM_PARAMS(N, _));
+    }
+
+#undef N
+#endif // defined(BOOST_PP_IS_ITERATING)
+#endif // (BOOST_VERSION > 103800)
Modified: trunk/boost/spirit/home/support/detail/math/fpclassify.hpp
==============================================================================
--- trunk/boost/spirit/home/support/detail/math/fpclassify.hpp	(original)
+++ trunk/boost/spirit/home/support/detail/math/fpclassify.hpp	2009-04-26 10:42:24 EDT (Sun, 26 Apr 2009)
@@ -38,7 +38,7 @@
 depending on whether all the mantissa bits are copied or not.
 */
 
-#include <boost/config/no_tr1/cmath.hpp>
+#include <cmath>
 
 #ifndef FP_INFINITE
 #   define FP_INFINITE 0
Deleted: trunk/boost/spirit/home/support/detail/math/nonfinite_num_facets.hpp
==============================================================================
--- trunk/boost/spirit/home/support/detail/math/nonfinite_num_facets.hpp	2009-04-26 10:42:24 EDT (Sun, 26 Apr 2009)
+++ (empty file)
@@ -1,477 +0,0 @@
-#ifndef BOOST_SPIRIT_MATH_NONFINITE_NUM_FACETS_HPP
-#define BOOST_SPIRIT_MATH_NONFINITE_NUM_FACETS_HPP
-
-// Copyright (c) 2006 Johan Rade
-
-// 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)
-
-#include <cstring>
-#include <ios>
-#include <limits>
-#include <locale>
-#include <boost/spirit/home/support/detail/math/fpclassify.hpp>
-#include <boost/spirit/home/support/detail/math/signbit.hpp>
-
-#ifdef _MSC_VER
-#   pragma warning(push)
-#   pragma warning(disable : 4127 4511 4512 4706)
-#endif
-
-namespace boost {
-namespace spirit {
-namespace math {
-
-
-// flags -----------------------------------------------------------------------
-
-const int legacy = 0x1;
-const int signed_zero = 0x2;
-const int trap_infinity = 0x4;
-const int trap_nan = 0x8;
-
-
-// class nonfinite_num_put -----------------------------------------------------
-
-template<
-    class CharType, 
-    class OutputIterator = std::ostreambuf_iterator<CharType> 
->
-class nonfinite_num_put : public std::num_put<CharType, OutputIterator> {
-public:
-    explicit nonfinite_num_put(int flags = 0) : flags_(flags) {}
-
-protected:
-    virtual OutputIterator do_put(
-        OutputIterator it, std::ios_base& iosb,
-        CharType fill, double val) const
-    {
-        put_and_reset_width(it, iosb, fill, val);
-        return it;
-    }
-
-    virtual OutputIterator do_put(
-        OutputIterator it, std::ios_base& iosb,
-        CharType fill, long double val) const
-    {
-        put_and_reset_width(it, iosb, fill, val);
-        return it;
-    }
-
-private:
-    template<class ValType> void put_and_reset_width(
-        OutputIterator& it, std::ios_base& iosb,
-        CharType fill, ValType val) const
-    {
-        put_impl(it, iosb, fill, val);
-        iosb.width(0);
-    }
-
-    template<class ValType> void put_impl(
-        OutputIterator& it, std::ios_base& iosb,
-        CharType fill, ValType val) const
-    {
-        switch((boost::math::fpclassify)(val)) {
-
-            case FP_INFINITE:
-                if(flags_ & trap_infinity)
-                    throw std::ios_base::failure("Infinity");
-                else if((boost::math::signbit)(val))
-                    put_num_and_fill(it, iosb, "-", "inf", fill);
-                else if(iosb.flags() & std::ios_base::showpos)
-                    put_num_and_fill(it, iosb, "+", "inf", fill);
-                else
-                    put_num_and_fill(it, iosb, "", "inf", fill);
-                break;
-            
-            case FP_NAN:
-                if(flags_ & trap_nan)
-                    throw std::ios_base::failure("NaN");
-                else if((boost::math::signbit)(val))
-                    put_num_and_fill(it, iosb, "-", "nan", fill);
-                else if(iosb.flags() & std::ios_base::showpos)
-                    put_num_and_fill(it, iosb, "+", "nan", fill);
-                else
-                    put_num_and_fill(it, iosb, "", "nan", fill);
-                break;
-
-            case FP_ZERO:
-                if(flags_ & signed_zero) {
-                    if((boost::math::signbit)(val))
-                        put_num_and_fill(it, iosb, "-", "0", fill);
-                    else if(iosb.flags() & std::ios_base::showpos)
-                        put_num_and_fill(it, iosb, "+", "0", fill);
-                    else
-                        put_num_and_fill(it, iosb, "", "0", fill);
-                }
-                else
-                    put_num_and_fill(it, iosb, "", "0", fill);
-                break;
-
-            default:
-                it = std::num_put<CharType, OutputIterator>::do_put(
-                    it, iosb, fill, val);
-                break;
-        }
-    }
-
-    void put_num_and_fill(
-        OutputIterator& it, std::ios_base& iosb, const char* prefix,
-        const char* body, CharType fill) const
-    {
-        int width = (int)strlen(prefix) + (int)strlen(body);
-        std::ios_base::fmtflags adjust
-            = iosb.flags() & std::ios_base::adjustfield;
-        const std::ctype<CharType>& ct
-            = std::use_facet<std::ctype<CharType> >(iosb.getloc());
-
-        if(adjust != std::ios_base::internal && adjust != std::ios_base::left)
-            put_fill(it, iosb, fill, width);
-
-        while(*prefix)
-            *it = ct.widen(*(prefix++));
-
-        if(adjust == std::ios_base::internal)
-            put_fill(it, iosb, fill, width);
-
-        if(iosb.flags() & std::ios_base::uppercase) {
-            while(*body)
-                *it = ct.toupper(ct.widen(*(body++)));
-        }
-        else {
-            while(*body)
-                *it = ct.widen(*(body++));
-        }
-
-        if(adjust == std::ios_base::left)
-            put_fill(it, iosb, fill, width);
-    }
-
-    void put_fill(
-        OutputIterator& it, std::ios_base& iosb, 
-        CharType fill, int width) const
-    {
-        for(int i = iosb.width() - width; i > 0; --i)
-            *it = fill;
-    }
-
-private:
-    const int flags_;
-};
-
-
-// class nonfinite_num_get ------------------------------------------------------
-
-template<
-    class CharType, 
-    class InputIterator = std::istreambuf_iterator<CharType> 
->
-class nonfinite_num_get : public std::num_get<CharType, InputIterator> {
-public:
-    explicit nonfinite_num_get(int flags = 0) : flags_(flags) {}
-
-protected:
-    virtual InputIterator do_get(
-        InputIterator it, InputIterator end, std::ios_base& iosb,
-        std::ios_base::iostate& state, float& val) const
-    {
-        get_and_check_eof(it, end, iosb, state, val);
-        return it;
-    }
-
-    virtual InputIterator do_get(
-        InputIterator it, InputIterator end, std::ios_base& iosb,
-        std::ios_base::iostate& state, double& val) const
-    {
-        get_and_check_eof(it, end, iosb, state, val);
-        return it;
-    }
-
-    virtual InputIterator do_get(
-        InputIterator it, InputIterator end, std::ios_base& iosb,
-        std::ios_base::iostate& state, long double& val) const
-    {
-        get_and_check_eof(it, end, iosb, state, val);
-        return it;
-    }
-
-//..............................................................................
-    
-private:
-    template<class ValType> static ValType positive_nan()
-    {
-        // on some platforms quiet_NaN() is negative
-        return (boost::math::copysign)(
-            std::numeric_limits<ValType>::quiet_NaN(), 1);  
-    }
-
-    template<class ValType> void get_and_check_eof(
-        InputIterator& it, InputIterator end, std::ios_base& iosb,
-        std::ios_base::iostate& state, ValType& val) const
-    {
-        get_signed(it, end, iosb, state, val);
-        if(it == end)
-            state |= std::ios_base::eofbit;
-    }
-
-    template<class ValType> void get_signed(
-        InputIterator& it, InputIterator end, std::ios_base& iosb,
-        std::ios_base::iostate& state, ValType& val) const
-    {
-        const std::ctype<CharType>& ct
-            = std::use_facet<std::ctype<CharType> >(iosb.getloc());
-
-        char c = peek_char(it, end, ct);
-
-        bool negative = (c == '-');
-
-        if(negative || c == '+') {
-            ++it;
-            c = peek_char(it, end, ct);
-            if(c == '-' || c == '+') {
-                // without this check, "++5" etc would be accepted
-                state |= std::ios_base::failbit;
-                return;
-            }
-        }
-
-        get_unsigned(it, end, iosb, ct, state, val);
-
-        if(negative)
-            val = (boost::math::changesign)(val);
-    }
-
-    template<class ValType> void get_unsigned(
-        InputIterator& it, InputIterator end, std::ios_base& iosb,
-        const std::ctype<CharType>& ct,
-        std::ios_base::iostate& state, ValType& val) const
-    {
-        switch(peek_char(it, end, ct)) {
-
-            case 'i': 
-                get_i(it, end, ct, state, val);
-                break;
-
-            case 'n':
-                get_n(it, end, ct, state, val);
-                break;
-
-            case 'q':
-            case 's':
-                get_q(it, end, ct, state, val);
-                break;
-
-            default:
-                it = std::num_get<CharType, InputIterator>::do_get(
-                        it, end, iosb, state, val);
-                if((flags_ & legacy) && val == static_cast<ValType>(1)
-                        && peek_char(it, end, ct) == '#')
-                    get_one_hash(it, end, ct, state, val);
-                break;
-        }
-    }
-
-    //..........................................................................
-
-    template<class ValType> void get_i(
-        InputIterator& it, InputIterator end, const std::ctype<CharType>& ct,
-        std::ios_base::iostate& state, ValType& val) const
-    {
-        if(!std::numeric_limits<ValType>::has_infinity
-                || (flags_ & trap_infinity)) {
-            state |= std::ios_base::failbit;
-            return;
-        }
-
-        ++it;
-
-        if(!match_string(it, end, ct, "nf")) {
-            state |= std::ios_base::failbit;
-            return;
-        }
-
-        if(peek_char(it, end, ct) != 'i') {
-            val = std::numeric_limits<ValType>::infinity();     // "inf"
-            return;
-        }
-
-        ++it;
-
-        if(!match_string(it, end, ct, "nity")) {
-            state |= std::ios_base::failbit;
-            return;
-        }
-
-        val = std::numeric_limits<ValType>::infinity();         // "infinity"
-    }
-
-    template<class ValType> void get_n(
-        InputIterator& it, InputIterator end, const std::ctype<CharType>& ct,
-        std::ios_base::iostate& state, ValType& val) const
-    {
-        if(!std::numeric_limits<ValType>::has_quiet_NaN 
-                || (flags_ & trap_nan)) {
-            state |= std::ios_base::failbit;
-            return;
-        }
-
-        ++it;
-            
-        if(!match_string(it, end, ct, "an")) {
-            state |= std::ios_base::failbit;
-            return;
-        }
-
-        switch(peek_char(it, end, ct)) {
-            case 'q':
-            case 's':
-                if(flags_ && legacy)
-                    ++it;
-                break;              // "nanq", "nans"
-                
-            case '(': 
-            {
-                ++it;
-                char c;
-                while((c = peek_char(it, end, ct))
-                        && c != ')' && c != ' ' && c != '\n' && c != '\t')
-                    ++it;
-                if(c != ')') {
-                    state |= std::ios_base::failbit;
-                    return;
-                }
-                ++it;           
-                break;              // "nan(...)"
-            }
-
-            default:
-                break;              // "nan"
-        }
-
-        val = positive_nan<ValType>();
-    }
-
-    template<class ValType> void get_q(
-        InputIterator& it, InputIterator end, const std::ctype<CharType>& ct,
-        std::ios_base::iostate& state, ValType& val) const
-    {
-        if(!std::numeric_limits<ValType>::has_quiet_NaN 
-                || (flags_ & trap_nan) || !(flags_ & legacy)) {
-            state |= std::ios_base::failbit;
-            return;
-        }
-
-        ++it;
-
-        if(!match_string(it, end, ct, "nan")) {
-            state |= std::ios_base::failbit;
-            return;
-        }
-
-        val = positive_nan<ValType>();      // qnan, snan
-    }
-
-    template<class ValType> void get_one_hash(
-        InputIterator& it, InputIterator end, const std::ctype<CharType>& ct,
-        std::ios_base::iostate& state, ValType& val) const
-    {
-        ++it;
-
-        switch(peek_char(it, end, ct)) {
-            case 'i':
-                get_one_hash_i(it, end, ct, state, val);
-                return;
-
-            case 'q':
-            case 's':
-                if(std::numeric_limits<ValType>::has_quiet_NaN
-                        && !(flags_ & trap_nan)) {
-                    ++it;
-                    if(match_string(it, end, ct, "nan")) {  
-                                                        // "1.#QNAN", "1.#SNAN"
-                        ++it;
-                        val = positive_nan<ValType>();
-                        return;
-                    }
-                }
-                break;
-
-            default:
-                break;
-        }
-
-        state |= std::ios_base::failbit;
-    }
-   
-    template<class ValType> void get_one_hash_i(
-        InputIterator& it, InputIterator end, const std::ctype<CharType>& ct,
-        std::ios_base::iostate& state, ValType& val) const
-    {
-        ++it;
-
-        if(peek_char(it, end, ct) == 'n') {
-            ++it;
-            switch(peek_char(it, end, ct)) {
-                case 'f':                                       // "1.#INF"
-                    if(std::numeric_limits<ValType>::has_infinity
-                            && !(flags_ & trap_infinity)) {
-                        ++it;
-                        val = std::numeric_limits<ValType>::infinity(); 
-                        return;
-                    }
-                    break;
-
-                case 'd':                                       // 1.#IND"
-                    if(std::numeric_limits<ValType>::has_quiet_NaN
-                            && !(flags_ & trap_nan)) {
-                        ++it;
-                        val = positive_nan<ValType>();
-                        return;
-                    }
-                    break;
-
-                default:
-                    break;
-            }
-        }
-
-        state |= std::ios_base::failbit;
-    }
-
-    //..........................................................................
-
-    char peek_char(
-        InputIterator& it, InputIterator end, 
-        const std::ctype<CharType>& ct) const
-    {
-        if(it == end) return 0;
-        return ct.narrow(ct.tolower(*it), 0);
-    }
-
-    bool match_string(
-        InputIterator& it, InputIterator end,
-        const std::ctype<CharType>& ct, const char* s) const
-    {
-        while(it != end && *s && *s == ct.narrow(ct.tolower(*it), 0)) {
-            ++s;
-            ++it;
-        }
-        return !*s;
-    }
-
-private:
-    const int flags_;
-};
-
-//------------------------------------------------------------------------------
-
-}   // namespace math
-}   // namespace spirit
-}   // namespace boost
-
-#ifdef _MSC_VER
-#   pragma warning(pop)
-#endif
-
-#endif
Added: trunk/boost/spirit/home/support/detail/pow10.hpp
==============================================================================
--- (empty file)
+++ trunk/boost/spirit/home/support/detail/pow10.hpp	2009-04-26 10:42:24 EDT (Sun, 26 Apr 2009)
@@ -0,0 +1,96 @@
+/*=============================================================================
+    Copyright (c) 2001-2009 Joel de Guzman
+    Copyright (c) 2001-2009 Hartmut Kaiser
+    http://spirit.sourceforge.net/
+
+    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(SPIRIT_POW10_DECEMBER_26_2008_1118AM)
+#define SPIRIT_POW10_DECEMBER_26_2008_1118AM
+
+#if defined(_MSC_VER)
+#pragma once
+#endif
+
+#include <boost/config/no_tr1/cmath.hpp>
+#include <limits>
+#include <boost/spirit/home/support/unused.hpp>
+
+#if BOOST_WORKAROUND(BOOST_MSVC, >= 1400)
+# pragma warning(push)
+# pragma warning(disable: 4244)   // conversion from 'double' to 'float', possible loss of data
+#endif
+
+namespace boost { namespace spirit { namespace detail
+{
+    template <typename T>
+    inline T pow10(unsigned dim)
+    {
+        using namespace std;    // allow for ADL to find the correct overload
+        return pow(T(10), T(dim));
+    }
+
+    template <>
+    inline unused_type pow10<unused_type>(unsigned)
+    {
+        return unused;
+    }
+
+#if (DBL_MAX_EXP == 308) // for IEEE-754
+    template <>
+    inline double pow10<double>(unsigned dim)
+    {
+        static double const exponents[] =
+        {
+            1e0,   1e1,   1e2,   1e3,   1e4,   1e5,   1e6,   1e7,   1e8,    1e9,
+            1e10,  1e11,  1e12,  1e13,  1e14,  1e15,  1e16,  1e17,  1e18,  1e19,
+            1e20,  1e21,  1e22,  1e23,  1e24,  1e25,  1e26,  1e27,  1e28,  1e29,
+            1e30,  1e31,  1e32,  1e33,  1e34,  1e35,  1e36,  1e37,  1e38,  1e39,
+            1e40,  1e41,  1e42,  1e43,  1e44,  1e45,  1e46,  1e47,  1e48,  1e49,
+            1e50,  1e51,  1e52,  1e53,  1e54,  1e55,  1e56,  1e57,  1e58,  1e59,
+            1e60,  1e61,  1e62,  1e63,  1e64,  1e65,  1e66,  1e67,  1e68,  1e69,
+            1e70,  1e71,  1e72,  1e73,  1e74,  1e75,  1e76,  1e77,  1e78,  1e79,
+            1e80,  1e81,  1e82,  1e83,  1e84,  1e85,  1e86,  1e87,  1e88,  1e89,
+            1e90,  1e91,  1e92,  1e93,  1e94,  1e95,  1e96,  1e97,  1e98,  1e99,
+            1e100, 1e101, 1e102, 1e103, 1e104, 1e105, 1e106, 1e107, 1e108, 1e109,
+            1e110, 1e111, 1e112, 1e113, 1e114, 1e115, 1e116, 1e117, 1e118, 1e119,
+            1e120, 1e121, 1e122, 1e123, 1e124, 1e125, 1e126, 1e127, 1e128, 1e129,
+            1e130, 1e131, 1e132, 1e133, 1e134, 1e135, 1e136, 1e137, 1e138, 1e139,
+            1e140, 1e141, 1e142, 1e143, 1e144, 1e145, 1e146, 1e147, 1e148, 1e149,
+            1e150, 1e151, 1e152, 1e153, 1e154, 1e155, 1e156, 1e157, 1e158, 1e159,
+            1e160, 1e161, 1e162, 1e163, 1e164, 1e165, 1e166, 1e167, 1e168, 1e169,
+            1e170, 1e171, 1e172, 1e173, 1e174, 1e175, 1e176, 1e177, 1e178, 1e179,
+            1e180, 1e181, 1e182, 1e183, 1e184, 1e185, 1e186, 1e187, 1e188, 1e189,
+            1e190, 1e191, 1e192, 1e193, 1e194, 1e195, 1e196, 1e197, 1e198, 1e199,
+            1e200, 1e201, 1e202, 1e203, 1e204, 1e205, 1e206, 1e207, 1e208, 1e209,
+            1e210, 1e211, 1e212, 1e213, 1e214, 1e215, 1e216, 1e217, 1e218, 1e219,
+            1e220, 1e221, 1e222, 1e223, 1e224, 1e225, 1e226, 1e227, 1e228, 1e229,
+            1e230, 1e231, 1e232, 1e233, 1e234, 1e235, 1e236, 1e237, 1e238, 1e239,
+            1e240, 1e241, 1e242, 1e243, 1e244, 1e245, 1e246, 1e247, 1e248, 1e249,
+            1e250, 1e251, 1e252, 1e253, 1e254, 1e255, 1e256, 1e257, 1e258, 1e259,
+            1e260, 1e261, 1e262, 1e263, 1e264, 1e265, 1e266, 1e267, 1e268, 1e269,
+            1e270, 1e271, 1e272, 1e273, 1e274, 1e275, 1e276, 1e277, 1e278, 1e279,
+            1e280, 1e281, 1e282, 1e283, 1e284, 1e285, 1e286, 1e287, 1e288, 1e289,
+            1e290, 1e291, 1e292, 1e293, 1e294, 1e295, 1e296, 1e297, 1e298, 1e299,
+            1e300, 1e301, 1e302, 1e303, 1e304, 1e305, 1e306, 1e307, 1e308,
+        };
+        BOOST_ASSERT(dim < sizeof(exponents)/sizeof(double));
+        return exponents[dim];
+    }
+
+    template <>
+    inline float pow10<float>(unsigned dim)
+    {
+        return pow10<double>(dim);
+    }
+
+#endif // for IEEE-754
+
+}}}
+
+#if BOOST_WORKAROUND(BOOST_MSVC, >= 1400)
+# pragma warning(pop)
+#endif
+
+#endif
Added: trunk/boost/spirit/home/support/detail/scoped_enum_emulation.hpp
==============================================================================
--- (empty file)
+++ trunk/boost/spirit/home/support/detail/scoped_enum_emulation.hpp	2009-04-26 10:42:24 EDT (Sun, 26 Apr 2009)
@@ -0,0 +1,20 @@
+//  Copyright (c) 2001-2009 Hartmut Kaiser
+//  http://spirit.sourceforge.net/
+// 
+//  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)
+
+#ifndef BOOST_SPIRIT_SCOPED_ENUM_EMULATION_HPP
+#define BOOST_SPIRIT_SCOPED_ENUM_EMULATION_HPP
+
+#include <boost/version.hpp>
+
+#if BOOST_VERSION >= 103900
+#include <boost/detail/scoped_enum_emulation.hpp>
+#else
+# define BOOST_SCOPED_ENUM_START(name) struct name { enum enum_t
+# define BOOST_SCOPED_ENUM_END };
+# define BOOST_SCOPED_ENUM(name) name::enum_t
+#endif
+
+#endif
Added: trunk/boost/spirit/home/support/detail/sign.hpp
==============================================================================
--- (empty file)
+++ trunk/boost/spirit/home/support/detail/sign.hpp	2009-04-26 10:42:24 EDT (Sun, 26 Apr 2009)
@@ -0,0 +1,71 @@
+/*=============================================================================
+    Copyright (c) 2001-2009 Joel de Guzman
+    Copyright (c) 2001-2009 Hartmut Kaiser
+    http://spirit.sourceforge.net/
+
+    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(SPIRIT_SIGN_MAR_11_2009_0734PM)
+#define SPIRIT_SIGN_MAR_11_2009_0734PM
+
+#if defined(_MSC_VER)
+#pragma once
+#endif
+
+#include <boost/config/no_tr1/cmath.hpp>
+#include <boost/version.hpp>
+#if BOOST_VERSION < 104000 
+#include <boost/spirit/home/support/detail/math/fpclassify.hpp>
+#include <boost/spirit/home/support/detail/math/signbit.hpp>
+#else
+#include <boost/math/special_functions/fpclassify.hpp>
+#include <boost/math/special_functions/sign.hpp>
+#endif
+
+namespace boost { namespace spirit { namespace detail
+{
+#if BOOST_VERSION < 104000
+    // signbit(-NAN) is broken for versions of Boost earlier than 1.40.0
+    // This routine has been taken and adapted from Johan Rade's fp_traits 
+    // library
+    template<typename T> 
+    inline bool (signbit)(T x)
+    {
+        return boost::spirit::math::signbit(x);
+    }
+
+    template<typename T> 
+    inline T (changesign)(T x)
+    {
+        return boost::spirit::math::changesign(x);
+    }
+#else
+    template<typename T> 
+    inline bool (signbit)(T x)
+    {
+        return boost::math::signbit(x) ? true : false;
+    }
+
+    // This routine has been taken and adapted from Johan Rade's fp_traits 
+    // library
+    template<typename T> 
+    inline T (changesign)(T x)
+    {
+#if defined(BOOST_MATH_USE_STD_FPCLASSIFY) && !defined(BOOST_MATH_DISABLE_STD_FPCLASSIFY)
+        return -x;
+#else
+        typedef typename math::detail::fp_traits<T>::type traits_type;
+
+        typename traits_type::bits a;
+        traits_type::get_bits(x, a);
+        a ^= traits_type::sign;
+        traits_type::set_bits(x, a);
+        return x;
+#endif
+    }
+#endif
+
+}}}
+
+#endif
Deleted: trunk/boost/spirit/home/support/detail/to_narrow.hpp
==============================================================================
--- trunk/boost/spirit/home/support/detail/to_narrow.hpp	2009-04-26 10:42:24 EDT (Sun, 26 Apr 2009)
+++ (empty file)
@@ -1,70 +0,0 @@
-/*=============================================================================
-    Copyright (c) 2001-2007 Joel de Guzman
-    Copyright (c) 2001-2009 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_TO_NARROW_APRIL_29_2007_1122AM)
-#define BOOST_SPIRIT_TO_NARROW_APRIL_29_2007_1122AM
-
-#include <string>
-#include <locale>
-#include <memory>
-
-namespace boost { namespace spirit { namespace detail
-{
-    ///////////////////////////////////////////////////////////////////////////
-    template <typename Char>
-    inline char to_narrow_char(Char ch)
-    {
-        typedef std::ctype<Char> ctype_type;
-        return std::use_facet<ctype_type>(std::locale()).narrow(ch, '.');
-    }
-
-    inline char to_narrow_char(char ch)
-    {
-        return ch;
-    }
-
-    template <typename Char>
-    inline std::size_t getlength(Char const* p)
-    {
-        std::size_t len = 0;
-        while (*p)
-            ++len, ++p;
-        return len;
-    }
-
-    template <typename Char>
-    inline std::string to_narrow_string(Char const* source)
-    {
-        typedef std::ctype<Char> ctype_type;
-
-        std::size_t len = getlength(source);
-        std::auto_ptr<char> buffer(new char [len+1]);
-        std::use_facet<ctype_type>(std::locale())
-            .narrow(source, source + len, '.', buffer.get());
-
-        return std::string(buffer.get(), len);
-    }
-
-    inline std::string to_narrow_string(char const* source)
-    {
-        return source;
-    }
-
-    template <typename Char>
-    inline std::string to_narrow_string(std::basic_string<Char> const& str)
-    {
-        return to_narrow_string(str.c_str());
-    }
-
-    inline std::string const& to_narrow_string(std::string const& str)
-    {
-        return str;
-    }
-
-}}}
-
-#endif
Deleted: trunk/boost/spirit/home/support/detail/values.hpp
==============================================================================
--- trunk/boost/spirit/home/support/detail/values.hpp	2009-04-26 10:42:24 EDT (Sun, 26 Apr 2009)
+++ (empty file)
@@ -1,120 +0,0 @@
-/*=============================================================================
-    Copyright (c) 2001-2007 Joel de Guzman
-    Copyright (c) 2001-2009 Hartmut Kaiser
-    http://spirit.sourceforge.net/
-
-    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_VALUES_JAN_07_2007_0802PM)
-#define BOOST_SPIRIT_VALUES_JAN_07_2007_0802PM
-
-#include <boost/fusion/include/is_sequence.hpp>
-#include <boost/fusion/include/vector.hpp>
-#include <boost/spirit/home/support/unused.hpp>
-#include <boost/utility/enable_if.hpp>
-#include <boost/mpl/bool.hpp>
-#include <boost/mpl/and.hpp>
-#include <boost/variant.hpp>
-
-namespace boost { namespace spirit { namespace detail
-{
-    template <typename T>
-    struct not_is_variant
-      : mpl::true_ {};
-
-    template <BOOST_VARIANT_ENUM_PARAMS(typename T)>
-    struct not_is_variant<boost::variant<BOOST_VARIANT_ENUM_PARAMS(T)> >
-      : mpl::false_ {};
-
-    ///////////////////////////////////////////////////////////////////////////
-    //  All parsers and generators have specific attribute or parameter types.
-    //  Spirit parsers are passed an attribute and Spirit generators
-    //  are passed a parameter; these are either references to the expected
-    //  type, or an unused_type -- to flag that we do not care about the
-    //  attribute/parameter. For semantic actions, however, we need to have a
-    //  real value to pass to the semantic action. If the client did not
-    //  provide one, we will have to synthesize the value. This class
-    //  takes care of that.
-    ///////////////////////////////////////////////////////////////////////////
-    template <typename ValueType>
-    struct make_value
-    {
-        static ValueType call(unused_type)
-        {
-            return ValueType(); // synthesize the attribute/parameter
-        }
-
-        template <typename T>
-        static T& call(T& value)
-        {
-            return value; // just pass the one provided
-        }
-
-        template <typename T>
-        static T const& call(T const& value)
-        {
-            return value; // just pass the one provided
-        }
-    };
-
-    template <typename ValueType>
-    struct make_value<ValueType&> : make_value<ValueType>
-    {
-    };
-
-    template <>
-    struct make_value<unused_type>
-    {
-        static unused_type call(unused_type)
-        {
-            return unused;
-        }
-    };
-
-    ///////////////////////////////////////////////////////////////////////////
-    //  pass_value determines how we pass attributes and parameters to semantic
-    //  actions. Basically, all SAs receive the arguments in a tuple. So, if
-    //  the argument to be passed is not a tuple, wrap it in one.
-    ///////////////////////////////////////////////////////////////////////////
-    template <typename ValueType>
-    struct pass_value
-    {
-        typedef
-            mpl::and_<
-                fusion::traits::is_sequence<ValueType>
-              , detail::not_is_variant<ValueType>
-            >
-        is_sequence;
-
-        typedef typename
-            mpl::if_<
-                is_sequence
-              , ValueType&
-              , fusion::vector<ValueType&> const
-            >::type
-        type;
-
-        static ValueType&
-        call(ValueType& arg, mpl::true_)
-        {
-            // arg is a fusion sequence (except a variant) return it as-is.
-            return arg;
-        }
-
-        static fusion::vector<ValueType&> const
-        call(ValueType& seq, mpl::false_)
-        {
-            // arg is a not fusion sequence wrap it in a fusion::vector.
-            return fusion::vector<ValueType&>(seq);
-        }
-
-        static type
-        call(ValueType& arg)
-        {
-            return call(arg, is_sequence());
-        }
-    };
-}}}
-
-#endif
Modified: trunk/boost/spirit/home/support/detail/what_function.hpp
==============================================================================
--- trunk/boost/spirit/home/support/detail/what_function.hpp	(original)
+++ trunk/boost/spirit/home/support/detail/what_function.hpp	2009-04-26 10:42:24 EDT (Sun, 26 Apr 2009)
@@ -1,38 +1,38 @@
 /*=============================================================================
-    Copyright (c) 2001-2007 Joel de Guzman
+    Copyright (c) 2001-2009 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(SPIRIT_WHAT_FUNCTION_APR_22_2007_0236PM)
-#define SPIRIT_WHAT_FUNCTION_APR_22_2007_0236PM
+#if !defined(SPIRIT_WHAT_FUNCTION_APRIL_22_2007_0236PM)
+#define SPIRIT_WHAT_FUNCTION_APRIL_22_2007_0236PM
+
+#if defined(_MSC_VER)
+#pragma once
+#endif
 
 #include <string>
+#include <boost/spirit/home/support/info.hpp>
 
 namespace boost { namespace spirit { namespace detail
 {
     template <typename Context>
     struct what_function
     {
-        what_function(std::string& str, Context const& ctx)
-          : str(str), ctx(ctx), first(true)
+        what_function(info& what, Context& context)
+          : what(what), context(context)
         {
+            what.value = std::list<info>();
         }
 
         template <typename Component>
         void operator()(Component const& component) const
         {
-            if (first)
-                first = false;
-            else
-                str += ", ";
-            typedef typename Component::director director;
-            str += director::what(component, ctx);
+            get<std::list<info>&>(what.value).push_back(component.what(context));
         }
 
-        std::string& str;
-        Context const& ctx;
-        mutable bool first;
+        info& what;
+        Context& context;
     };
 }}}
 
Added: trunk/boost/spirit/home/support/info.hpp
==============================================================================
--- (empty file)
+++ trunk/boost/spirit/home/support/info.hpp	2009-04-26 10:42:24 EDT (Sun, 26 Apr 2009)
@@ -0,0 +1,151 @@
+/*=============================================================================
+    Copyright (c) 2001-2009 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_INFO_NOVEMBER_22_2008_1132AM)
+#define BOOST_SPIRIT_INFO_NOVEMBER_22_2008_1132AM
+
+#if defined(_MSC_VER)
+#pragma once
+#endif
+
+#include <boost/variant/variant.hpp>
+#include <boost/variant/recursive_variant.hpp>
+#include <boost/variant/apply_visitor.hpp>
+#include <boost/foreach.hpp>
+#include <boost/spirit/home/support/utf8.hpp>
+#include <list>
+#include <iterator>
+#include <utility>
+
+namespace boost { namespace spirit
+{
+    // info provides information about a component. Each component
+    // has a what member function that returns an info object.
+    // strings in the info object are assumed to be encoded as UTF8
+    // for uniformity.
+    struct info
+    {
+        struct nil {};
+
+        typedef
+            boost::variant<
+                nil
+              , utf8_string
+              , recursive_wrapper<info>
+              , recursive_wrapper<std::pair<info, info> >
+              , std::list<info>
+            >
+        value_type;
+
+        explicit info(utf8_string const& tag)
+          : tag(tag), value(nil()) {}
+
+        template <typename T>
+        info(utf8_string const& tag, T const& value)
+          : tag(tag), value(value) {}
+
+        info(utf8_string const& tag, char value)
+          : tag(tag), value(utf8_string(1, value)) {}
+
+        info(utf8_string const& tag, wchar_t value)
+          : tag(tag), value(to_utf8(value)) {}
+
+        info(utf8_string const& tag, ucs4_char value)
+          : tag(tag), value(to_utf8(value)) {}
+
+        template <typename Char>
+        info(utf8_string const& tag, Char const* str)
+          : tag(tag), value(to_utf8(str)) {}
+
+        template <typename Char, typename Traits, typename Allocator>
+        info(utf8_string const& tag
+              , std::basic_string<Char, Traits, Allocator> const& str)
+          : tag(tag), value(to_utf8(str)) {}
+
+        utf8_string tag;
+        value_type value;
+    };
+
+    template <typename Callback>
+    struct basic_info_walker
+    {
+        typedef void result_type;
+        typedef basic_info_walker<Callback> this_type;
+
+        basic_info_walker(Callback& callback, utf8_string const& tag, int depth)
+          : callback(callback), tag(tag), depth(depth) {}
+
+        void operator()(info::nil) const
+        {
+            callback.element(tag, "", depth);
+        }
+
+        void operator()(utf8_string const& str) const
+        {
+            callback.element(tag, str, depth);
+        }
+
+        void operator()(info const& what) const
+        {
+            boost::apply_visitor(
+                this_type(callback, what.tag, depth+1), what.value);
+        }
+
+        void operator()(std::pair<info, info> const& pair) const
+        {
+            callback.element(tag, "", depth);
+            boost::apply_visitor(
+                this_type(callback, pair.first.tag, depth+1), pair.first.value);
+            boost::apply_visitor(
+                this_type(callback, pair.second.tag, depth+1), pair.second.value);
+        }
+
+        void operator()(std::list<info> const& l) const
+        {
+            callback.element(tag, "", depth);
+            BOOST_FOREACH(info const& what, l)
+            {
+                boost::apply_visitor(
+                    this_type(callback, what.tag, depth+1), what.value);
+            }
+        }
+
+        Callback& callback;
+        utf8_string const& tag;
+        int depth;
+    };
+
+    // bare-bones print support
+    template <typename Out>
+    struct simple_printer
+    {
+        typedef utf8_string string;
+
+        simple_printer(Out& out)
+          : out(out) {}
+
+        void element(string const& tag, string const& value, int depth) const
+        {
+            if (value == "")
+                out << '<' << tag << '>';
+            else
+                out << '"' << value << '"';
+        }
+
+        Out& out;
+    };
+
+    template <typename Out>
+    Out& operator<<(Out& out, info const& what)
+    {
+        simple_printer<Out> pr(out);
+        basic_info_walker<simple_printer<Out> > walker(pr, what.tag, 0);
+        boost::apply_visitor(walker, what.value);
+        return out;
+    }
+}}
+
+#endif
Deleted: trunk/boost/spirit/home/support/iso8859_1.hpp
==============================================================================
--- trunk/boost/spirit/home/support/iso8859_1.hpp	2009-04-26 10:42:24 EDT (Sun, 26 Apr 2009)
+++ (empty file)
@@ -1,70 +0,0 @@
-/*=============================================================================
-    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(SPIRIT_ISO8859_1_JAN_31_2006_0529PM)
-#define SPIRIT_ISO8859_1_JAN_31_2006_0529PM
-
-#include <boost/spirit/home/support/char_class.hpp>
-#include <boost/proto/core.hpp>
-
-namespace boost { namespace spirit { namespace iso8859_1
-{
-    typedef spirit::char_class::iso8859_1 char_set;
-    namespace tag = spirit::char_class::tag;
-    
-    template <typename Class>
-    struct make_tag 
-      : proto::terminal<spirit::char_class::key<char_set, Class> > {};
-
-    typedef make_tag<tag::alnum>::type alnum_type;
-    typedef make_tag<tag::alpha>::type alpha_type;
-    typedef make_tag<tag::blank>::type blank_type;
-    typedef make_tag<tag::cntrl>::type cntrl_type;
-    typedef make_tag<tag::digit>::type digit_type;
-    typedef make_tag<tag::graph>::type graph_type;
-    typedef make_tag<tag::print>::type print_type;
-    typedef make_tag<tag::punct>::type punct_type;
-    typedef make_tag<tag::space>::type space_type;
-    typedef make_tag<tag::xdigit>::type xdigit_type;
-
-    alnum_type const alnum = {{}};
-    alpha_type const alpha = {{}};
-    blank_type const blank = {{}};
-    cntrl_type const cntrl = {{}};
-    digit_type const digit = {{}};
-    graph_type const graph = {{}};
-    print_type const print = {{}};
-    punct_type const punct = {{}};
-    space_type const space = {{}};
-    xdigit_type const xdigit = {{}};
-    
-    typedef proto::terminal<
-        spirit::char_class::no_case_tag<char_set> >::type 
-    no_case_type;
-
-    no_case_type const no_case = no_case_type();
-
-    typedef proto::terminal<
-        spirit::char_class::lower_case_tag<char_set> >::type 
-    lower_type;
-    typedef proto::terminal<
-        spirit::char_class::upper_case_tag<char_set> >::type 
-    upper_type;
-
-    lower_type const lower = lower_type();
-    upper_type const upper = upper_type();
-
-#if defined(__GNUC__)
-    inline void silence_unused_warnings__iso8859_1()
-    {
-        (void) alnum; (void) alpha; (void) blank; (void) cntrl; (void) digit; 
-        (void) graph; (void) print; (void) punct; (void) space;  (void) xdigit;
-    }
-#endif
-
-}}}
-
-#endif
Modified: trunk/boost/spirit/home/support/iterators/detail/buf_id_check_policy.hpp
==============================================================================
--- trunk/boost/spirit/home/support/iterators/detail/buf_id_check_policy.hpp	(original)
+++ trunk/boost/spirit/home/support/iterators/detail/buf_id_check_policy.hpp	2009-04-26 10:42:24 EDT (Sun, 26 Apr 2009)
@@ -1,5 +1,5 @@
 //  Copyright (c) 2001, Daniel C. Nuffer
-//  Copyright (c) 2001-2008, Hartmut Kaiser
+//  Copyright (c) 2001-2009 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)
@@ -46,13 +46,8 @@
         ///////////////////////////////////////////////////////////////////////
         struct unique //: detail::default_checking_policy
         {
-            unique()
-              : buf_id(0)
-            {}
-
-            unique(unique const& x)
-              : buf_id(x.buf_id)
-            {}
+            unique() : buf_id(0) {}
+            unique(unique const& x) : buf_id(x.buf_id) {}
 
             void swap(unique& x)
             {
@@ -76,13 +71,12 @@
             }
 
             template <typename MultiPass>
-            static void destroy(MultiPass&) 
-            {}
+            static void destroy(MultiPass&) {}
 
         protected:
             unsigned long buf_id;
         };
-        
+
         ///////////////////////////////////////////////////////////////////////
         struct shared
         {
Modified: trunk/boost/spirit/home/support/iterators/detail/combine_policies.hpp
==============================================================================
--- trunk/boost/spirit/home/support/iterators/detail/combine_policies.hpp	(original)
+++ trunk/boost/spirit/home/support/iterators/detail/combine_policies.hpp	2009-04-26 10:42:24 EDT (Sun, 26 Apr 2009)
@@ -1,4 +1,4 @@
-//  Copyright (c) 2001-2008, Hartmut Kaiser
+//  Copyright (c) 2001-2009 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)
@@ -6,6 +6,7 @@
 #if !defined(BOOST_SPIRIT_ITERATOR_COMBINE_POLICIES_APR_06_2008_0136PM)
 #define BOOST_SPIRIT_ITERATOR_COMBINE_POLICIES_APR_06_2008_0136PM
 
+#include <boost/config.hpp>
 #include <boost/type_traits/is_empty.hpp>
 
 namespace boost { namespace spirit { namespace multi_pass_policies
@@ -13,12 +14,13 @@
     ///////////////////////////////////////////////////////////////////////////
     //  The purpose of the multi_pass_unique template is to eliminate 
     //  empty policy classes (policies not containing any data items) from the 
-    //  multiple inheritance chain. This is necessary since a compiler is not 
-    //  allowed to apply the empty base optimization if multiple inheritance is 
-    //  involved (or at least most compilers fail to apply it).
+    //  multiple inheritance chain. This is necessary since some compilers 
+    //  fail to apply the empty base optimization if multiple inheritance is 
+    //  involved.
     //  Additionally this can be used to combine separate policies into one 
     //  single multi_pass_policy as required by the multi_pass template
     ///////////////////////////////////////////////////////////////////////////
+
 #if defined(BOOST_NO_TEMPLATE_PARTIAL_SPECIALIZATION)
     // without partial template specialization there is nothing much to do in 
     // terms of empty base optimization anyways...
@@ -49,19 +51,18 @@
 #else
     ///////////////////////////////////////////////////////////////////////////
     // select the correct derived classes based on if a policy is empty
-    template <
-        typename T, 
-        typename Ownership, typename Checking, typename Input, typename Storage,
-        bool OwnershipIsEmpty = boost::is_empty<Ownership>::value, 
-        bool CheckingIsEmpty = boost::is_empty<Checking>::value, 
-        bool InputIsEmpty = boost::is_empty<Input>::value>
+    template <typename T
+      , typename Ownership, typename Checking, typename Input, typename Storage
+      , bool OwnershipIsEmpty = boost::is_empty<Ownership>::value
+      , bool CheckingIsEmpty = boost::is_empty<Checking>::value
+      , bool InputIsEmpty = boost::is_empty<Input>::value>
     struct multi_pass_unique;
 
     ///////////////////////////////////////////////////////////////////////////
-    template <typename T, typename Ownership, typename Checking, 
-        typename Input, typename Storage>
-    struct multi_pass_unique<T, Ownership, Checking, Input, Storage, 
-            false, false, false>
+    template <typename T, typename Ownership, typename Checking
+      , typename Input, typename Storage>
+    struct multi_pass_unique<T, Ownership, Checking, Input, Storage
+          , false, false, false>
       : Ownership, Checking, Input, Storage
     {
         multi_pass_unique() {}
@@ -85,15 +86,15 @@
     };
     
     ///////////////////////////////////////////////////////////////////////////
-    template <typename T, typename Ownership, typename Checking, 
-        typename Input, typename Storage>
-    struct multi_pass_unique<T, Ownership, Checking, Input, Storage, 
-            false, false, true>
+    template <typename T, typename Ownership, typename Checking
+      , typename Input, typename Storage>
+    struct multi_pass_unique<T, Ownership, Checking, Input, Storage
+          , false, false, true>
       : Ownership, Checking, Storage
     {
         multi_pass_unique() {}
         multi_pass_unique(T const& x) {}
-        
+
         template <typename MultiPass>
         static void destroy(MultiPass& mp)
         {
@@ -108,7 +109,7 @@
             this->Checking::swap(x);
             this->Storage::swap(x);
         }
-        
+
         // implement input policy functions by forwarding to the Input type
         template <typename MultiPass, typename TokenType>
         inline static TokenType& advance_input(MultiPass& mp, TokenType& curtok)
@@ -124,10 +125,10 @@
     };
 
     ///////////////////////////////////////////////////////////////////////////
-    template <typename T, typename Ownership, typename Checking, 
-        typename Input, typename Storage>
-    struct multi_pass_unique<T, Ownership, Checking, Input, Storage, 
-            false, true, false>
+    template <typename T, typename Ownership, typename Checking
+      , typename Input, typename Storage>
+    struct multi_pass_unique<T, Ownership, Checking, Input, Storage
+          , false, true, false>
       : Ownership, Input, Storage
     {
         multi_pass_unique() {}
@@ -146,7 +147,7 @@
             this->Input::swap(x);
             this->Storage::swap(x);
         }
-        
+
         // checking policy functions are forwarded to the Checking type
         template <typename MultiPass>
         inline static void check(MultiPass const& mp) 
@@ -158,10 +159,10 @@
     };
 
     ///////////////////////////////////////////////////////////////////////////
-    template <typename T, typename Ownership, typename Checking, 
-        typename Input, typename Storage>
-    struct multi_pass_unique<T, Ownership, Checking, Input, Storage, 
-            false, true, true>
+    template <typename T, typename Ownership, typename Checking
+      , typename Input, typename Storage>
+    struct multi_pass_unique<T, Ownership, Checking, Input, Storage
+          , false, true, true>
       : Ownership, Storage
     {
         multi_pass_unique() {}
@@ -204,10 +205,10 @@
     };
 
     ///////////////////////////////////////////////////////////////////////////
-    template <typename T, typename Ownership, typename Checking, 
-        typename Input, typename Storage>
-    struct multi_pass_unique<T, Ownership, Checking, Input, Storage, 
-            true, false, false>
+    template <typename T, typename Ownership, typename Checking
+      , typename Input, typename Storage>
+    struct multi_pass_unique<T, Ownership, Checking, Input, Storage
+          , true, false, false>
       : Checking, Input, Storage
     {
         multi_pass_unique() {}
@@ -235,17 +236,17 @@
         template <typename MultiPass>
         inline static bool release(MultiPass& mp)
             { return Ownership::release(mp); }
-        
+
         template <typename MultiPass>
         inline static bool is_unique(MultiPass const& mp)
             { return Ownership::is_unique(mp); }
     };
 
     ///////////////////////////////////////////////////////////////////////////
-    template <typename T, typename Ownership, typename Checking, 
-        typename Input, typename Storage>
-    struct multi_pass_unique<T, Ownership, Checking, Input, Storage, 
-            true, false, true>
+    template <typename T, typename Ownership, typename Checking
+      , typename Input, typename Storage>
+    struct multi_pass_unique<T, Ownership, Checking, Input, Storage
+          , true, false, true>
       : Checking, Storage
     {
         multi_pass_unique() {}
@@ -285,17 +286,17 @@
         template <typename MultiPass>
         inline static bool release(MultiPass& mp)
             { return Ownership::release(mp); }
-        
+
         template <typename MultiPass>
         inline static bool is_unique(MultiPass const& mp)
             { return Ownership::is_unique(mp); }
     };
 
     ///////////////////////////////////////////////////////////////////////////
-    template <typename T, typename Ownership, typename Checking, 
-        typename Input, typename Storage>
-    struct multi_pass_unique<T, Ownership, Checking, Input, Storage, 
-            true, true, false>
+    template <typename T, typename Ownership, typename Checking
+      , typename Input, typename Storage>
+    struct multi_pass_unique<T, Ownership, Checking, Input, Storage
+          , true, true, false>
       : Input, Storage
     {
         multi_pass_unique() {}
@@ -312,7 +313,7 @@
             this->Input::swap(x);
             this->Storage::swap(x);
         }
-        
+
         // checking policy functions are forwarded to the Checking type
         template <typename MultiPass>
         inline static void check(MultiPass const& mp) 
@@ -330,17 +331,17 @@
         template <typename MultiPass>
         inline static bool release(MultiPass& mp)
             { return Ownership::release(mp); }
-        
+
         template <typename MultiPass>
         inline static bool is_unique(MultiPass const& mp)
             { return Ownership::is_unique(mp); }
     };
 
     ///////////////////////////////////////////////////////////////////////////
-    template <typename T, typename Ownership, typename Checking, 
-        typename Input, typename Storage>
-    struct multi_pass_unique<T, Ownership, Checking, Input, Storage, 
-            true, true, true>
+    template <typename T, typename Ownership, typename Checking
+      , typename Input, typename Storage>
+    struct multi_pass_unique<T, Ownership, Checking, Input, Storage
+          , true, true, true>
       : Storage
     {
         multi_pass_unique() {}
@@ -365,7 +366,7 @@
         template <typename MultiPass, typename TokenType>
         inline static bool input_at_eof(MultiPass const& mp, TokenType& curtok)
             { return Input::input_at_eof(mp, curtok); }
-        
+
         template <typename MultiPass, typename TokenType>
         inline static bool input_is_valid(MultiPass& mp, TokenType& curtok)
             { return Input::input_is_valid(mp, curtok); }
@@ -387,7 +388,7 @@
         template <typename MultiPass>
         inline static bool release(MultiPass& mp)
             { return Ownership::release(mp); }
-        
+
         template <typename MultiPass>
         inline static bool is_unique(MultiPass const& mp)
             { return Ownership::is_unique(mp); }
@@ -398,83 +399,71 @@
     // the multi_pass_shared structure is used to combine the shared data items 
     // of all policies into one single structure
     ///////////////////////////////////////////////////////////////////////////
-    template<
-        typename T, typename Ownership, typename Checking, typename Input, 
-        typename Storage
-    >
+    template<typename T, typename Ownership, typename Checking, typename Input
+      , typename Storage>
     struct multi_pass_shared : Ownership, Checking, Input, Storage
     {
-        explicit multi_pass_shared(T const& input)
-          : Input(input)
-        {}
+        explicit multi_pass_shared(T const& input) : Input(input) {}
     };
-    
+
     ///////////////////////////////////////////////////////////////////////////
     //  This is a default implementation of a policy class as required by the
     //  multi_pass template, combining 4 separate policies into one. Any other
     //  multi_pass policy class needs to follow the scheme as shown below.
-    template<
-        typename Ownership, typename Checking, typename Input, typename Storage
-    >
+    template<typename Ownership, typename Checking, typename Input
+      , typename Storage>
     struct default_policy
     {
         typedef Ownership ownership_policy;
         typedef Checking checking_policy;
         typedef Input input_policy;
         typedef Storage storage_policy;
-            
+
         ///////////////////////////////////////////////////////////////////////
         template <typename T>
-        struct unique 
-          : multi_pass_unique<
-                T, typename Ownership::unique, typename Checking::unique,
-                typename Input::BOOST_NESTED_TEMPLATE unique<T>,
-                typename Storage::BOOST_NESTED_TEMPLATE unique<
-                    typename Input::BOOST_NESTED_TEMPLATE unique<T>::value_type>
-            >
+        struct unique : multi_pass_unique<T
+          , typename Ownership::unique, typename Checking::unique
+          , typename Input::BOOST_NESTED_TEMPLATE unique<T>
+          , typename Storage::BOOST_NESTED_TEMPLATE unique<
+                typename Input::BOOST_NESTED_TEMPLATE unique<T>::value_type> >
         {
             typedef typename Ownership::unique ownership_policy;
             typedef typename Checking::unique checking_policy;
             typedef typename Input::BOOST_NESTED_TEMPLATE unique<T> 
                 input_policy;
             typedef typename Storage::BOOST_NESTED_TEMPLATE unique<
-                        typename input_policy::value_type> 
-                storage_policy;
+                typename input_policy::value_type> storage_policy;
 
-            typedef multi_pass_unique<T, ownership_policy, checking_policy, 
-                    input_policy, storage_policy>
-                unique_base_type;
+            typedef multi_pass_unique<T, ownership_policy, checking_policy
+              , input_policy, storage_policy> unique_base_type;
 
             unique() {}
             explicit unique(T const& input) : unique_base_type(input) {}
         };
-        
+
         ///////////////////////////////////////////////////////////////////////
         template <typename T>
-        struct shared
-          : multi_pass_shared<T, 
-                typename Ownership::shared, typename Checking::shared, 
-                typename Input::BOOST_NESTED_TEMPLATE shared<T>,
-                typename Storage::BOOST_NESTED_TEMPLATE shared<
-                    typename Input::BOOST_NESTED_TEMPLATE unique<T>::value_type>
-            > 
+        struct shared : multi_pass_shared<T
+          , typename Ownership::shared, typename Checking::shared
+          , typename Input::BOOST_NESTED_TEMPLATE shared<T>
+          , typename Storage::BOOST_NESTED_TEMPLATE shared<
+                typename Input::BOOST_NESTED_TEMPLATE unique<T>::value_type> > 
         {
             typedef typename Ownership::shared ownership_policy;
             typedef typename Checking::shared checking_policy;
             typedef typename Input::BOOST_NESTED_TEMPLATE shared<T> 
                 input_policy;
             typedef typename Storage::BOOST_NESTED_TEMPLATE shared<
-                    typename Input::BOOST_NESTED_TEMPLATE unique<T>::value_type> 
-                storage_policy;
+                typename Input::BOOST_NESTED_TEMPLATE unique<T>::value_type> 
+            storage_policy;
+
+            typedef multi_pass_shared<T, ownership_policy, checking_policy
+              , input_policy, storage_policy> shared_base_type;
 
-            typedef multi_pass_shared<T, ownership_policy, checking_policy, 
-                    input_policy, storage_policy>
-                shared_base_type;
-            
             explicit shared(T const& input) : shared_base_type(input) {}
         };
     };
-    
+
 }}}
 
 #endif
Modified: trunk/boost/spirit/home/support/iterators/detail/first_owner_policy.hpp
==============================================================================
--- trunk/boost/spirit/home/support/iterators/detail/first_owner_policy.hpp	(original)
+++ trunk/boost/spirit/home/support/iterators/detail/first_owner_policy.hpp	2009-04-26 10:42:24 EDT (Sun, 26 Apr 2009)
@@ -1,5 +1,5 @@
 //  Copyright (c) 2001, Daniel C. Nuffer
-//  Copyright (c) 2001-2008, Hartmut Kaiser
+//  Copyright (c) 2001-2009 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)
@@ -29,13 +29,8 @@
         ///////////////////////////////////////////////////////////////////////
         struct unique // : detail::default_ownership_policy
         {
-            unique()
-              : first(true)
-            {}
-
-            unique(unique const&)
-              : first(false)
-            {}
+            unique() : first(true) {}
+            unique(unique const&) : first(false) {}
 
             // return true to indicate deletion of resources
             template <typename MultiPass>
@@ -46,7 +41,7 @@
 
             // use swap from default policy
             // if we're the first, we still remain the first, even if assigned
-            // to, so don't swap first_.  swap is only called from operator=
+            // to, so don't swap first.  swap is only called from operator=
 
             template <typename MultiPass>
             static bool is_unique(MultiPass const&) 
@@ -59,12 +54,9 @@
         };
 
         ////////////////////////////////////////////////////////////////////////
-        struct shared
-        {
-            // no shared data
-        };
+        struct shared {};   // no shared data
     };
-    
+
 }}}
 
 #endif
Modified: trunk/boost/spirit/home/support/iterators/detail/fixed_size_queue.hpp
==============================================================================
--- trunk/boost/spirit/home/support/iterators/detail/fixed_size_queue.hpp	(original)
+++ trunk/boost/spirit/home/support/iterators/detail/fixed_size_queue.hpp	2009-04-26 10:42:24 EDT (Sun, 26 Apr 2009)
@@ -1,5 +1,5 @@
-//  Copyright (c) 2001, Daniel C. Nuffer
-//  Copyright (c) 2001-2008, Hartmut Kaiser
+//  Copyright (c) 2001 Daniel C. Nuffer
+//  Copyright (c) 2001-2009 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)
@@ -47,12 +47,12 @@
 
         fsq_iterator() {}
         fsq_iterator(position_type const &p_) : p(p_) {}
-        
+
         position_type const &get_position() const { return p; }
-        
+
     private:
         friend class boost::iterator_core_access;
-        
+
         typename base_type::reference dereference() const
         {
             return p.self->m_queue[p.pos];
@@ -138,7 +138,7 @@
                     p.pos -= Queue::MAX_SIZE+1;
             }
         }
-        
+
     private:
         position_type p;
     };
@@ -173,7 +173,7 @@
 
         friend class fsq_iterator<fixed_size_queue<T, N>, T, T*>;
         friend class fsq_iterator<fixed_size_queue<T, N>, T const, T const*>;
-        
+
         fixed_size_queue();
         fixed_size_queue(const fixed_size_queue& x);
         fixed_size_queue& operator=(const fixed_size_queue& x);
Modified: trunk/boost/spirit/home/support/iterators/detail/fixed_size_queue_policy.hpp
==============================================================================
--- trunk/boost/spirit/home/support/iterators/detail/fixed_size_queue_policy.hpp	(original)
+++ trunk/boost/spirit/home/support/iterators/detail/fixed_size_queue_policy.hpp	2009-04-26 10:42:24 EDT (Sun, 26 Apr 2009)
@@ -1,5 +1,5 @@
-//  Copyright (c) 2001, Daniel C. Nuffer
-//  Copyright (c) 2001-2008, Hartmut Kaiser
+//  Copyright (c) 2001 Daniel C. Nuffer
+//  Copyright (c) 2001-2009 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)
@@ -38,12 +38,10 @@
             typedef detail::fixed_size_queue<Value, N> queue_type;
 
         protected:
-            unique()
-            {}
+            unique() {}
 
             unique(unique const& x)
-              : queuePosition(x.queuePosition)
-            {}
+              : queuePosition(x.queuePosition) {}
 
             void swap(unique& x)
             {
Modified: trunk/boost/spirit/home/support/iterators/detail/functor_input_policy.hpp
==============================================================================
--- trunk/boost/spirit/home/support/iterators/detail/functor_input_policy.hpp	(original)
+++ trunk/boost/spirit/home/support/iterators/detail/functor_input_policy.hpp	2009-04-26 10:42:24 EDT (Sun, 26 Apr 2009)
@@ -1,4 +1,4 @@
-//  Copyright (c) 2001-2008, Hartmut Kaiser
+//  Copyright (c) 2001-2009 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)
@@ -20,7 +20,7 @@
             return true;
         }
     }
-    
+
     ///////////////////////////////////////////////////////////////////////////
     //  class functor_input
     //  Implementation of the InputPolicy used by multi_pass
Modified: trunk/boost/spirit/home/support/iterators/detail/input_iterator_policy.hpp
==============================================================================
--- trunk/boost/spirit/home/support/iterators/detail/input_iterator_policy.hpp	(original)
+++ trunk/boost/spirit/home/support/iterators/detail/input_iterator_policy.hpp	2009-04-26 10:42:24 EDT (Sun, 26 Apr 2009)
@@ -1,5 +1,5 @@
-//  Copyright (c) 2001, Daniel C. Nuffer
-//  Copyright (c) 2001-2008, Hartmut Kaiser
+//  Copyright (c) 2001 Daniel C. Nuffer
+//  Copyright (c) 2001-2009 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)
Modified: trunk/boost/spirit/home/support/iterators/detail/lex_input_policy.hpp
==============================================================================
--- trunk/boost/spirit/home/support/iterators/detail/lex_input_policy.hpp	(original)
+++ trunk/boost/spirit/home/support/iterators/detail/lex_input_policy.hpp	2009-04-26 10:42:24 EDT (Sun, 26 Apr 2009)
@@ -1,5 +1,5 @@
-//  Copyright (c) 2001, Daniel C. Nuffer
-//  Copyright (c) 2001-2008, Hartmut Kaiser
+//  Copyright (c) 2001 Daniel C. Nuffer
+//  Copyright (c) 2001-2009 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)
Modified: trunk/boost/spirit/home/support/iterators/detail/multi_pass.hpp
==============================================================================
--- trunk/boost/spirit/home/support/iterators/detail/multi_pass.hpp	(original)
+++ trunk/boost/spirit/home/support/iterators/detail/multi_pass.hpp	2009-04-26 10:42:24 EDT (Sun, 26 Apr 2009)
@@ -1,5 +1,5 @@
-//  Copyright (c) 2001, Daniel C. Nuffer
-//  Copyright (c) 2001-2008, Hartmut Kaiser
+//  Copyright (c) 2001 Daniel C. Nuffer
+//  Copyright (c) 2001-2009 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)
@@ -7,6 +7,7 @@
 #if !defined(BOOST_SPIRIT_ITERATOR_MULTI_PASS_MAR_16_2007_1122AM)
 #define BOOST_SPIRIT_ITERATOR_MULTI_PASS_MAR_16_2007_1122AM
 
+#include <boost/config.hpp>
 #include <boost/spirit/home/support/iterators/multi_pass_fwd.hpp>
 #include <boost/iterator.hpp>
 #include <boost/mpl/bool.hpp>
@@ -24,7 +25,7 @@
         using boost::spirit::swap;
         swap(t1, t2);
     }
-    
+
 #if defined(BOOST_NO_TEMPLATE_PARTIAL_SPECIALIZATION)
     ///////////////////////////////////////////////////////////////////////////
     //  Meta-function to generate a std::iterator<> base class for multi_pass. 
@@ -40,11 +41,11 @@
         typedef typename InputPolicy::BOOST_NESTED_TEMPLATE unique<T> input_type;
 
         typedef boost::iterator <
-            std::forward_iterator_tag,
-            typename input_type::value_type,
-            typename input_type::difference_type,
-            typename input_type::pointer,
-            typename input_type::reference
+            std::forward_iterator_tag
+          , typename input_type::value_type
+          , typename input_type::difference_type
+          , typename input_type::pointer
+          , typename input_type::reference
         > type;
     };
 #endif
@@ -56,15 +57,15 @@
     struct default_input_policy
     {
         default_input_policy() {}
-        
+
         template <typename Functor>
         default_input_policy(Functor const&) {}
-        
+
         template <typename MultiPass>
         static void destroy(MultiPass&) {}
-        
+
         void swap(default_input_policy&) {}
-        
+
         template <typename MultiPass, typename TokenType>
         static TokenType& advance_input(MultiPass& mp, TokenType& curtok);
 
@@ -74,7 +75,7 @@
         template <typename MultiPass, typename TokenType>
         static bool input_is_valid(MultiPass& mp, TokenType& curtok);
     };
-    
+
     struct default_ownership_policy
     {
         template <typename MultiPass>
@@ -87,11 +88,11 @@
 
         template <typename MultiPass>
         static bool release(MultiPass& mp);
-        
+
         template <typename MultiPass>
         static bool is_unique(MultiPass const& mp);
     };
-    
+
     struct default_storage_policy
     {
         template <typename MultiPass>
@@ -101,10 +102,10 @@
 
         template <typename MultiPass>
         static typename MultiPass::reference dereference(MultiPass const& mp);
-        
+
         template <typename MultiPass>
         static void increment(MultiPass&) {}
-        
+
         template <typename MultiPass>
         static void clear_queue(MultiPass&) {}
 
@@ -117,7 +118,7 @@
         template <typename MultiPass>
         static bool less_than(MultiPass const& mp, MultiPass const& x);
     };
-    
+
     struct default_checking_policy
     {
         template <typename MultiPass>
@@ -131,7 +132,7 @@
         template <typename MultiPass>
         static void clear_queue(MultiPass&) {}
     };
-    
+
 }}}
 
 #endif
Modified: trunk/boost/spirit/home/support/iterators/detail/no_check_policy.hpp
==============================================================================
--- trunk/boost/spirit/home/support/iterators/detail/no_check_policy.hpp	(original)
+++ trunk/boost/spirit/home/support/iterators/detail/no_check_policy.hpp	2009-04-26 10:42:24 EDT (Sun, 26 Apr 2009)
@@ -1,5 +1,5 @@
-//  Copyright (c) 2001, Daniel C. Nuffer
-//  Copyright (c) 2001-2008, Hartmut Kaiser
+//  Copyright (c) 2001 Daniel C. Nuffer
+//  Copyright (c) 2001-2009 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)
@@ -35,8 +35,7 @@
         };
 
         ///////////////////////////////////////////////////////////////////////
-        struct shared 
-        {};
+        struct shared {};
     };
 
 }}}
Modified: trunk/boost/spirit/home/support/iterators/detail/ref_counted_policy.hpp
==============================================================================
--- trunk/boost/spirit/home/support/iterators/detail/ref_counted_policy.hpp	(original)
+++ trunk/boost/spirit/home/support/iterators/detail/ref_counted_policy.hpp	2009-04-26 10:42:24 EDT (Sun, 26 Apr 2009)
@@ -1,5 +1,5 @@
-//  Copyright (c) 2001, Daniel C. Nuffer
-//  Copyright (c) 2001-2008, Hartmut Kaiser
+//  Copyright (c) 2001 Daniel C. Nuffer
+//  Copyright (c) 2001-2009 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)
@@ -54,8 +54,7 @@
             }
 
             template <typename MultiPass>
-            static void destroy(MultiPass&) 
-            {}
+            static void destroy(MultiPass&) {}
         };
 
         ////////////////////////////////////////////////////////////////////////
Modified: trunk/boost/spirit/home/support/iterators/detail/split_functor_input_policy.hpp
==============================================================================
--- trunk/boost/spirit/home/support/iterators/detail/split_functor_input_policy.hpp	(original)
+++ trunk/boost/spirit/home/support/iterators/detail/split_functor_input_policy.hpp	2009-04-26 10:42:24 EDT (Sun, 26 Apr 2009)
@@ -1,4 +1,4 @@
-//  Copyright (c) 2001-2008, Hartmut Kaiser
+//  Copyright (c) 2001-2009 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)
@@ -21,13 +21,13 @@
             return true;
         }
     }
-    
+
     ///////////////////////////////////////////////////////////////////////////
     //  class split_functor_input
     //  Implementation of the InputPolicy used by multi_pass
     //  split_functor_input gets tokens from a functor
     // 
-    //  This policy should be used when the functor hold two parts of data: a
+    //  This policy should be used when the functor holds two parts of data: a
     //  unique part (unique for each instance of the iterator) and a shared 
     //  part (to be shared between the different copies of the same iterator).
     //  Using this policy allows to merge the shared part of the functor with 
@@ -46,15 +46,13 @@
     struct split_functor_input
     {
         ///////////////////////////////////////////////////////////////////////
-        template <
-            typename Functor, 
-            bool FunctorIsEmpty = is_empty<typename Functor::first_type>::value
-        >
+        template <typename Functor
+          , bool FunctorIsEmpty = is_empty<typename Functor::first_type>::value>
         class unique;
-        
+
         // the unique part of the functor is empty, do not include the functor 
-        // at all to avoid unnecessary padding bytes to be included into the 
-        // generated structure
+        // as a member at all to avoid unnecessary padding bytes to be included 
+        // into the generated structure
         template <typename Functor>
         class unique<Functor, true> // : public detail::default_input_policy
         {
@@ -80,9 +78,9 @@
             template <typename MultiPass>
             static value_type& advance_input(MultiPass& mp, value_type& t)
             {
-                // passing the current token instance as a parameter helps
-                // generating better code if compared to assigning the 
-                // result of the functor to this instance
+                // passing a refernec to the current token instance as a 
+                // parameter helps generating better code if compared to 
+                // assigning the result of the functor to this instance
                 return functor_type::get_next(mp, t);
             }
 
@@ -106,7 +104,7 @@
                 functor_type::destroy(mp);
             }
         };
-        
+
         // the unique part of the functor is non-empty
         template <typename Functor>
         class unique<Functor, false> : public unique<Functor, true>
@@ -136,9 +134,9 @@
             template <typename MultiPass>
             static value_type& advance_input(MultiPass& mp, value_type& t)
             {
-                // passing the current token instance as a parameter helps
-                // generating better code if compared to assigning the 
-                // result of the functor to this instance
+                // passing a refernec to the current token instance as a 
+                // parameter helps generating better code if compared to 
+                // assigning the result of the functor to this instance
                 return mp.ftor.get_next(mp, t);
             }
 
Modified: trunk/boost/spirit/home/support/iterators/detail/split_std_deque_policy.hpp
==============================================================================
--- trunk/boost/spirit/home/support/iterators/detail/split_std_deque_policy.hpp	(original)
+++ trunk/boost/spirit/home/support/iterators/detail/split_std_deque_policy.hpp	2009-04-26 10:42:24 EDT (Sun, 26 Apr 2009)
@@ -1,5 +1,5 @@
-//  Copyright (c) 2001, Daniel C. Nuffer
-//  Copyright (c) 2001-2008, Hartmut Kaiser
+//  Copyright (c) 2001 Daniel C. Nuffer
+//  Copyright (c) 2001-2009 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)
@@ -26,7 +26,7 @@
     struct split_std_deque
     {
         enum { threshold = 16 };
-        
+
         ///////////////////////////////////////////////////////////////////////
         template <typename Value>
         class unique //: public detail::default_storage_policy
@@ -35,13 +35,10 @@
             typedef std::vector<Value> queue_type;
 
         protected:
-            unique()
-              : queued_position(0)
-            {}
+            unique() : queued_position(0) {}
 
             unique(unique const& x)
-              : queued_position(x.queued_position)
-            {}
+              : queued_position(x.queued_position) {}
 
             void swap(unique& x)
             {
@@ -80,6 +77,14 @@
             {
                 queue_type& queue = mp.shared->queued_elements;
                 typename queue_type::size_type size = queue.size();
+
+                // The following assertion fires if the iterator gets 
+                // incremented before being dereferenced for the first time.
+                // This may happen if you use the postincrement operator
+                // at the same time as you dereference it: *it++, which is 
+                // invalid for this input iterator because the data storage
+                // is shared between its copies and incrementing affects all
+                // copies at the same time.
                 BOOST_ASSERT(0 != size && mp.queued_position <= size);
                 if (mp.queued_position == size)
                 {
@@ -93,7 +98,7 @@
                         // erase all but first item in queue
                         queue.erase(queue.begin()+1, queue.end());
                         mp.queued_position = 0;
-                        
+
                         // reuse first entry in the queue and initialize 
                         // it from the input
                         MultiPass::advance_input(mp, queue[mp.queued_position++]);
@@ -145,8 +150,7 @@
             }
             
             template <typename MultiPass>
-            static void destroy(MultiPass&) 
-            {}
+            static void destroy(MultiPass&) {}
 
         protected:
             mutable typename queue_type::size_type queued_position;
@@ -157,7 +161,7 @@
         struct shared
         {
             shared() { queued_elements.reserve(threshold); }
-            
+
             typedef std::vector<Value> queue_type;
             queue_type queued_elements;
         }; 
Modified: trunk/boost/spirit/home/support/iterators/look_ahead.hpp
==============================================================================
--- trunk/boost/spirit/home/support/iterators/look_ahead.hpp	(original)
+++ trunk/boost/spirit/home/support/iterators/look_ahead.hpp	2009-04-26 10:42:24 EDT (Sun, 26 Apr 2009)
@@ -1,5 +1,5 @@
 //  Copyright (c) 2001, Daniel C. Nuffer
-//  Copyright (c) 2001-2008, Hartmut Kaiser
+//  Copyright (c) 2001-2009 Hartmut Kaiser
 //  http://spirit.sourceforge.net/
 // 
 //  Distributed under the Boost Software License, Version 1.0. (See accompanying
Modified: trunk/boost/spirit/home/support/iterators/multi_pass.hpp
==============================================================================
--- trunk/boost/spirit/home/support/iterators/multi_pass.hpp	(original)
+++ trunk/boost/spirit/home/support/iterators/multi_pass.hpp	2009-04-26 10:42:24 EDT (Sun, 26 Apr 2009)
@@ -1,5 +1,5 @@
 //  Copyright (c) 2001, Daniel C. Nuffer
-//  Copyright (c) 2001-2008, Hartmut Kaiser
+//  Copyright (c) 2001-2009 Hartmut Kaiser
 //  http://spirit.sourceforge.net/
 // 
 //  Distributed under the Boost Software License, Version 1.0. (See accompanying
@@ -8,6 +8,7 @@
 #if !defined(BOOST_SPIRIT_ITERATOR_MULTI_PASS_MAR_16_2007_1124AM)
 #define BOOST_SPIRIT_ITERATOR_MULTI_PASS_MAR_16_2007_1124AM
 
+#include <boost/config.hpp>
 #include <boost/spirit/home/support/iterators/multi_pass_fwd.hpp>
 #include <boost/spirit/home/support/iterators/detail/multi_pass.hpp>
 #include <boost/spirit/home/support/iterators/detail/combine_policies.hpp>
@@ -32,7 +33,7 @@
             policies_base_type;
         typedef typename Policies::BOOST_NESTED_TEMPLATE shared<T> 
             shared_data_type;
-                
+
         // define the types the standard embedded iterator typedefs are taken 
         // from
 #if defined(BOOST_NO_TEMPLATE_PARTIAL_SPECIALIZATION)
@@ -50,13 +51,10 @@
         typedef typename iterator_type::reference reference;
         typedef typename iterator_type::pointer pointer;
 
-        multi_pass()
-          : shared(0)
-        {}
-        
+        multi_pass() : shared(0) {}
+
         explicit multi_pass(T input)
-          : shared(new shared_data_type(input)), policies_base_type(input)
-        {}
+          : shared(new shared_data_type(input)), policies_base_type(input) {}
 
 #if BOOST_WORKAROUND(__GLIBCPP__, == 20020514)
         // The standard library shipped with gcc-3.1 has a bug in
@@ -65,9 +63,7 @@
         // checking code that isn't required by the standard.
         // The workaround is to provide an additional constructor that
         // ignores its int argument and behaves like the default constructor.
-        multi_pass(int)
-          : shared(0)
-        {}
+        multi_pass(int) : shared(0) {}
 #endif // BOOST_WORKAROUND(__GLIBCPP__, == 20020514)
 
         ~multi_pass()
@@ -83,7 +79,7 @@
         {
             policies_base_type::clone(*this);
         }
-        
+
         multi_pass& operator=(multi_pass const& x)
         {
             if (this != &x) {
@@ -133,7 +129,7 @@
                 return y.is_eof();
             if (y.is_eof())
                 return false;
-                
+
             return policies_base_type::equal_to(*this, y);
         }
         bool operator<(multi_pass const& y) const
@@ -146,7 +142,7 @@
         {
             return (0 == shared) || policies_base_type::is_eof(*this);
         }
-        
+
     public:
         shared_data_type *shared;
     };
@@ -192,8 +188,7 @@
 
     template <typename T, typename Policies>
     inline void 
-    swap(multi_pass<T, Policies> &x,
-         multi_pass<T, Policies> &y)
+    swap(multi_pass<T, Policies> &x, multi_pass<T, Policies> &y)
     {
         x.swap(y);
     }
Added: trunk/boost/spirit/home/support/lazy.hpp
==============================================================================
--- (empty file)
+++ trunk/boost/spirit/home/support/lazy.hpp	2009-04-26 10:42:24 EDT (Sun, 26 Apr 2009)
@@ -0,0 +1,37 @@
+/*=============================================================================
+    Copyright (c) 2001-2009 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_LAZY_NOVEMBER_04_2008_1157AM)
+#define BOOST_SPIRIT_LAZY_NOVEMBER_04_2008_1157AM
+
+#if defined(_MSC_VER)
+#pragma once
+#endif
+
+#include <boost/proto/proto.hpp>
+#include <boost/spirit/home/phoenix/core/actor.hpp>
+#include <boost/spirit/home/support/modify.hpp>
+
+namespace boost { namespace spirit
+{
+    template <typename Eval>
+    typename proto::terminal<phoenix::actor<Eval> >::type
+    lazy(phoenix::actor<Eval> const& f)
+    {
+        return proto::terminal<phoenix::actor<Eval> >::type::make(f);
+    }
+
+    namespace tag
+    {
+        struct lazy_eval {};
+    }
+
+    template <typename Domain>
+    struct is_modifier_directive<Domain, tag::lazy_eval>
+      : mpl::true_ {};
+}}
+
+#endif
Added: trunk/boost/spirit/home/support/make_component.hpp
==============================================================================
--- (empty file)
+++ trunk/boost/spirit/home/support/make_component.hpp	2009-04-26 10:42:24 EDT (Sun, 26 Apr 2009)
@@ -0,0 +1,359 @@
+/*=============================================================================
+  Copyright (c) 2001-2009 Joel de Guzman
+  http://spirit.sourceforge.net/
+
+  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)
+=============================================================================*/
+#ifndef BOOST_SPIRIT_MAKE_COMPONENT_OCTOBER_16_2008_1250PM
+#define BOOST_SPIRIT_MAKE_COMPONENT_OCTOBER_16_2008_1250PM
+
+#if defined(_MSC_VER)
+#pragma once
+#endif
+
+#include <boost/proto/proto.hpp>
+#include <boost/spirit/home/support/detail/make_cons.hpp>
+#include <boost/spirit/home/support/modify.hpp>
+
+namespace boost { namespace spirit
+{
+    // There is no real "component" class. Each domain is responsible
+    // for creating its own components. You need to specialize this for
+    // each component in your domain. Use this as a guide.
+
+    template <typename Domain, typename Tag, typename Enable = void>
+    struct make_component
+    {
+        template <typename Sig>
+        struct result;
+
+        template <typename This, typename Elements, typename Modifiers>
+        struct result<This(Elements, Modifiers)>;
+
+        template <typename Elements, typename Modifiers>
+        typename result<make_component(Elements, Modifiers)>::type
+        operator()(Elements const& elements, Modifiers const& modifiers) const;
+    };
+
+    namespace tag
+    {
+        struct directive;
+        struct action;
+    }
+
+    template <typename Domain, typename T, typename Enable = void>
+    struct flatten_tree;
+}}
+
+namespace boost { namespace spirit { namespace detail
+{
+    template <typename Domain>
+    struct make_terminal : proto::transform<make_terminal<Domain> >
+    {
+        template<typename Expr, typename State, typename Data>
+        struct impl : proto::transform_impl<Expr, State, Data>
+        {
+            typedef typename
+                proto::result_of::value<Expr>::type 
+            value;
+
+            typedef typename result_of::make_cons<value>::type elements;
+
+            typedef
+                make_component<Domain, proto::tag::terminal>
+            make_component_;
+
+            typedef typename
+                make_component_::template
+                    result<make_component_(elements, Data)>::type
+            result_type;
+
+            result_type operator()(
+                typename impl::expr_param expr
+              , typename impl::state_param state
+              , typename impl::data_param data
+            ) const
+            {
+                return typename impl::make_component_()(
+                    detail::make_cons(proto::value(expr))
+                  , data
+                );
+            }
+        };
+    };
+
+    template <typename Domain, typename Tag, typename Grammar>
+    struct make_unary : proto::transform<make_unary<Domain, Tag, Grammar> >
+    {
+        template<typename Expr, typename State, typename Data>
+        struct impl : proto::transform_impl<Expr, State, Data>
+        {
+            typedef typename
+                proto::result_of::child_c<Expr, 0>::type
+            child;
+
+            typedef typename Grammar::
+                template result<Grammar(child, State, Data)>::type
+            child_component;
+
+            typedef typename
+                result_of::make_cons<child_component>::type
+            elements;
+
+            typedef make_component<Domain, Tag> make_component_;
+
+            typedef typename
+                make_component_::template
+                    result<make_component_(elements, Data)>::type
+            result_type;
+
+            result_type operator()(
+                typename impl::expr_param expr
+              , typename impl::state_param state
+              , typename impl::data_param data
+            ) const
+            {
+                return typename impl::make_component_()(
+                    detail::make_cons(
+                        Grammar()(proto::child(expr), state, data))
+                  , data
+                );
+            }
+        };
+    };
+
+    // un-flattened version
+    template <typename Domain, typename Tag, typename Grammar,
+        bool flatten = flatten_tree<Domain, Tag>::value>
+    struct make_binary
+    {
+        template<typename Expr, typename State, typename Data>
+        struct impl : proto::transform_impl<Expr, State, Data>
+        {
+            typedef typename Grammar::
+                template result<Grammar(
+                    typename proto::result_of::child_c<Expr, 0>::type
+                  , State, Data)>::type
+            lhs_component;
+
+            typedef typename Grammar::
+                template result<Grammar(
+                    typename proto::result_of::child_c<Expr, 1>::type
+                  , State, Data)>::type
+            rhs_component;
+
+            typedef typename
+                result_of::make_cons<
+                    lhs_component
+                  , typename result_of::make_cons<rhs_component>::type
+                >::type
+            elements_type;
+
+            typedef make_component<Domain, Tag> make_component_;
+
+            typedef typename
+                make_component_::template
+                    result<make_component_(elements_type, Data)>::type
+            result_type;
+
+            result_type operator()(
+                typename impl::expr_param expr
+              , typename impl::state_param state
+              , typename impl::data_param data
+            ) const
+            {
+                elements_type elements =
+                    detail::make_cons(
+                        Grammar()(
+                            proto::child_c<0>(expr), state, data)       // LHS
+                      , detail::make_cons(
+                            Grammar()(
+                                proto::child_c<1>(expr), state, data)   // RHS
+                        )
+                    );
+
+                return make_component_()(elements, data);
+            }
+        };
+    };
+
+    template <typename Grammar>
+    struct make_binary_helper : proto::transform<make_binary_helper<Grammar> >
+    {
+        template<typename Expr, typename State, typename Data>
+        struct impl : proto::transform_impl<Expr, State, Data>
+        {
+            typedef typename Grammar::
+                template result<Grammar(Expr, State, Data)>::type
+            lhs;
+
+            typedef typename result_of::make_cons<lhs, State>::type result_type;
+
+            result_type operator()(
+                typename impl::expr_param expr
+              , typename impl::state_param state
+              , typename impl::data_param data
+            ) const
+            {
+                return detail::make_cons(Grammar()(expr, state, data), state);
+            }
+        };
+    };
+
+    // Flattened version
+    template <typename Domain, typename Tag, typename Grammar>
+    struct make_binary<Domain, Tag, Grammar, true>
+      : proto::transform<make_binary<Domain, Tag, Grammar> >
+    {
+        template<typename Expr, typename State, typename Data>
+        struct impl : proto::transform_impl<Expr, State, Data>
+        {
+            typedef typename
+                proto::reverse_fold_tree<
+                    proto::_
+                  , proto::make<fusion::nil>
+                  , make_binary_helper<Grammar>
+                >::template impl<Expr, State, Data>
+            reverse_fold_tree;
+
+            typedef typename reverse_fold_tree::result_type elements;
+            typedef make_component<Domain, Tag> make_component_;
+
+            typedef typename
+                make_component_::template
+                    result<make_component_(elements, Data)>::type
+            result_type;
+
+            result_type operator()(
+                typename impl::expr_param expr
+              , typename impl::state_param state
+              , typename impl::data_param data
+            ) const
+            {
+                return make_component_()(
+                    reverse_fold_tree()(expr, state, data), data);
+            }
+        };
+    };
+
+    template <typename Domain, typename Grammar>
+    struct make_directive : proto::transform<make_directive<Domain, Grammar> >
+    {
+        template<typename Expr, typename State, typename Data>
+        struct impl : proto::transform_impl<Expr, State, Data>
+        {
+            typedef typename
+                proto::result_of::child_c<Expr, 0>::type
+            lhs;
+
+            typedef typename
+                proto::result_of::value<lhs>::type
+            tag_type;
+
+            typedef typename modify<Domain>::
+                template result<modify<Domain>(tag_type, Data)>::type
+            modifier_type;
+
+            typedef typename Grammar::
+                template result<Grammar(
+                    typename proto::result_of::child_c<Expr, 1>::type
+                  , State
+                  , modifier_type
+                )>::type
+            rhs_component;
+
+            typedef typename
+                result_of::make_cons<
+                    tag_type
+                  , typename result_of::make_cons<rhs_component>::type
+                >::type
+            elements_type;
+
+            typedef make_component<Domain, tag::directive> make_component_;
+
+            typedef typename
+                make_component_::template
+                    result<make_component_(elements_type, Data)>::type
+            result_type;
+
+            result_type operator()(
+                typename impl::expr_param expr
+              , typename impl::state_param state
+              , typename impl::data_param data
+            ) const
+            {
+                tag_type tag = proto::value(proto::child_c<0>(expr));
+                typename remove_reference<modifier_type>::type
+                    modifier = modify<Domain>()(tag, data);
+
+                elements_type elements =
+                    detail::make_cons(
+                        tag                                 // LHS
+                      , detail::make_cons(
+                            Grammar()(
+                                proto::child_c<1>(expr)     // RHS
+                              , state, modifier)
+                        )
+                    );
+
+                return make_component_()(elements, data);
+            }
+        };
+    };
+
+    template <typename Domain, typename Grammar>
+    struct make_action : proto::transform<make_action<Domain, Grammar> >
+    {
+        template<typename Expr, typename State, typename Data>
+        struct impl : proto::transform_impl<Expr, State, Data>
+        {
+            typedef typename Grammar::
+                template result<Grammar(
+                    typename proto::result_of::child_c<Expr, 0>::type
+                  , State
+                  , Data
+                )>::type
+            lhs_component;
+
+            typedef typename
+                proto::result_of::value<
+                    typename proto::result_of::child_c<Expr, 1>::type
+                >::type
+            rhs_component;
+
+            typedef typename
+                result_of::make_cons<
+                    lhs_component
+                  , typename result_of::make_cons<rhs_component>::type
+                >::type
+            elements_type;
+
+            typedef make_component<Domain, tag::action> make_component_;
+
+            typedef typename
+                make_component_::template
+                    result<make_component_(elements_type, Data)>::type
+            result_type;
+
+            result_type operator()(
+                typename impl::expr_param expr
+              , typename impl::state_param state
+              , typename impl::data_param data
+            ) const
+            {
+                elements_type elements =
+                    detail::make_cons(
+                        Grammar()(
+                            proto::child_c<0>(expr), state, data)   // LHS
+                      , detail::make_cons(
+                            proto::value(proto::child_c<1>(expr)))  // RHS
+                    );
+
+                return make_component_()(elements, data);
+            }
+        };
+    };
+}}}
+
+#endif
Added: trunk/boost/spirit/home/support/meta_compiler.hpp
==============================================================================
--- (empty file)
+++ trunk/boost/spirit/home/support/meta_compiler.hpp	2009-04-26 10:42:24 EDT (Sun, 26 Apr 2009)
@@ -0,0 +1,261 @@
+/*=============================================================================
+  Copyright (c) 2001-2009 Joel de Guzman
+  http://spirit.sourceforge.net/
+
+  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)
+=============================================================================*/
+#ifndef BOOST_SPIRIT_META_COMPILER_OCTOBER_16_2008_1258PM
+#define BOOST_SPIRIT_META_COMPILER_OCTOBER_16_2008_1258PM
+
+#if defined(_MSC_VER)
+#pragma once
+#endif
+
+#include <boost/proto/proto.hpp>
+#include <boost/spirit/home/support/make_component.hpp>
+#include <boost/spirit/home/support/modify.hpp>
+#include <boost/spirit/home/support/detail/make_cons.hpp>
+#include <boost/spirit/home/support/unused.hpp>
+#include <boost/utility/enable_if.hpp>
+
+namespace boost { namespace spirit
+{
+    namespace tag
+    {
+        // Normally, we use proto tags as-is to distinguish operators.
+        // The spacial case is proto::tag::subscript. Spirit uses this
+        // as either sementic actions or directives. To distinguish between
+        // the two, we use these special tags below.
+
+        struct action;
+        struct directive;
+    }
+
+    // Some defaults...
+
+    template <typename Domain, typename Tag, typename Enable = void>
+    struct use_operator : mpl::false_ {};
+
+    template <typename Domain, typename T, typename Enable = void>
+    struct use_function : mpl::false_ {};
+
+    template <typename Domain, typename T, typename Enable = void>
+    struct use_directive : mpl::false_ {};
+
+    template <typename Domain, typename T, typename Enable /* = void */>
+    struct is_modifier_directive : mpl::false_ {};
+
+    template <typename Domain, typename T, typename Enable = void>
+    struct use_terminal : mpl::false_ {};
+
+    template <typename Domain, typename T, typename Enable /*= void*/>
+    struct flatten_tree : mpl::false_ {};
+
+    // Our meta-compiler. This is the main engine that hooks Spirit
+    // to the proto expression template engine.
+
+    template <typename Domain>
+    struct meta_compiler
+    {
+        struct meta_grammar;
+
+        BOOST_MPL_ASSERT_MSG((
+            !use_operator<Domain, proto::tag::subscript>::value
+        ), error_proto_tag_subscript_cannot_be_used, ());
+
+        struct cases
+        {
+            template <typename Tag, typename Enable = void>
+            struct case_
+              : proto::not_<proto::_>
+            {};
+
+            ///////////////////////////////////////////////////////////////////
+            // terminals
+            ///////////////////////////////////////////////////////////////////
+            template <typename Enable>
+            struct case_<proto::tag::terminal, Enable>
+              : proto::when<
+                    proto::if_<use_terminal<Domain, proto::_value>()>,
+                    detail::make_terminal<Domain>
+                >
+            {};
+
+            template <typename Tag>
+            struct case_<Tag, typename enable_if<use_operator<Domain, Tag> >::type>
+              : proto::or_<
+            ///////////////////////////////////////////////////////////////////
+            // binary operators
+            ///////////////////////////////////////////////////////////////////
+                    proto::when<proto::binary_expr<Tag, meta_grammar, meta_grammar>,
+                        detail::make_binary<Domain, Tag, meta_grammar>
+                    >,
+            ///////////////////////////////////////////////////////////////////
+            // unary operators
+            ///////////////////////////////////////////////////////////////////
+                    proto::when<proto::unary_expr<Tag, meta_grammar>,
+                        detail::make_unary<Domain, Tag, meta_grammar>
+                    >
+                >
+            {};
+
+            template <typename Enable>
+            struct case_<proto::tag::subscript, Enable>
+              : proto::or_<
+            ///////////////////////////////////////////////////////////////////
+            // directives
+            ///////////////////////////////////////////////////////////////////
+                    proto::when<proto::binary_expr<proto::tag::subscript
+                      , proto::and_<
+                            proto::terminal<proto::_>
+                          , proto::if_<use_directive<Domain, proto::_child_c<0> >()> >
+                      , meta_grammar>,
+                        detail::make_directive<Domain, meta_grammar>
+                    >,
+            ///////////////////////////////////////////////////////////////////
+            // semantic actions
+            ///////////////////////////////////////////////////////////////////
+                    proto::when<proto::binary_expr<proto::tag::subscript
+                      , meta_grammar, proto::_>,
+                        detail::make_action<Domain, meta_grammar>
+                    >
+                >
+            {};
+        };
+
+        struct meta_grammar
+          : proto::switch_<cases>
+        {};
+    };
+
+    namespace result_of
+    {
+        // Default case
+        template <typename Domain, typename Expr
+          , typename Modifiers = unused_type, typename Enable = void>
+        struct compile
+        {
+            typedef typename meta_compiler<Domain>::meta_grammar meta_grammar;
+            typedef typename meta_grammar::
+                template result<meta_grammar(Expr, mpl::void_, Modifiers)>::type
+            type;
+        };
+
+        // If Expr is not a proto expression, make it a terminal
+        template <typename Domain, typename Expr, typename Modifiers>
+        struct compile<Domain, Expr, Modifiers,
+            typename disable_if<proto::is_expr<Expr> >::type>
+          : compile<Domain, typename proto::terminal<Expr>::type, Modifiers> {};
+    }
+
+    namespace traits
+    {
+        // Check if Expr matches the domain's grammar
+        template <typename Domain, typename Expr>
+        struct matches :
+            proto::matches<
+                typename proto::result_of::as_expr<Expr>::type,
+                typename meta_compiler<Domain>::meta_grammar
+            >
+        {
+        };
+    }
+
+    namespace detail
+    {
+        template <typename Domain>
+        struct compiler
+        {
+            // Default case
+            template <typename Expr, typename Modifiers>
+            static typename spirit::result_of::compile<Domain, Expr, Modifiers>::type
+            compile(Expr const& expr, Modifiers modifiers, mpl::true_)
+            {
+                typename meta_compiler<Domain>::meta_grammar compiler;
+                return compiler(expr, mpl::void_(), modifiers);
+            }
+
+            // If Expr is not a proto expression, make it a terminal
+            template <typename Expr, typename Modifiers>
+            static typename spirit::result_of::compile<Domain, Expr, Modifiers>::type
+            compile(Expr const& expr, Modifiers modifiers, mpl::false_)
+            {
+                typename meta_compiler<Domain>::meta_grammar compiler;
+                typedef typename detail::as_meta_element<Expr>::type expr_;
+                typename proto::terminal<expr_>::type term = {expr};
+                return compiler(term, mpl::void_(), modifiers);
+            }
+        };
+    }
+
+    template <typename Domain, typename Expr>
+    inline typename result_of::compile<Domain, Expr, unused_type>::type
+    compile(Expr const& expr)
+    {
+        typedef typename proto::is_expr<Expr>::type is_expr;
+        return detail::compiler<Domain>::template
+            compile(expr, unused, is_expr());
+    }
+
+    template <typename Domain, typename Expr, typename Modifiers>
+    inline typename result_of::compile<Domain, Expr, Modifiers>::type
+    compile(Expr const& expr, Modifiers modifiers)
+    {
+        typedef typename proto::is_expr<Expr>::type is_expr;
+        return detail::compiler<Domain>::template
+            compile(expr, modifiers, is_expr());
+    }
+
+    ///////////////////////////////////////////////////////////////////////////
+    template <typename Elements, template <typename Subject> class generator>
+    struct make_unary_composite
+    {
+        typedef typename
+            fusion::result_of::value_at_c<Elements, 0>::type
+        element_type;
+        typedef generator<element_type> result_type;
+        result_type operator()(Elements const& elements, unused_type) const
+        {
+            return result_type(fusion::at_c<0>(elements));
+        }
+    };
+
+    template <typename Elements, template <typename Left, typename Right> class generator>
+    struct make_binary_composite
+    {
+        typedef typename
+            fusion::result_of::value_at_c<Elements, 0>::type
+        left_type;
+        typedef typename
+            fusion::result_of::value_at_c<Elements, 1>::type
+        right_type;
+        typedef generator<left_type, right_type> result_type;
+
+        result_type operator()(Elements const& elements, unused_type) const
+        {
+            return result_type(
+                fusion::at_c<0>(elements)
+              , fusion::at_c<1>(elements)
+            );
+        }
+    };
+
+    template <typename Elements, template <typename Elements_> class generator>
+    struct make_nary_composite
+    {
+        typedef generator<Elements> result_type;
+        result_type operator()(Elements const& elements, unused_type) const
+        {
+            return result_type(elements);
+        }
+    };
+
+}}
+
+#define BOOST_SPIRIT_ASSERT_MATCH(Domain, Expr)                                 \
+        BOOST_MPL_ASSERT_MSG((                                                  \
+            boost::spirit::traits::matches<Domain, Expr>::value                 \
+        ), error_invalid_expression, (Expr));
+
+#endif
Deleted: trunk/boost/spirit/home/support/meta_grammar.hpp
==============================================================================
--- trunk/boost/spirit/home/support/meta_grammar.hpp	2009-04-26 10:42:24 EDT (Sun, 26 Apr 2009)
+++ (empty file)
@@ -1,16 +0,0 @@
-/*=============================================================================
-    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_META_GRAMMAR_JAN_29_2007_0933AM)
-#define BOOST_SPIRIT_META_GRAMMAR_JAN_29_2007_0933AM
-
-#include <boost/spirit/home/support/meta_grammar/grammar.hpp>
-#include <boost/spirit/home/support/meta_grammar/basic_rules.hpp>
-#include <boost/spirit/home/support/meta_grammar/basic_transforms.hpp>
-
-#endif
-
-
Deleted: trunk/boost/spirit/home/support/modifier.hpp
==============================================================================
--- trunk/boost/spirit/home/support/modifier.hpp	2009-04-26 10:42:24 EDT (Sun, 26 Apr 2009)
+++ (empty file)
@@ -1,90 +0,0 @@
-/*=============================================================================
-    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_MODIFIER_FEB_05_2007_0259PM)
-#define BOOST_SPIRIT_MODIFIER_FEB_05_2007_0259PM
-
-#include <boost/spirit/home/support/unused.hpp>
-#include <boost/spirit/home/support/component.hpp>
-#include <boost/mpl/identity.hpp>
-#include <boost/mpl/if.hpp>
-#include <boost/type_traits/is_base_of.hpp>
-
-namespace boost { namespace spirit
-{
-    ///////////////////////////////////////////////////////////////////////////
-    //  The modifier is like a set of types. Types can be added (but not 
-    //  removed). The unique feature of the modifier is that addition of
-    //  types is done using inheritance. Thus, checking for membership
-    //  involves checking for inheritance. More importantly, because the
-    //  modifier inherits from a type, the type's members (typedefs,
-    //  nested structs, etc.), are all visible; unless, of course, if the
-    //  member is hidden (newer types take priority) or there's ambiguity.
-    //
-    //      to add:                     add_modifier<Modifier, T>
-    //      to test for membership:     is_member_of_modifier<Modifier, T>
-    //
-    //  The modifier is used as the "Visitor" in proto transforms to
-    //  modify the behavior of the expression template building.
-    ///////////////////////////////////////////////////////////////////////////
-    template <typename Set = unused_type, typename New = unused_type>
-    struct modifier : Set, New {};
-
-    template <typename Set>
-    struct modifier<Set, unused_type> : Set {};
-
-    template <typename New>
-    struct modifier<unused_type, New> : New {};
-
-    template <>
-    struct modifier<unused_type, unused_type> {};
-        
-    template <typename Modifier, typename New>
-    struct add_modifier
-    {
-        typedef typename // add only if New is not a member
-            mpl::if_<
-                is_base_of<New, Modifier>
-              , Modifier
-              , modifier<Modifier, New>
-            >::type
-        type;
-    };
-    
-    template <typename Modifier, typename T>
-    struct is_member_of_modifier : is_base_of<T, Modifier> {};
-
-    ///////////////////////////////////////////////////////////////////////////
-    //  This is the main customization point for hooking into the 
-    //  make_component mechanism for building /modified/ components.
-    //  The make_component specialization detects modifier Visitors
-    //  and dispatches to the secondary template make_modified_component
-    //  for clients to specialize. By default, the modifier is ignored
-    //  and the control goes back to make_component.
-    //
-    //  (see also: component.hpp)
-    ///////////////////////////////////////////////////////////////////////////
-    namespace traits
-    {
-        template <
-            typename Domain, typename Director, typename Elements
-          , typename Modifier, typename Enable = void>
-        struct make_modified_component : 
-            make_component<Domain, Director, Elements, unused_type>
-        {
-        };
-    
-        template <
-            typename Domain, typename Director
-          , typename Elements, typename Set, typename New>
-        struct make_component<Domain, Director, Elements, modifier<Set, New> >
-          : make_modified_component<Domain, Director, Elements, modifier<Set, New> >
-        {
-        };
-    }
-}}
-
-#endif
Added: trunk/boost/spirit/home/support/modify.hpp
==============================================================================
--- (empty file)
+++ trunk/boost/spirit/home/support/modify.hpp	2009-04-26 10:42:24 EDT (Sun, 26 Apr 2009)
@@ -0,0 +1,123 @@
+/*=============================================================================
+  Copyright (c) 2001-2009 Joel de Guzman
+  http://spirit.sourceforge.net/
+
+  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)
+=============================================================================*/
+#ifndef BOOST_SPIRIT_MODIFY_OCTOBER_25_2008_0142PM
+#define BOOST_SPIRIT_MODIFY_OCTOBER_25_2008_0142PM
+
+#if defined(_MSC_VER)
+#pragma once
+#endif
+
+#include <boost/proto/proto.hpp>
+#include <boost/mpl/if.hpp>
+#include <boost/type_traits/is_base_of.hpp>
+#include <boost/spirit/home/support/unused.hpp>
+
+namespace boost { namespace spirit
+{
+    template <typename Domain, typename T, typename Enable = void>
+    struct is_modifier_directive;
+
+    // Testing if a modifier set includes a modifier T involves
+    // checking for inheritance (i.e. Modifiers is derived from T)
+    template <typename Modifiers, typename T>
+    struct has_modifier
+        : is_base_of<T, Modifiers> {};
+
+    // Adding modifiers is done using multi-inheritance
+    template <typename Current, typename New, typename Enable = void>
+    struct compound_modifier : Current, New
+    {
+        compound_modifier()
+          : Current(), New() {}
+
+        compound_modifier(Current const& current, New const& new_)
+          : Current(current), New(new_) {}
+    };
+
+    // Don't add if New is already in Current
+    template <typename Current, typename New>
+    struct compound_modifier<
+        Current, New, typename enable_if<has_modifier<Current, New> >::type>
+      : Current
+    {
+        compound_modifier()
+          : Current() {}
+
+        compound_modifier(Current const& current, New const&)
+          : Current(current) {}
+    };
+
+    // Special case if Current is unused_type
+    template <typename New, typename Enable>
+    struct compound_modifier<unused_type, New, Enable> : New
+    {
+        compound_modifier()
+          : New() {}
+
+        compound_modifier(unused_type, New const& new_)
+          : New(new_) {}
+    };
+
+    // Domains may specialize this modify metafunction to allow
+    // directives to add information to the Modifier template
+    // parameter that is passed to the make_component metafunction.
+    // By default, we return the modifiers untouched
+    template <typename Domain, typename Enable = void>
+    struct modify
+    {
+        template <typename Sig>
+        struct result;
+
+        template <typename This, typename Tag, typename Modifiers>
+        struct result<This(Tag, Modifiers)>
+        {
+            typedef typename remove_const<
+                typename remove_reference<Tag>::type>::type
+            tag_type;
+            typedef typename remove_const<
+                typename remove_reference<Modifiers>::type>::type
+            modifiers_type;
+
+            typedef typename mpl::if_<
+                is_modifier_directive<Domain, tag_type>
+              , compound_modifier<modifiers_type, tag_type>
+              , Modifiers>::type
+            type;
+        };
+
+        template <typename Tag, typename Modifiers>
+        typename result<modify(Tag, Modifiers)>::type
+        operator()(Tag tag, Modifiers modifiers) const
+        {
+            return op(tag, modifiers, is_modifier_directive<Domain, Tag>());
+        }
+
+        template <typename Tag, typename Modifiers>
+        Modifiers
+        op(Tag tag, Modifiers modifiers, mpl::false_) const
+        {
+            return modifiers;
+        }
+
+        template <typename Tag, typename Modifiers>
+        compound_modifier<Modifiers, Tag>
+        op(Tag tag, Modifiers modifiers, mpl::true_) const
+        {
+            return compound_modifier<Modifiers, Tag>(modifiers, tag);
+        }
+    };
+}}
+
+namespace boost { namespace proto
+{
+    template <typename Domain, typename Enable>
+    struct is_callable<spirit::modify<Domain, Enable> >
+      : mpl::true_ {};
+}}
+
+#endif
Deleted: trunk/boost/spirit/home/support/multi_pass.hpp
==============================================================================
--- trunk/boost/spirit/home/support/multi_pass.hpp	2009-04-26 10:42:24 EDT (Sun, 26 Apr 2009)
+++ (empty file)
@@ -1,32 +0,0 @@
-//  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_ITERATOR_MULTI_PASS_MAR_16_2007_0201AM)
-#define BOOST_SPIRIT_ITERATOR_MULTI_PASS_MAR_16_2007_0201AM
-
-//  Include everything needed for the default configuration of multi_pass
-//  Ownership policies
-#include <boost/spirit/home/support/iterators/detail/first_owner_policy.hpp>
-#include <boost/spirit/home/support/iterators/detail/ref_counted_policy.hpp>
-
-//  Input policies
-#include <boost/spirit/home/support/iterators/detail/input_iterator_policy.hpp>
-#include <boost/spirit/home/support/iterators/detail/lex_input_policy.hpp>
-#include <boost/spirit/home/support/iterators/detail/split_functor_input_policy.hpp>
-
-//  Checking policies
-#include <boost/spirit/home/support/iterators/detail/buf_id_check_policy.hpp>
-#include <boost/spirit/home/support/iterators/detail/no_check_policy.hpp>
-
-//  Storage policies
-#include <boost/spirit/home/support/iterators/detail/fixed_size_queue_policy.hpp>
-#include <boost/spirit/home/support/iterators/detail/split_std_deque_policy.hpp>
-
-//  Main multi_pass iterator 
-#include <boost/spirit/home/support/iterators/detail/combine_policies.hpp>
-#include <boost/spirit/home/support/iterators/detail/multi_pass.hpp>
-#include <boost/spirit/home/support/iterators/multi_pass.hpp>
-
-#endif 
Added: trunk/boost/spirit/home/support/nonterminal/expand_arg.hpp
==============================================================================
--- (empty file)
+++ trunk/boost/spirit/home/support/nonterminal/expand_arg.hpp	2009-04-26 10:42:24 EDT (Sun, 26 Apr 2009)
@@ -0,0 +1,80 @@
+/*=============================================================================
+    Copyright (c) 2001-2009 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_EXPAND_ARG_FEB_19_2007_1107AM)
+#define BOOST_SPIRIT_EXPAND_ARG_FEB_19_2007_1107AM
+
+#if defined(_MSC_VER)
+#pragma once
+#endif
+
+#include <boost/mpl/bool.hpp>
+#include <boost/mpl/identity.hpp>
+#include <boost/mpl/eval_if.hpp>
+#include <boost/utility/result_of.hpp>
+#include <boost/type_traits/is_scalar.hpp>
+
+namespace boost { namespace spirit { namespace detail
+{
+    ///////////////////////////////////////////////////////////////////////////
+    template <typename Context>
+    struct expand_arg
+    {
+        template <typename T>
+        struct result_type
+        {
+            typedef typename
+                mpl::eval_if<
+                    is_scalar<T>
+                  , mpl::identity<T const &>
+                  , boost::result_of<T(unused_type, Context)>
+                >::type
+            type;
+        };
+
+        template <typename T>
+        struct result;
+
+        template <typename F, typename A0>
+        struct result<F(A0)>
+          : result_type<A0> {};
+
+        template <typename F, typename A0>
+        struct result<F(A0&)>
+          : result_type<A0> {};
+
+        expand_arg(Context& context)
+          : context(context)
+        {
+        }
+
+        template <typename T>
+        typename result_type<T>::type
+        call(T const& f, mpl::false_) const
+        {
+            return f(unused, context);
+        }
+
+        template <typename T>
+        typename result_type<T>::type
+        call(T const& val, mpl::true_) const
+        {
+            return val;
+        }
+
+        template <typename T>
+        typename result_type<T>::type
+        operator()(T const& x) const
+        {
+            return call(x, is_scalar<T>());
+        }
+
+        Context& context;
+    };
+
+}}}
+
+#endif
Modified: trunk/boost/spirit/home/support/nonterminal/locals.hpp
==============================================================================
--- trunk/boost/spirit/home/support/nonterminal/locals.hpp	(original)
+++ trunk/boost/spirit/home/support/nonterminal/locals.hpp	2009-04-26 10:42:24 EDT (Sun, 26 Apr 2009)
@@ -1,14 +1,15 @@
-//  Copyright (c) 2001-2007 Joel de Guzman
-//  Copyright (c) 2001-2009 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)
+/*=============================================================================
+    Copyright (c) 2001-2009 Joel de Guzman
+    Copyright (c) 2001-2009 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_LOCALS_APRIL_03_2007_0506PM)
+#define BOOST_SPIRIT_LOCALS_APRIL_03_2007_0506PM
 
-#if !defined(BOOST_SPIRIT_LOCALS_APR_03_2007_0506PM)
-#define BOOST_SPIRIT_LOCALS_APR_03_2007_0506PM
-
-#if defined(_MSC_VER) && (_MSC_VER >= 1020)
-#pragma once      // MS compatible compilers support #pragma once
+#if defined(_MSC_VER)
+#pragma once
 #endif
 
 #include <boost/mpl/vector.hpp>
@@ -23,7 +24,7 @@
 # endif
 #endif
 
-namespace boost { namespace spirit 
+namespace boost { namespace spirit
 {
     ///////////////////////////////////////////////////////////////////////////
     template <
@@ -38,12 +39,12 @@
     {
         template <typename T>
         struct is_locals
-          : mpl::false_ 
+          : mpl::false_
         {};
 
         template <BOOST_PP_ENUM_PARAMS(BOOST_SPIRIT_MAX_LOCALS_SIZE, typename T)>
         struct is_locals<locals<BOOST_PP_ENUM_PARAMS(BOOST_SPIRIT_MAX_LOCALS_SIZE, T)> >
-          : mpl::true_ 
+          : mpl::true_
         {};
     }
 }}
Deleted: trunk/boost/spirit/home/support/nonterminal/nonterminal.hpp
==============================================================================
--- trunk/boost/spirit/home/support/nonterminal/nonterminal.hpp	2009-04-26 10:42:24 EDT (Sun, 26 Apr 2009)
+++ (empty file)
@@ -1,48 +0,0 @@
-/*=============================================================================
-    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_NONTERMINAL_MAR_06_2007_0236PM)
-#define BOOST_SPIRIT_NONTERMINAL_MAR_06_2007_0236PM
-
-#include <boost/proto/core.hpp>
-#include <boost/function_types/result_type.hpp>
-#include <boost/function_types/parameter_types.hpp>
-#include <boost/fusion/include/as_vector.hpp>
-#include <boost/fusion/include/mpl.hpp>
-#include <boost/fusion/include/joint_view.hpp>
-#include <boost/fusion/include/single_view.hpp>
-#include <boost/type_traits/add_reference.hpp>
-
-namespace boost { namespace spirit
-{
-    template <typename T, typename Nonterminal>
-    struct nonterminal_holder
-    {
-        typedef Nonterminal nonterminal_type;
-        T held;
-    };
-
-    template <typename T, typename Nonterminal>
-    struct make_nonterminal_holder
-      : proto::terminal<nonterminal_holder<T, Nonterminal> >
-    {
-    };
-
-    template <typename Nonterminal, typename FSequence>
-    struct parameterized_nonterminal
-    {
-        Nonterminal const* ptr;
-        FSequence fseq;
-    };
-
-    template <typename Nonterminal>
-    struct nonterminal_object
-    {
-        Nonterminal obj;
-    };
-}}
-
-#endif
Deleted: trunk/boost/spirit/home/support/placeholders.hpp
==============================================================================
--- trunk/boost/spirit/home/support/placeholders.hpp	2009-04-26 10:42:24 EDT (Sun, 26 Apr 2009)
+++ (empty file)
@@ -1,412 +0,0 @@
-/*=============================================================================
-    Copyright (c) 2001-2007 Joel de Guzman
-    Copyright (c) 2001-2009 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_PLACEHOLDERS_NOV_18_2006_0326PM)
-#define BOOST_SPIRIT_PLACEHOLDERS_NOV_18_2006_0326PM
-
-#include <boost/proto/core.hpp>
-#include <boost/mpl/bool.hpp>
-#include <boost/type_traits/is_enum.hpp>
-
-namespace boost { namespace spirit
-{
-    //  This file contains the common placeholders. If you have a placeholder
-    //  that can be (re)used in different spirit domains. This is the place
-    //  to put them in.
-
-    namespace tag
-    {
-        struct char_ {};
-        struct wchar {};
-        struct lit {};
-        struct wlit {};
-        struct eol {};
-        struct eoi {};
-
-        struct bin {};
-        struct oct {};
-        struct hex {};
-
-        struct byte {};
-        struct word {};
-        struct dword {};
-        struct big_word {};
-        struct big_dword {};
-        struct little_word {};
-        struct little_dword {};
-#ifdef BOOST_HAS_LONG_LONG
-        struct qword {};
-        struct big_qword {};
-        struct little_qword {};
-#endif
-        struct pad {};
-
-        struct ushort {};
-        struct ulong {};
-        struct uint {};
-        struct short_ {};
-        struct long_ {};
-        struct int_ {};
-#ifdef BOOST_HAS_LONG_LONG
-        struct ulong_long {};
-        struct long_long {};
-#endif
-        struct float_ {};
-        struct double_ {};
-        struct long_double {};
-
-        struct left_align {};
-        struct right_align {};
-        struct center {};
-
-        struct delimit {};
-        struct verbatim {};
-
-        struct none {};
-        struct eps {};
-        struct lexeme {};
-        struct lazy {};
-        struct omit {};
-        struct raw {};
-
-        struct stream {};
-        struct wstream {};
-
-        struct token {};
-    }
-
-    ////////////////////////////////////////////////////////////////////////////
-    typedef proto::terminal<tag::char_>::type char_type;
-    typedef proto::terminal<tag::wchar>::type wchar_type;
-    typedef proto::terminal<tag::lit>::type lit_type;
-    typedef proto::terminal<tag::wlit>::type wlit_type;
-    typedef proto::terminal<tag::eol>::type eol_type;
-    typedef proto::terminal<tag::eoi>::type eoi_type;
-    
-    typedef proto::terminal<tag::bin>::type bin_type;
-    typedef proto::terminal<tag::oct>::type oct_type;
-    typedef proto::terminal<tag::hex>::type hex_type;
-
-    typedef proto::terminal<tag::byte>::type byte_type;
-    typedef proto::terminal<tag::word>::type word_type;
-    typedef proto::terminal<tag::dword>::type dword_type;
-    typedef proto::terminal<tag::big_word>::type big_word_type;
-    typedef proto::terminal<tag::big_dword>::type big_dword_type;
-    typedef proto::terminal<tag::little_word>::type little_word_type;
-    typedef proto::terminal<tag::little_dword>::type little_dword_type;
-#ifdef BOOST_HAS_LONG_LONG
-    typedef proto::terminal<tag::qword>::type qword_type;
-    typedef proto::terminal<tag::big_qword>::type big_qword_type;
-    typedef proto::terminal<tag::little_qword>::type little_qword_type;
-#endif
-    typedef proto::terminal<tag::pad>::type pad_type;
-
-    typedef proto::terminal<tag::ushort>::type ushort_type;
-    typedef proto::terminal<tag::ulong>::type ulong_type;
-    typedef proto::terminal<tag::uint>::type uint_type;
-    typedef proto::terminal<tag::short_>::type short_type;
-    typedef proto::terminal<tag::long_>::type long_type;
-    typedef proto::terminal<tag::int_>::type int_type;
-#ifdef BOOST_HAS_LONG_LONG
-    typedef proto::terminal<tag::ulong_long>::type ulong_long_type;
-    typedef proto::terminal<tag::long_long>::type long_long_type;
-#endif
-    typedef proto::terminal<tag::float_>::type float_type;
-    typedef proto::terminal<tag::double_>::type double_type;
-    typedef proto::terminal<tag::long_double>::type long_double_type;
-
-    typedef proto::terminal<tag::left_align>::type left_align_type;
-    typedef proto::terminal<tag::right_align>::type right_align_type;
-    typedef proto::terminal<tag::center>::type center_type;
-
-    typedef proto::terminal<tag::delimit>::type delimit_type;
-    typedef proto::terminal<tag::verbatim>::type verbatim_type;
-
-    typedef proto::terminal<tag::none>::type none_type;
-    typedef proto::terminal<tag::eps>::type eps_type;
-    typedef proto::terminal<tag::lexeme>::type lexeme_type;
-    typedef proto::terminal<tag::lazy>::type lazy_type;
-    typedef proto::terminal<tag::omit>::type omitted;
-    typedef proto::terminal<tag::raw>::type raw_type;
-
-    typedef proto::terminal<tag::stream>::type stream_type;
-    typedef proto::terminal<tag::wstream>::type wstream_type;
-
-    typedef proto::terminal<tag::token>::type token_type;
-
-    ////////////////////////////////////////////////////////////////////////////
-    proto::terminal<tag::char_>::type const char_ = {{}};
-    proto::terminal<tag::wchar>::type const wchar = {{}};
-    proto::terminal<tag::lit>::type const lit = {{}};
-    proto::terminal<tag::wlit>::type const wlit = {{}};
-    proto::terminal<tag::eol>::type const eol = {{}};
-    proto::terminal<tag::eoi>::type const eoi = {{}};
-    
-    proto::terminal<tag::bin>::type const bin = {{}};
-    proto::terminal<tag::oct>::type const oct = {{}};
-    proto::terminal<tag::hex>::type const hex = {{}};
-
-    proto::terminal<tag::byte>::type const byte = {{}};
-    proto::terminal<tag::word>::type const word = {{}};
-    proto::terminal<tag::dword>::type const dword = {{}};
-    proto::terminal<tag::big_word>::type const big_word = {{}};
-    proto::terminal<tag::big_dword>::type const big_dword = {{}};
-    proto::terminal<tag::little_word>::type const little_word = {{}};
-    proto::terminal<tag::little_dword>::type const little_dword = {{}};
-#ifdef BOOST_HAS_LONG_LONG
-    proto::terminal<tag::qword>::type const qword = {{}};
-    proto::terminal<tag::big_qword>::type const big_qword = {{}};
-    proto::terminal<tag::little_qword>::type const little_qword = {{}};
-#endif
-    proto::terminal<tag::pad>::type const pad = {{}};
-
-    proto::terminal<tag::ushort>::type const ushort = {{}};
-    proto::terminal<tag::ulong>::type const ulong = {{}};
-    proto::terminal<tag::uint>::type const uint = {{}};
-    proto::terminal<tag::short_>::type const short_ = {{}};
-    proto::terminal<tag::long_>::type const long_ = {{}};
-    proto::terminal<tag::int_>::type const int_ = {{}};
-#ifdef BOOST_HAS_LONG_LONG
-    proto::terminal<tag::ulong_long>::type const ulong_long = {{}};
-    proto::terminal<tag::long_long>::type const long_long = {{}};
-#endif
-    proto::terminal<tag::float_>::type const float_ = {{}};
-    proto::terminal<tag::double_>::type const double_ = {{}};
-    proto::terminal<tag::long_double>::type const long_double = {{}};
-
-    proto::terminal<tag::left_align>::type const left_align = {{}};
-    proto::terminal<tag::right_align>::type const right_align = {{}};
-    proto::terminal<tag::center>::type const center = {{}};
-
-    proto::terminal<tag::delimit>::type const delimit = {{}};
-    proto::terminal<tag::verbatim>::type const verbatim = {{}};
-
-    proto::terminal<tag::none>::type const none = {{}};
-    proto::terminal<tag::eps>::type const eps = {{}};
-    proto::terminal<tag::lexeme>::type const lexeme = {{}};
-    proto::terminal<tag::lazy>::type const lazy = {{}};
-    proto::terminal<tag::omit>::type const omit = {{}};
-    proto::terminal<tag::raw>::type const raw = {{}};
-
-    proto::terminal<tag::stream>::type const stream = {{}};
-    proto::terminal<tag::wstream>::type const wstream = {{}};
-
-    proto::terminal<tag::token>::type const token = {{}};
-
-//  Some platforms/compilers have conflict with these terminals below
-//  we'll provide variations for them with trailing underscores as
-//  substitutes.
-
-    proto::terminal<tag::uint>::type const uint_ = {{}};
-
-#if defined(__GNUC__)
-    inline void silence_unused_warnings__placeholders()
-    {
-        (void) char_; (void) wchar; (void) lit; (void) wlit;
-        (void) eol; (void) eoi;
-        (void) bin; (void) oct; (void) hex;
-        (void) byte; (void) word; (void) dword; 
-        (void) big_word; (void) big_dword; 
-        (void) little_word; (void) little_dword; 
-        (void) ushort; (void) uint; (void) ulong;
-        (void) short_; (void) int_; (void) long_;
-#ifdef BOOST_HAS_LONG_LONG
-        (void) qword; (void) little_qword; (void) big_qword;
-        (void) ulong_long; (void) long_long;
-#endif
-        (void) pad;
-        (void) float_; (void) double_; (void) long_double;
-        (void) left_align; (void) right_align; (void) center;
-        (void) delimit; (void) verbatim;
-        (void) none; (void) eps; (void) lazy; (void) lexeme; 
-        (void) omit; (void) raw;
-        (void) stream; (void) wstream;
-        
-        (void) token;
-    }
-#endif
-
-    ///////////////////////////////////////////////////////////////////////////
-    // test if a tag is an int tag
-    ///////////////////////////////////////////////////////////////////////////
-    template <typename T, typename Domain>
-    struct is_int_tag : mpl::false_ {};
-
-    template <typename Domain>
-    struct is_int_tag<tag::bin, Domain> : mpl::true_ {};
-
-    template <typename Domain>
-    struct is_int_tag<tag::oct, Domain> : mpl::true_ {};
-
-    template <typename Domain>
-    struct is_int_tag<tag::hex, Domain> : mpl::true_ {};
-
-    template <typename Domain>
-    struct is_int_tag<tag::ushort, Domain> : mpl::true_ {};
-
-    template <typename Domain>
-    struct is_int_tag<tag::ulong, Domain> : mpl::true_ {};
-
-    template <typename Domain>
-    struct is_int_tag<tag::uint, Domain> : mpl::true_ {};
-
-    template <typename Domain>
-    struct is_int_tag<tag::short_, Domain> : mpl::true_ {};
-
-    template <typename Domain>
-    struct is_int_tag<tag::long_, Domain> : mpl::true_ {};
-
-    template <typename Domain>
-    struct is_int_tag<tag::int_, Domain> : mpl::true_ {};
-
-#ifdef BOOST_HAS_LONG_LONG
-    template <typename Domain>
-    struct is_int_tag<tag::ulong_long, Domain> : mpl::true_ {};
-
-    template <typename Domain>
-    struct is_int_tag<tag::long_long, Domain> : mpl::true_ {};
-#endif
-
-    ///////////////////////////////////////////////////////////////////////////
-    // test if a tag is an integer type
-    ///////////////////////////////////////////////////////////////////////////
-    template <typename T, typename Domain>
-    struct is_int_lit_tag : is_enum<T> {};
-
-    template <typename Domain>
-    struct is_int_lit_tag<short, Domain> : mpl::true_ {};
-
-    template <typename Domain>
-    struct is_int_lit_tag<unsigned short, Domain> : mpl::true_ {};
-        
-    template <typename Domain>
-    struct is_int_lit_tag<int, Domain> : mpl::true_ {};
-        
-    template <typename Domain>
-    struct is_int_lit_tag<unsigned int, Domain> : mpl::true_ {};
-        
-    template <typename Domain>
-    struct is_int_lit_tag<long, Domain> : mpl::true_ {};
-        
-    template <typename Domain>
-    struct is_int_lit_tag<unsigned long, Domain> : mpl::true_ {};
-    
-#ifdef BOOST_HAS_LONG_LONG
-    template <typename Domain>
-    struct is_int_lit_tag<boost::ulong_long_type, Domain> : mpl::true_ {};
-        
-    template <typename Domain>
-    struct is_int_lit_tag<boost::long_long_type, Domain> : mpl::true_ {};
-#endif
-
-    ///////////////////////////////////////////////////////////////////////////
-    // test if a tag is an floating point tag
-    ///////////////////////////////////////////////////////////////////////////
-    template <typename T, typename Domain>
-    struct is_real_tag : mpl::false_ {};
-
-    template <typename Domain>
-    struct is_real_tag<tag::float_, Domain> : mpl::true_ {};
-
-    template <typename Domain>
-    struct is_real_tag<tag::double_, Domain> : mpl::true_ {};
-
-    template <typename Domain>
-    struct is_real_tag<tag::long_double, Domain> : mpl::true_ {};
-
-    ///////////////////////////////////////////////////////////////////////////
-    // test if a tag is a floating type
-    ///////////////////////////////////////////////////////////////////////////
-    template <typename T, typename Domain>
-    struct is_real_lit_tag : mpl::false_ {};
-
-    template <typename Domain>
-    struct is_real_lit_tag<float, Domain> : mpl::true_ {};
-
-    template <typename Domain>
-    struct is_real_lit_tag<double, Domain> : mpl::true_ {};
-
-    template <typename Domain>
-    struct is_real_lit_tag<long double, Domain> : mpl::true_ {};
-
-    ///////////////////////////////////////////////////////////////////////////
-    // test if a tag is a character literal type
-    ///////////////////////////////////////////////////////////////////////////
-    template <typename T, typename Domain>
-    struct is_char_tag : mpl::false_ {};
-
-    template <typename Domain>
-    struct is_char_tag<tag::char_, Domain> : mpl::true_ {};
-
-    template <typename Domain>
-    struct is_char_tag<tag::wchar, Domain> : mpl::true_ {};
-
-    ///////////////////////////////////////////////////////////////////////////
-    // test if a tag is a character literal type
-    ///////////////////////////////////////////////////////////////////////////
-    template <typename T, typename Domain>
-    struct is_lit_tag : mpl::false_ {};
-
-    template <typename Domain>
-    struct is_lit_tag<tag::lit, Domain> : mpl::true_ {};
-
-    template <typename Domain>
-    struct is_lit_tag<tag::wlit, Domain> : mpl::true_ {};
-
-    ///////////////////////////////////////////////////////////////////////////
-    // test if a tag is a binary type
-    ///////////////////////////////////////////////////////////////////////////
-    template <typename T, typename Domain>
-    struct is_binary_tag : mpl::false_ {};
-
-    template <typename Domain>
-    struct is_binary_tag<tag::byte, Domain> : mpl::true_ {};
-
-    template <typename Domain>
-    struct is_binary_tag<tag::word, Domain> : mpl::true_ {};
-
-    template <typename Domain>
-    struct is_binary_tag<tag::dword, Domain> : mpl::true_ {};
-
-    template <typename Domain>
-    struct is_binary_tag<tag::big_word, Domain> : mpl::true_ {};
-
-    template <typename Domain>
-    struct is_binary_tag<tag::big_dword, Domain> : mpl::true_ {};
-
-    template <typename Domain>
-    struct is_binary_tag<tag::little_word, Domain> : mpl::true_ {};
-
-    template <typename Domain>
-    struct is_binary_tag<tag::little_dword, Domain> : mpl::true_ {};
-
-#ifdef BOOST_HAS_LONG_LONG
-    template <typename Domain>
-    struct is_binary_tag<tag::qword, Domain> : mpl::true_ {};
-
-    template <typename Domain>
-    struct is_binary_tag<tag::big_qword, Domain> : mpl::true_ {};
-
-    template <typename Domain>
-    struct is_binary_tag<tag::little_qword, Domain> : mpl::true_ {};
-#endif
-
-    ///////////////////////////////////////////////////////////////////////////
-    // test if a tag is a stream terminal 
-    ///////////////////////////////////////////////////////////////////////////
-    template <typename T, typename Domain>
-    struct is_stream_tag : mpl::false_ {};
-
-    template <typename Domain>
-    struct is_stream_tag<tag::stream, Domain> : mpl::true_ {};
-
-    template <typename Domain>
-    struct is_stream_tag<tag::wstream, Domain> : mpl::true_ {};
-
-}}
-
-#endif
Modified: trunk/boost/spirit/home/support/safe_bool.hpp
==============================================================================
--- trunk/boost/spirit/home/support/safe_bool.hpp	(original)
+++ trunk/boost/spirit/home/support/safe_bool.hpp	2009-04-26 10:42:24 EDT (Sun, 26 Apr 2009)
@@ -1,5 +1,6 @@
 /*=============================================================================
-    Copyright (c) 2003 Joel de Guzman
+    Copyright (c) 2003-2009 Joel de Guzman
+    Copyright (c) 2003-2009 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)
@@ -12,45 +13,17 @@
 
 namespace boost { namespace spirit
 {
-    namespace detail
+    template<class Tag>
+    class safe_bool 
     {
-        template <typename T>
-        struct no_base {};
-
-        template <typename T>
-        struct safe_bool_impl
-        {
-#if BOOST_WORKAROUND(__MWERKS__, BOOST_TESTED_AT(0x3003))
-            void stub(T*) {}
-            typedef void (safe_bool_impl::*type)(T*);
-#else
-            typedef T* TP; // workaround to make parsing easier
-            TP stub;
-            typedef TP safe_bool_impl::*type;
-#endif
-        };
-    }
+    public:
+        typedef void (safe_bool::*result_type)();
+        result_type operator()(bool b) { return b ? &safe_bool::true_ : 0; }
 
-    template <typename Derived, typename Base = detail::no_base<Derived> >
-    struct safe_bool : Base
-    {
     private:
-        typedef detail::safe_bool_impl<Derived> impl_type;
-        typedef typename impl_type::type bool_type;
-
-    public:
-        operator bool_type() const
-        {
-            return static_cast<const Derived*>(this)->operator_bool() ?
-                &impl_type::stub : 0;
-        }
-
-        operator bool_type()
-        {
-            return static_cast<Derived*>(this)->operator_bool() ?
-                &impl_type::stub : 0;
-        }
+        void true_() {}
     };
+
 }}
 
 #endif
Added: trunk/boost/spirit/home/support/sequence_base_id.hpp
==============================================================================
--- (empty file)
+++ trunk/boost/spirit/home/support/sequence_base_id.hpp	2009-04-26 10:42:24 EDT (Sun, 26 Apr 2009)
@@ -0,0 +1,35 @@
+/*=============================================================================
+    Copyright (c) 2001-2009 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(SPIRIT_SEQUENCE_BASE_ID_MAR_15_2009_1243PM)
+#define SPIRIT_SEQUENCE_BASE_ID_MAR_15_2009_1243PM
+
+#include <boost/mpl/has_xxx.hpp>
+#include <boost/utility/enable_if.hpp>
+#include <boost/spirit/home/support/attributes.hpp>
+
+namespace boost { namespace spirit { namespace traits
+{
+    namespace detail
+    {
+        BOOST_MPL_HAS_XXX_TRAIT_DEF(sequence_base_id)
+    }
+
+    // We specialize this for sequences (see support/attributes.hpp).
+    // For sequences, we only wrap the attribute in a tuple IFF
+    // it is not already a fusion tuple.
+    //
+    // Note: in the comment above, "sequence" is a spirit sequence
+    // component (parser or generator), and a tuple is a fusion sequence 
+    // (to avoid terminology confusion).
+    template <typename Derived, typename Attribute>
+    struct pass_attribute<Derived, Attribute,
+        typename enable_if<detail::has_sequence_base_id<Derived> >::type>
+      : wrap_if_not_tuple<Attribute> {};
+
+}}}
+
+#endif
Deleted: trunk/boost/spirit/home/support/standard.hpp
==============================================================================
--- trunk/boost/spirit/home/support/standard.hpp	2009-04-26 10:42:24 EDT (Sun, 26 Apr 2009)
+++ (empty file)
@@ -1,70 +0,0 @@
-/*=============================================================================
-    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(SPIRIT_STANDARD_JAN_31_2006_0529PM)
-#define SPIRIT_STANDARD_JAN_31_2006_0529PM
-
-#include <boost/spirit/home/support/char_class.hpp>
-#include <boost/proto/core.hpp>
-
-namespace boost { namespace spirit { namespace standard
-{
-    typedef spirit::char_class::standard char_set;
-    namespace tag = spirit::char_class::tag;
-
-    template <typename Class>
-    struct make_tag 
-      : proto::terminal<spirit::char_class::key<char_set, Class> > {};
-
-    typedef make_tag<tag::alnum>::type alnum_type;
-    typedef make_tag<tag::alpha>::type alpha_type;
-    typedef make_tag<tag::blank>::type blank_type;
-    typedef make_tag<tag::cntrl>::type cntrl_type;
-    typedef make_tag<tag::digit>::type digit_type;
-    typedef make_tag<tag::graph>::type graph_type;
-    typedef make_tag<tag::print>::type print_type;
-    typedef make_tag<tag::punct>::type punct_type;
-    typedef make_tag<tag::space>::type space_type;
-    typedef make_tag<tag::xdigit>::type xdigit_type;
-
-    alnum_type const alnum = {{}};
-    alpha_type const alpha = {{}};
-    blank_type const blank = {{}};
-    cntrl_type const cntrl = {{}};
-    digit_type const digit = {{}};
-    graph_type const graph = {{}};
-    print_type const print = {{}};
-    punct_type const punct = {{}};
-    space_type const space = {{}};
-    xdigit_type const xdigit = {{}};
-
-    typedef proto::terminal<
-        spirit::char_class::no_case_tag<char_set> >::type 
-    no_case_type;
-
-    no_case_type const no_case = no_case_type();
-
-    typedef proto::terminal<
-        spirit::char_class::lower_case_tag<char_set> >::type 
-    lower_type;
-    typedef proto::terminal<
-        spirit::char_class::upper_case_tag<char_set> >::type 
-    upper_type;
-
-    lower_type const lower = lower_type();
-    upper_type const upper = upper_type();
-
-#if defined(__GNUC__)
-    inline void silence_unused_warnings__standard()
-    {
-        (void) alnum; (void) alpha; (void) blank; (void) cntrl; (void) digit; 
-        (void) graph; (void) print; (void) punct; (void) space;  (void) xdigit;
-    }
-#endif
-
-}}}
-
-#endif
Deleted: trunk/boost/spirit/home/support/standard_wide.hpp
==============================================================================
--- trunk/boost/spirit/home/support/standard_wide.hpp	2009-04-26 10:42:24 EDT (Sun, 26 Apr 2009)
+++ (empty file)
@@ -1,70 +0,0 @@
-/*=============================================================================
-    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(SPIRIT_STANDARD_WIDE_JAN_31_2006_0529PM)
-#define SPIRIT_STANDARD_WIDE_JAN_31_2006_0529PM
-
-#include <boost/spirit/home/support/char_class.hpp>
-#include <boost/proto/core.hpp>
-
-namespace boost { namespace spirit { namespace standard_wide
-{
-    typedef spirit::char_class::standard_wide char_set;
-    namespace tag = spirit::char_class::tag;
-
-    template <typename Class>
-    struct make_tag 
-      : proto::terminal<spirit::char_class::key<char_set, Class> > {};
-
-    typedef make_tag<tag::alnum>::type alnum_type;
-    typedef make_tag<tag::alpha>::type alpha_type;
-    typedef make_tag<tag::blank>::type blank_type;
-    typedef make_tag<tag::cntrl>::type cntrl_type;
-    typedef make_tag<tag::digit>::type digit_type;
-    typedef make_tag<tag::graph>::type graph_type;
-    typedef make_tag<tag::print>::type print_type;
-    typedef make_tag<tag::punct>::type punct_type;
-    typedef make_tag<tag::space>::type space_type;
-    typedef make_tag<tag::xdigit>::type xdigit_type;
-
-    alnum_type const alnum = {{}};
-    alpha_type const alpha = {{}};
-    blank_type const blank = {{}};
-    cntrl_type const cntrl = {{}};
-    digit_type const digit = {{}};
-    graph_type const graph = {{}};
-    print_type const print = {{}};
-    punct_type const punct = {{}};
-    space_type const space = {{}};
-    xdigit_type const xdigit = {{}};
-
-    typedef proto::terminal<
-        spirit::char_class::no_case_tag<char_set> >::type 
-    no_case_type;
-
-    no_case_type const no_case = no_case_type();
-
-    typedef proto::terminal<
-        spirit::char_class::lower_case_tag<char_set> >::type 
-    lower_type;
-    typedef proto::terminal<
-        spirit::char_class::upper_case_tag<char_set> >::type 
-    upper_type;
-
-    lower_type const lower = lower_type();
-    upper_type const upper = upper_type();
-
-#if defined(__GNUC__)
-    inline void silence_unused_warnings__standard_wide()
-    {
-        (void) alnum; (void) alpha; (void) blank; (void) cntrl; (void) digit; 
-        (void) graph; (void) print; (void) punct; (void) space;  (void) xdigit;
-    }
-#endif
-
-}}}
-
-#endif
Added: trunk/boost/spirit/home/support/string_traits.hpp
==============================================================================
--- (empty file)
+++ trunk/boost/spirit/home/support/string_traits.hpp	2009-04-26 10:42:24 EDT (Sun, 26 Apr 2009)
@@ -0,0 +1,197 @@
+/*=============================================================================
+    Copyright (c) 2001-2009 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_STRING_TRAITS_OCTOBER_2008_1252PM)
+#define BOOST_SPIRIT_STRING_TRAITS_OCTOBER_2008_1252PM
+
+#if defined(_MSC_VER)
+#pragma once
+#endif
+
+#include <boost/spirit/home/support/container.hpp>
+#include <string>
+#include <boost/mpl/bool.hpp>
+#include <boost/mpl/identity.hpp>
+#include <boost/utility/enable_if.hpp>
+
+namespace boost { namespace spirit { namespace traits
+{
+    ///////////////////////////////////////////////////////////////////////////
+    // Determine if T is a string
+    ///////////////////////////////////////////////////////////////////////////
+    template <typename T>
+    struct is_string : mpl::false_ {};
+
+    template <typename T>
+    struct is_string<T const> : is_string<T> {};
+
+    template <>
+    struct is_string<char const*> : mpl::true_ {};
+
+    template <>
+    struct is_string<wchar_t const*> : mpl::true_ {};
+
+    template <>
+    struct is_string<char*> : mpl::true_ {};
+
+    template <>
+    struct is_string<wchar_t*> : mpl::true_ {};
+
+    template <size_t N>
+    struct is_string<char[N]> : mpl::true_ {};
+
+    template <size_t N>
+    struct is_string<wchar_t[N]> : mpl::true_ {};
+
+    template <size_t N>
+    struct is_string<char const[N]> : mpl::true_ {};
+
+    template <size_t N>
+    struct is_string<wchar_t const[N]> : mpl::true_ {};
+
+    template <size_t N>
+    struct is_string<char(&)[N]> : mpl::true_ {};
+
+    template <size_t N>
+    struct is_string<wchar_t(&)[N]> : mpl::true_ {};
+
+    template <size_t N>
+    struct is_string<char const(&)[N]> : mpl::true_ {};
+
+    template <size_t N>
+    struct is_string<wchar_t const(&)[N]> : mpl::true_ {};
+
+    template <typename T, typename Traits, typename Allocator>
+    struct is_string<std::basic_string<T, Traits, Allocator> > : mpl::true_ {};
+
+    ///////////////////////////////////////////////////////////////////////////
+    // Get the underlying char type of a string
+    ///////////////////////////////////////////////////////////////////////////
+    template <typename T>
+    struct char_type_of;
+
+    template <typename T>
+    struct char_type_of<T const> : char_type_of<T> {};
+
+    template <>
+    struct char_type_of<char const*> : mpl::identity<char const> {};
+
+    template <>
+    struct char_type_of<wchar_t const*> : mpl::identity<wchar_t const> {};
+
+    template <>
+    struct char_type_of<char*> : mpl::identity<char> {};
+
+    template <>
+    struct char_type_of<wchar_t*> : mpl::identity<wchar_t> {};
+
+    template <size_t N>
+    struct char_type_of<char[N]> : mpl::identity<char> {};
+
+    template <size_t N>
+    struct char_type_of<wchar_t[N]> : mpl::identity<wchar_t> {};
+
+    template <size_t N>
+    struct char_type_of<char const[N]> : mpl::identity<char const> {};
+
+    template <size_t N>
+    struct char_type_of<wchar_t const[N]> : mpl::identity<wchar_t const> {};
+
+    template <size_t N>
+    struct char_type_of<char(&)[N]> : mpl::identity<char> {};
+
+    template <size_t N>
+    struct char_type_of<wchar_t(&)[N]> : mpl::identity<wchar_t> {};
+
+    template <size_t N>
+    struct char_type_of<char const(&)[N]> : mpl::identity<char const> {};
+
+    template <size_t N>
+    struct char_type_of<wchar_t const(&)[N]> : mpl::identity<wchar_t const> {};
+
+    template <typename T, typename Traits, typename Allocator>
+    struct char_type_of<std::basic_string<T, Traits, Allocator> >
+      : mpl::identity<T> {};
+
+    ///////////////////////////////////////////////////////////////////////////
+    // Get the C string from a string
+    ///////////////////////////////////////////////////////////////////////////
+    template <typename T>
+    inline T* get_c_string(T* str) { return str; }
+
+    template <typename T>
+    inline T const* get_c_string(T const* str) { return str; }
+
+    template <typename T, typename Traits, typename Allocator>
+    inline T const* get_c_string(std::basic_string<T, Traits, Allocator>& str)
+    { return str.c_str(); }
+
+    template <typename T, typename Traits, typename Allocator>
+    inline T const* get_c_string(std::basic_string<T, Traits, Allocator> const& str)
+    { return str.c_str(); }
+
+    ///////////////////////////////////////////////////////////////////////////
+    // Get the begin/end iterators from a string
+    ///////////////////////////////////////////////////////////////////////////
+
+    // Implementation for C-style strings.
+    template <typename T>
+    inline T const* get_begin(T const* str) { return str; }
+
+    template <typename T>
+    inline T* get_begin(T* str) { return str; }
+
+    template <typename T>
+    inline T const* get_end(T const* str)
+    {
+        T const* last = str;
+        while (*last)
+            last++;
+        return last;
+    }
+
+    template <typename T>
+    inline T* get_end(T* str)
+    {
+        T* last = str;
+        while (*last)
+            last++;
+        return last;
+    }
+
+    // Implementation for containers (includes basic_string).
+    template <typename T, typename Str>
+    inline typename Str::const_iterator get_begin(Str const& str)
+    { return str.begin(); }
+
+    template <typename T, typename Str>
+    inline typename Str::iterator get_begin(Str& str)
+    { return str.begin(); }
+
+    template <typename T, typename Str>
+    inline typename Str::const_iterator get_end(Str const& str)
+    { return str.end(); }
+
+    template <typename T, typename Str>
+    inline typename Str::iterator get_end(Str& str)
+    { return str.end(); }
+
+    // Default implementation for other types: try a C-style string
+    // conversion.
+    // These overloads are explicitely disabled for containers,
+    // as they would be ambiguous with the previous ones.
+    template <typename T, typename Str>
+    inline typename disable_if<is_container<Str>
+      , T const*>::type get_begin(Str const& str)
+    { return str; }
+
+    template <typename T, typename Str>
+    inline typename disable_if<is_container<Str>
+      , T const*>::type get_end(Str const& str)
+    { return get_end(get_begin<T>(str)); }
+}}}
+
+#endif
Added: trunk/boost/spirit/home/support/terminal.hpp
==============================================================================
--- (empty file)
+++ trunk/boost/spirit/home/support/terminal.hpp	2009-04-26 10:42:24 EDT (Sun, 26 Apr 2009)
@@ -0,0 +1,431 @@
+/*=============================================================================
+    Copyright (c) 2001-2009 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_TERMINAL_NOVEMBER_04_2008_0906AM)
+#define BOOST_SPIRIT_TERMINAL_NOVEMBER_04_2008_0906AM
+
+#if defined(_MSC_VER)
+#pragma once
+#endif
+
+#include <boost/proto/proto.hpp>
+#include <boost/fusion/include/unused.hpp>
+#include <boost/fusion/include/void.hpp>
+#include <boost/spirit/include/phoenix_core.hpp>
+#include <boost/spirit/include/phoenix_function.hpp>
+#include <boost/spirit/home/support/meta_compiler.hpp>
+#include <boost/spirit/home/support/detail/make_vector.hpp>
+
+namespace boost { namespace spirit
+{
+    template <typename Terminal, typename Args>
+    struct terminal_ex
+    {
+        typedef Terminal terminal_type;
+        typedef Args args_type;
+
+        terminal_ex(Args const& args)
+          : args(args) {}
+        terminal_ex(Args const& args, Terminal const& term)
+          : args(args), term(term) {}
+
+        Args args;  // Args is guaranteed to be a fusion::vectorN so you
+                    // can use that template for detection and specialization
+        Terminal term;
+    };
+
+    template <typename Terminal, typename Actor, int Arity>
+    struct lazy_terminal
+    {
+        typedef Terminal terminal_type;
+        typedef Actor actor_type;
+        static int const arity = Arity;
+
+        lazy_terminal(Actor const& actor)
+          : actor(actor) {}
+        lazy_terminal(Actor const& actor, Terminal const& term)
+          : actor(actor), term(term) {}
+
+        Actor actor;
+        Terminal term;
+    };
+
+    template <typename Domain, typename Terminal, int Arity, typename Enable = void>
+    struct use_lazy_terminal : mpl::false_ {};
+
+    template <typename Domain, typename Terminal, int Arity, typename Enable = void>
+    struct use_lazy_directive : mpl::false_ {};
+
+    template <typename Domain, typename Terminal, int Arity, typename Actor>
+    struct use_terminal<Domain, lazy_terminal<Terminal, Actor, Arity> >
+        : use_lazy_terminal<Domain, Terminal, Arity> {};
+
+    template <typename Domain, typename Terminal, int Arity, typename Actor>
+    struct use_directive<Domain, lazy_terminal<Terminal, Actor, Arity> >
+        : use_lazy_directive<Domain, Terminal, Arity> {};
+
+    template <
+        typename F
+      , typename A0 = unused_type
+      , typename A1 = unused_type
+      , typename A2 = unused_type
+      , typename Unused = unused_type
+    >
+    struct make_lazy;
+
+    template <typename F, typename A0>
+    struct make_lazy<F, A0>
+    {
+        typedef typename
+            proto::terminal<
+                lazy_terminal<
+                    typename F::terminal_type
+                  , phoenix::actor<
+                        typename phoenix::as_composite<
+                            phoenix::detail::function_eval<1>, F, A0
+                        >::type
+                    >
+                  , 1 // arity
+                >
+            >::type
+        result_type;
+        typedef result_type type;
+
+        result_type
+        operator()(F f, A0 const& _0) const
+        {
+            typedef typename result_type::proto_child0 child_type;
+            return result_type::make(child_type(
+                phoenix::compose<phoenix::detail::function_eval<1> >(f, _0)
+              , f.proto_base().child0
+            ));
+        }
+    };
+
+    template <typename F, typename A0, typename A1>
+    struct make_lazy<F, A0, A1>
+    {
+        typedef typename
+            proto::terminal<
+               lazy_terminal<
+                    typename F::terminal_type
+                  , phoenix::actor<
+                        typename phoenix::as_composite<
+                            phoenix::detail::function_eval<2>, F, A0, A1
+                        >::type
+                    >
+                  , 2 // arity
+                >
+            >::type
+        result_type;
+        typedef result_type type;
+
+        result_type
+        operator()(F f, A0 const& _0, A1 const& _1) const
+        {
+            typedef typename result_type::proto_child0 child_type;
+            return result_type::make(child_type(
+                phoenix::compose<phoenix::detail::function_eval<2> >(f, _0, _1)
+              , f.proto_base().child0
+            ));
+        }
+    };
+
+    template <typename F, typename A0, typename A1, typename A2>
+    struct make_lazy<F, A0, A1, A2>
+    {
+        typedef typename
+            proto::terminal<
+               lazy_terminal<
+                    typename F::terminal_type
+                  , phoenix::actor<
+                        typename phoenix::as_composite<
+                            phoenix::detail::function_eval<3>, F, A0, A1, A2
+                        >::type
+                    >
+                  , 3 // arity
+                >
+            >::type
+        result_type;
+        typedef result_type type;
+
+        result_type
+        operator()(F f, A0 const& _0, A1 const& _1, A2 const& _2) const
+        {
+            typedef typename result_type::proto_child0 child_type;
+            return result_type::make(child_type(
+                phoenix::compose<phoenix::detail::function_eval<3> >(f, _0, _1, _2)
+              , f.proto_base().child0
+            ));
+        }
+    };
+
+    namespace detail
+    {
+        // Helper struct for SFINAE purposes
+        template <bool C>
+        struct bool_;
+        template <>
+        struct bool_<true> : mpl::bool_<true>
+          { typedef bool_<true>* is_true; };
+        template <>
+        struct bool_<false> : mpl::bool_<false>
+          { typedef bool_<false>* is_false; };
+
+        // Metafunction to detect if at least one arg is a Phoenix actor
+        template <
+            typename A0
+          , typename A1 = unused_type
+          , typename A2 = unused_type
+        >
+        struct contains_actor
+            : bool_<
+                phoenix::is_actor<A0>::value
+             || phoenix::is_actor<A1>::value
+             || phoenix::is_actor<A2>::value
+            >
+        {};
+
+        // to_lazy_arg: convert a terminal arg type to the type make_lazy needs
+        template <typename A>
+        struct to_lazy_arg
+        {
+            // wrap A in a Phoenix actor if not already one
+            typedef typename phoenix::as_actor<A>::type type;
+        };
+        template <>
+        struct to_lazy_arg<unused_type>
+        {
+            // unused arg: make_lazy wants unused_type
+            typedef unused_type type;
+        };
+
+        // to_nonlazy_arg: convert a terminal arg type to the type make_vector needs
+        template <typename A>
+        struct to_nonlazy_arg
+        {
+            // identity
+            typedef A type;
+        };
+        template <>
+        struct to_nonlazy_arg<unused_type>
+        {
+            // unused arg: make_vector wants fusion::void_
+            typedef fusion::void_ type;
+        };
+    }
+
+    template <typename Terminal>
+    struct terminal
+      : proto::extends<
+            typename proto::terminal<Terminal>::type
+          , terminal<Terminal>
+        >
+    {
+        typedef terminal<Terminal> this_type;
+        typedef Terminal terminal_type;
+
+        typedef proto::extends<
+            typename proto::terminal<Terminal>::type
+          , terminal<Terminal>
+        > base_type;
+
+        terminal() {}
+
+        terminal(Terminal const& t)
+          : base_type(proto::terminal<Terminal>::type::make(t)) {}
+
+        template <
+            bool Lazy
+          , typename A0
+          , typename A1
+          , typename A2
+        >
+        struct result_helper;
+
+        template <
+            typename A0
+          , typename A1
+          , typename A2
+        >
+        struct result_helper<false, A0, A1, A2>
+        {
+            typedef typename
+                proto::terminal<
+                    terminal_ex<
+                        Terminal
+                      , typename detail::result_of::make_vector<
+                            typename detail::to_nonlazy_arg<A0>::type
+                          , typename detail::to_nonlazy_arg<A1>::type
+                          , typename detail::to_nonlazy_arg<A2>::type>::type>
+                >::type
+            type;
+        };
+
+        template <
+            typename A0
+          , typename A1
+          , typename A2
+        >
+        struct result_helper<true, A0, A1, A2>
+        {
+            typedef typename
+                make_lazy<this_type
+                  , typename detail::to_lazy_arg<A0>::type
+                  , typename detail::to_lazy_arg<A1>::type
+                  , typename detail::to_lazy_arg<A2>::type>::type
+            type;
+        };
+
+        template <
+            typename A0
+          , typename A1 = unused_type
+          , typename A2 = unused_type      // Support up to 3 args
+        >
+        struct result
+        {
+            typedef typename
+                result_helper<
+                    detail::contains_actor<A0, A1, A2>::value
+                  , A0, A1, A2
+                >::type
+            type;
+        };
+
+
+        // Note: in the following overloads, SFINAE cannot
+        // be done on return type because of gcc bug #24915:
+        //   http://gcc.gnu.org/bugzilla/show_bug.cgi?id=24915
+        // Hence an additional, fake argument is used for SFINAE,
+        // using a type which can never be a real argument type.
+
+        // Non-lazy overloads. Only enabled when all
+        // args are immediates (no Phoenix actor).
+
+        template <typename A0>
+        typename result<A0>::type
+        operator()(A0 const& _0
+          , typename detail::contains_actor<A0>::is_false = 0) const
+        {
+            typedef typename result<A0>::type result_type;
+            typedef typename result_type::proto_child0 child_type;
+            return result_type::make(
+                child_type(
+                    detail::make_vector(_0)
+                  , this->proto_base().child0)
+            );
+        }
+
+        template <typename A0, typename A1>
+        typename result<A0, A1>::type
+        operator()(A0 const& _0, A1 const& _1
+          , typename detail::contains_actor<A0, A1>::is_false = 0) const
+        {
+            typedef typename result<A0, A1>::type result_type;
+            typedef typename result_type::proto_child0 child_type;
+            return result_type::make(
+                child_type(
+                    detail::make_vector(_0, _1)
+                  , this->proto_base().child0)
+            );
+        }
+
+        template <typename A0, typename A1, typename A2>
+        typename result<A0, A1, A2>::type
+        operator()(A0 const& _0, A1 const& _1, A2 const& _2
+          , typename detail::contains_actor<A0, A1, A2>::is_false = 0) const
+        {
+            typedef typename result<A0, A1, A2>::type result_type;
+            typedef typename result_type::proto_child0 child_type;
+            return result_type::make(
+                child_type(
+                    detail::make_vector(_0, _1, _2)
+                  , this->proto_base().child0)
+            );
+        }
+
+        // Lazy overloads. Enabled when at
+        // least one arg is a Phoenix actor.
+
+        template <typename A0>
+        typename result<A0>::type
+        operator()(A0 const& _0
+          , typename detail::contains_actor<A0>::is_true = 0) const
+        {
+            return make_lazy<this_type
+              , typename phoenix::as_actor<A0>::type>()(*this
+              , phoenix::as_actor<A0>::convert(_0));
+        }
+
+        template <typename A0, typename A1>
+        typename result<A0, A1>::type
+        operator()(A0 const& _0, A1 const& _1
+          , typename detail::contains_actor<A0, A1>::is_true = 0) const
+        {
+            return make_lazy<this_type
+              , typename phoenix::as_actor<A0>::type
+              , typename phoenix::as_actor<A1>::type>()(*this
+              , phoenix::as_actor<A0>::convert(_0)
+              , phoenix::as_actor<A1>::convert(_1));
+        }
+
+        template <typename A0, typename A1, typename A2>
+        typename result<A0, A1, A2>::type
+        operator()(A0 const& _0, A1 const& _1, A2 const& _2
+          , typename detail::contains_actor<A0, A1, A2>::is_true = 0) const
+        {
+            return make_lazy<this_type
+              , typename phoenix::as_actor<A0>::type
+              , typename phoenix::as_actor<A1>::type
+              , typename phoenix::as_actor<A2>::type>()(*this
+              , phoenix::as_actor<A0>::convert(_0)
+              , phoenix::as_actor<A1>::convert(_1)
+              , phoenix::as_actor<A2>::convert(_2));
+        }
+    };
+}}
+
+// Define a spirit terminal. This macro may be placed in any namespace.
+// Common placeholders are placed in the main boost::spirit namespace
+// (see common_terminals.hpp)
+
+#define BOOST_SPIRIT_TERMINAL(name)                                             \
+    namespace tag { struct name {};  }                                          \
+    typedef boost::proto::terminal<tag::name>::type name##_type;                \
+    name##_type const name = {{}};                                              \
+    inline void silence_unused_warnings__##name() { (void) name; }              \
+    /***/
+
+#define BOOST_SPIRIT_DEFINE_TERMINALS_A(r, _, name)                             \
+    BOOST_SPIRIT_TERMINAL(name)                                                 \
+    /***/
+
+#define BOOST_SPIRIT_DEFINE_TERMINALS(seq)                                      \
+    BOOST_PP_SEQ_FOR_EACH(BOOST_SPIRIT_DEFINE_TERMINALS_A, _, seq)              \
+    /***/
+
+// Define a spirit extended terminal. This macro may be placed in any namespace.
+// Common placeholders are placed in the main boost::spirit namespace
+// (see common_terminals.hpp)
+
+#define BOOST_SPIRIT_TERMINAL_EX(name)                                          \
+    namespace tag { struct name {}; }                                           \
+    typedef boost::spirit::terminal<tag::name> name##_type;                     \
+    name##_type const name = name##_type();                                     \
+    inline void silence_unused_warnings__##name() { (void) name; }              \
+    /***/
+
+#define BOOST_SPIRIT_DEFINE_TERMINALS_EX_A(r, _, name)                          \
+    BOOST_SPIRIT_TERMINAL_EX(name)                                              \
+    /***/
+
+#define BOOST_SPIRIT_DEFINE_TERMINALS_EX(seq)                                   \
+    BOOST_PP_SEQ_FOR_EACH(BOOST_SPIRIT_DEFINE_TERMINALS_EX_A, _, seq)           \
+    /***/
+
+#endif
+
+
Modified: trunk/boost/spirit/home/support/unused.hpp
==============================================================================
--- trunk/boost/spirit/home/support/unused.hpp	(original)
+++ trunk/boost/spirit/home/support/unused.hpp	2009-04-26 10:42:24 EDT (Sun, 26 Apr 2009)
@@ -1,18 +1,18 @@
 /*=============================================================================
-    Copyright (c) 2001-2007 Joel de Guzman
+    Copyright (c) 2001-2009 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_UNUSED_APR_16_2006_0616PM)
-#define BOOST_SPIRIT_UNUSED_APR_16_2006_0616PM
+#if !defined(BOOST_SPIRIT_UNUSED_APRIL_16_2006_0616PM)
+#define BOOST_SPIRIT_UNUSED_APRIL_16_2006_0616PM
+
+#if defined(_MSC_VER)
+#pragma once
+#endif
 
 #include <boost/fusion/include/unused.hpp>
-#include <boost/fusion/include/empty.hpp>
-#include <boost/type_traits/is_same.hpp>
-#include <boost/mpl/not.hpp>
-#include <boost/mpl/if.hpp>
-#include <boost/type_traits/is_same.hpp>
+#include <boost/mpl/bool.hpp>
 
 namespace boost { namespace spirit
 {
@@ -20,33 +20,16 @@
     // since boost::fusion now supports exactly what we need, unused is simply
     // imported from the fusion namespace
     ///////////////////////////////////////////////////////////////////////////
-    typedef boost::fusion::unused_type unused_type;
+    using boost::fusion::unused_type;
     using boost::fusion::unused;
 
     ///////////////////////////////////////////////////////////////////////////
     namespace traits
     {
-        // We use this test to detect if the argument is not a unused_type
-        template <typename T>
-        struct is_not_unused
-          : mpl::not_<is_same<T, unused_type> >
-        {};
-
-        // Return unused_type if Target is same as Actual, else
-        // return Attribute (Attribute defaults to Actual).
-        template <typename Target, typename Actual, typename Attribute = Actual>
-        struct unused_if_same
-          : mpl::if_<is_same<Target, Actual>, unused_type, Attribute>
-        {};
-
-        // Return unused_type if Sequence is empty, else return Attribute.
-        //  (Attribute defaults to Sequence).
-        template <typename Sequence, typename Attribute = Sequence>
-        struct unused_if_empty
-          : mpl::if_<fusion::result_of::empty<Sequence>, unused_type, Attribute>
-        {};
+        // We use this test to detect if the argument is not an unused_type
+        template <typename T> struct is_not_unused : mpl::true_ {};
+        template <> struct is_not_unused<unused_type> : mpl::false_ {};
     }
-
 }}
 
 #endif
Added: trunk/boost/spirit/home/support/utf8.hpp
==============================================================================
--- (empty file)
+++ trunk/boost/spirit/home/support/utf8.hpp	2009-04-26 10:42:24 EDT (Sun, 26 Apr 2009)
@@ -0,0 +1,72 @@
+/*=============================================================================
+    Copyright (c) 2001-2009 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_UC_TYPES_NOVEMBER_23_2008_0840PM)
+#define BOOST_SPIRIT_UC_TYPES_NOVEMBER_23_2008_0840PM
+
+#if defined(_MSC_VER)
+#pragma once
+#endif
+
+#include <boost/cstdint.hpp>
+#include <boost/foreach.hpp>
+#include <boost/regex/pending/unicode_iterator.hpp>
+#include <boost/type_traits/make_unsigned.hpp>
+#include <string>
+
+namespace boost { namespace spirit
+{
+    typedef ::boost::uint32_t ucs4_char;
+    typedef char utf8_char;
+    typedef std::basic_string<ucs4_char> ucs4_string;
+    typedef std::basic_string<utf8_char> utf8_string;
+
+    template <typename Char>
+    inline utf8_string to_utf8(Char value)
+    {
+        // always store as UTF8
+        utf8_string result;
+        typedef std::back_insert_iterator<utf8_string> insert_iter;
+        insert_iter out_iter(result);
+        utf8_output_iterator<insert_iter> utf8_iter(out_iter);
+        typedef typename make_unsigned<Char>::type UChar;
+        *utf8_iter = (UChar)value;
+        return result;
+    }
+
+    template <typename Char>
+    inline utf8_string to_utf8(Char const* str)
+    {
+        // always store as UTF8
+        utf8_string result;
+        typedef std::back_insert_iterator<utf8_string> insert_iter;
+        insert_iter out_iter(result);
+        utf8_output_iterator<insert_iter> utf8_iter(out_iter);
+        typedef typename make_unsigned<Char>::type UChar;
+        while (*str)
+            *utf8_iter++ = (UChar)*str++;
+        return result;
+    }
+
+    template <typename Char, typename Traits, typename Allocator>
+    inline utf8_string 
+    to_utf8(std::basic_string<Char, Traits, Allocator> const& str)
+    {
+        // always store as UTF8
+        utf8_string result;
+        typedef std::back_insert_iterator<utf8_string> insert_iter;
+        insert_iter out_iter(result);
+        utf8_output_iterator<insert_iter> utf8_iter(out_iter);
+        typedef typename make_unsigned<Char>::type UChar;
+        BOOST_FOREACH(Char ch, str)
+        {
+            *utf8_iter++ = (UChar)ch;
+        }
+        return result;
+    }
+}}
+
+#endif
Modified: trunk/boost/spirit/include/karma.hpp
==============================================================================
--- trunk/boost/spirit/include/karma.hpp	(original)
+++ trunk/boost/spirit/include/karma.hpp	2009-04-26 10:42:24 EDT (Sun, 26 Apr 2009)
@@ -1,6 +1,6 @@
 /*=============================================================================
-    Copyright (c) 2001-2008 Joel de Guzman
-    Copyright (c) 2001-2008 Hartmut Kaiser
+    Copyright (c) 2001-2009 Joel de Guzman
+    Copyright (c) 2001-2009 Hartmut Kaiser
     http://spirit.sourceforge.net/
 
     Distributed under the Boost Software License, Version 1.0. (See accompanying
Modified: trunk/boost/spirit/include/karma_action.hpp
==============================================================================
--- trunk/boost/spirit/include/karma_action.hpp	(original)
+++ trunk/boost/spirit/include/karma_action.hpp	2009-04-26 10:42:24 EDT (Sun, 26 Apr 2009)
@@ -1,6 +1,6 @@
 /*=============================================================================
-    Copyright (c) 2001-2008 Joel de Guzman
-    Copyright (c) 2001-2008 Hartmut Kaiser
+    Copyright (c) 2001-2009 Joel de Guzman
+    Copyright (c) 2001-2009 Hartmut Kaiser
     http://spirit.sourceforge.net/
 
     Distributed under the Boost Software License, Version 1.0. (See accompanying
Modified: trunk/boost/spirit/include/karma_auxiliary.hpp
==============================================================================
--- trunk/boost/spirit/include/karma_auxiliary.hpp	(original)
+++ trunk/boost/spirit/include/karma_auxiliary.hpp	2009-04-26 10:42:24 EDT (Sun, 26 Apr 2009)
@@ -1,6 +1,6 @@
 /*=============================================================================
-    Copyright (c) 2001-2008 Joel de Guzman
-    Copyright (c) 2001-2008 Hartmut Kaiser
+    Copyright (c) 2001-2009 Joel de Guzman
+    Copyright (c) 2001-2009 Hartmut Kaiser
     http://spirit.sourceforge.net/
 
     Distributed under the Boost Software License, Version 1.0. (See accompanying
Modified: trunk/boost/spirit/include/karma_binary.hpp
==============================================================================
--- trunk/boost/spirit/include/karma_binary.hpp	(original)
+++ trunk/boost/spirit/include/karma_binary.hpp	2009-04-26 10:42:24 EDT (Sun, 26 Apr 2009)
@@ -1,6 +1,6 @@
 /*=============================================================================
-    Copyright (c) 2001-2008 Joel de Guzman
-    Copyright (c) 2001-2008 Hartmut Kaiser
+    Copyright (c) 2001-2009 Joel de Guzman
+    Copyright (c) 2001-2009 Hartmut Kaiser
     http://spirit.sourceforge.net/
 
     Distributed under the Boost Software License, Version 1.0. (See accompanying
Modified: trunk/boost/spirit/include/karma_char.hpp
==============================================================================
--- trunk/boost/spirit/include/karma_char.hpp	(original)
+++ trunk/boost/spirit/include/karma_char.hpp	2009-04-26 10:42:24 EDT (Sun, 26 Apr 2009)
@@ -1,6 +1,6 @@
 /*=============================================================================
-    Copyright (c) 2001-2008 Joel de Guzman
-    Copyright (c) 2001-2008 Hartmut Kaiser
+    Copyright (c) 2001-2009 Joel de Guzman
+    Copyright (c) 2001-2009 Hartmut Kaiser
     http://spirit.sourceforge.net/
 
     Distributed under the Boost Software License, Version 1.0. (See accompanying
Modified: trunk/boost/spirit/include/karma_delimit.hpp
==============================================================================
--- trunk/boost/spirit/include/karma_delimit.hpp	(original)
+++ trunk/boost/spirit/include/karma_delimit.hpp	2009-04-26 10:42:24 EDT (Sun, 26 Apr 2009)
@@ -1,6 +1,6 @@
 /*=============================================================================
-    Copyright (c) 2001-2008 Joel de Guzman
-    Copyright (c) 2001-2008 Hartmut Kaiser
+    Copyright (c) 2001-2009 Joel de Guzman
+    Copyright (c) 2001-2009 Hartmut Kaiser
     http://spirit.sourceforge.net/
 
     Distributed under the Boost Software License, Version 1.0. (See accompanying
@@ -8,5 +8,5 @@
 =============================================================================*/
 #ifndef BOOST_SPIRIT_INCLUDE_KARMA_DELIMIT
 #define BOOST_SPIRIT_INCLUDE_KARMA_DELIMIT
-#include <boost/spirit/home/karma/delimit.hpp>
+#include <boost/spirit/home/karma/delimit_out.hpp>
 #endif
Modified: trunk/boost/spirit/include/karma_directive.hpp
==============================================================================
--- trunk/boost/spirit/include/karma_directive.hpp	(original)
+++ trunk/boost/spirit/include/karma_directive.hpp	2009-04-26 10:42:24 EDT (Sun, 26 Apr 2009)
@@ -1,6 +1,6 @@
 /*=============================================================================
-    Copyright (c) 2001-2008 Joel de Guzman
-    Copyright (c) 2001-2008 Hartmut Kaiser
+    Copyright (c) 2001-2009 Joel de Guzman
+    Copyright (c) 2001-2009 Hartmut Kaiser
     http://spirit.sourceforge.net/
 
     Distributed under the Boost Software License, Version 1.0. (See accompanying
Modified: trunk/boost/spirit/include/karma_domain.hpp
==============================================================================
--- trunk/boost/spirit/include/karma_domain.hpp	(original)
+++ trunk/boost/spirit/include/karma_domain.hpp	2009-04-26 10:42:24 EDT (Sun, 26 Apr 2009)
@@ -1,6 +1,6 @@
 /*=============================================================================
-    Copyright (c) 2001-2008 Joel de Guzman
-    Copyright (c) 2001-2008 Hartmut Kaiser
+    Copyright (c) 2001-2009 Joel de Guzman
+    Copyright (c) 2001-2009 Hartmut Kaiser
     http://spirit.sourceforge.net/
 
     Distributed under the Boost Software License, Version 1.0. (See accompanying
Modified: trunk/boost/spirit/include/karma_generate.hpp
==============================================================================
--- trunk/boost/spirit/include/karma_generate.hpp	(original)
+++ trunk/boost/spirit/include/karma_generate.hpp	2009-04-26 10:42:24 EDT (Sun, 26 Apr 2009)
@@ -1,6 +1,6 @@
 /*=============================================================================
-    Copyright (c) 2001-2008 Joel de Guzman
-    Copyright (c) 2001-2008 Hartmut Kaiser
+    Copyright (c) 2001-2009 Joel de Guzman
+    Copyright (c) 2001-2009 Hartmut Kaiser
     http://spirit.sourceforge.net/
 
     Distributed under the Boost Software License, Version 1.0. (See accompanying
Deleted: trunk/boost/spirit/include/karma_meta_grammar.hpp
==============================================================================
--- trunk/boost/spirit/include/karma_meta_grammar.hpp	2009-04-26 10:42:24 EDT (Sun, 26 Apr 2009)
+++ (empty file)
@@ -1,12 +0,0 @@
-/*=============================================================================
-    Copyright (c) 2001-2008 Joel de Guzman
-    Copyright (c) 2001-2008 Hartmut Kaiser
-    http://spirit.sourceforge.net/
-
-    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)
-=============================================================================*/
-#ifndef BOOST_SPIRIT_INCLUDE_KARMA_META_GRAMMAR
-#define BOOST_SPIRIT_INCLUDE_KARMA_META_GRAMMAR
-#include <boost/spirit/home/karma/meta_grammar.hpp>
-#endif
Modified: trunk/boost/spirit/include/karma_nonterminal.hpp
==============================================================================
--- trunk/boost/spirit/include/karma_nonterminal.hpp	(original)
+++ trunk/boost/spirit/include/karma_nonterminal.hpp	2009-04-26 10:42:24 EDT (Sun, 26 Apr 2009)
@@ -1,6 +1,6 @@
 /*=============================================================================
-    Copyright (c) 2001-2008 Joel de Guzman
-    Copyright (c) 2001-2008 Hartmut Kaiser
+    Copyright (c) 2001-2009 Joel de Guzman
+    Copyright (c) 2001-2009 Hartmut Kaiser
     http://spirit.sourceforge.net/
 
     Distributed under the Boost Software License, Version 1.0. (See accompanying
Modified: trunk/boost/spirit/include/karma_numeric.hpp
==============================================================================
--- trunk/boost/spirit/include/karma_numeric.hpp	(original)
+++ trunk/boost/spirit/include/karma_numeric.hpp	2009-04-26 10:42:24 EDT (Sun, 26 Apr 2009)
@@ -1,6 +1,6 @@
 /*=============================================================================
-    Copyright (c) 2001-2008 Joel de Guzman
-    Copyright (c) 2001-2008 Hartmut Kaiser
+    Copyright (c) 2001-2009 Joel de Guzman
+    Copyright (c) 2001-2009 Hartmut Kaiser
     http://spirit.sourceforge.net/
 
     Distributed under the Boost Software License, Version 1.0. (See accompanying
Modified: trunk/boost/spirit/include/karma_operator.hpp
==============================================================================
--- trunk/boost/spirit/include/karma_operator.hpp	(original)
+++ trunk/boost/spirit/include/karma_operator.hpp	2009-04-26 10:42:24 EDT (Sun, 26 Apr 2009)
@@ -1,6 +1,6 @@
 /*=============================================================================
-    Copyright (c) 2001-2008 Joel de Guzman
-    Copyright (c) 2001-2008 Hartmut Kaiser
+    Copyright (c) 2001-2009 Joel de Guzman
+    Copyright (c) 2001-2009 Hartmut Kaiser
     http://spirit.sourceforge.net/
 
     Distributed under the Boost Software License, Version 1.0. (See accompanying
Modified: trunk/boost/spirit/include/karma_stream.hpp
==============================================================================
--- trunk/boost/spirit/include/karma_stream.hpp	(original)
+++ trunk/boost/spirit/include/karma_stream.hpp	2009-04-26 10:42:24 EDT (Sun, 26 Apr 2009)
@@ -1,6 +1,6 @@
 /*=============================================================================
-    Copyright (c) 2001-2008 Joel de Guzman
-    Copyright (c) 2001-2008 Hartmut Kaiser
+    Copyright (c) 2001-2009 Joel de Guzman
+    Copyright (c) 2001-2009 Hartmut Kaiser
     http://spirit.sourceforge.net/
 
     Distributed under the Boost Software License, Version 1.0. (See accompanying
Modified: trunk/boost/spirit/include/karma_string.hpp
==============================================================================
--- trunk/boost/spirit/include/karma_string.hpp	(original)
+++ trunk/boost/spirit/include/karma_string.hpp	2009-04-26 10:42:24 EDT (Sun, 26 Apr 2009)
@@ -1,6 +1,6 @@
 /*=============================================================================
-    Copyright (c) 2001-2008 Joel de Guzman
-    Copyright (c) 2001-2008 Hartmut Kaiser
+    Copyright (c) 2001-2009 Joel de Guzman
+    Copyright (c) 2001-2009 Hartmut Kaiser
     http://spirit.sourceforge.net/
 
     Distributed under the Boost Software License, Version 1.0. (See accompanying
Modified: trunk/boost/spirit/include/karma_what.hpp
==============================================================================
--- trunk/boost/spirit/include/karma_what.hpp	(original)
+++ trunk/boost/spirit/include/karma_what.hpp	2009-04-26 10:42:24 EDT (Sun, 26 Apr 2009)
@@ -1,6 +1,6 @@
 /*=============================================================================
-    Copyright (c) 2001-2008 Joel de Guzman
-    Copyright (c) 2001-2008 Hartmut Kaiser
+    Copyright (c) 2001-2009 Joel de Guzman
+    Copyright (c) 2001-2009 Hartmut Kaiser
     http://spirit.sourceforge.net/
 
     Distributed under the Boost Software License, Version 1.0. (See accompanying
Modified: trunk/boost/spirit/include/lex.hpp
==============================================================================
--- trunk/boost/spirit/include/lex.hpp	(original)
+++ trunk/boost/spirit/include/lex.hpp	2009-04-26 10:42:24 EDT (Sun, 26 Apr 2009)
@@ -1,6 +1,6 @@
 /*=============================================================================
-    Copyright (c) 2001-2008 Joel de Guzman
-    Copyright (c) 2001-2008 Hartmut Kaiser
+    Copyright (c) 2001-2009 Joel de Guzman
+    Copyright (c) 2001-2009 Hartmut Kaiser
     http://spirit.sourceforge.net/
 
     Distributed under the Boost Software License, Version 1.0. (See accompanying
Modified: trunk/boost/spirit/include/lex_domain.hpp
==============================================================================
--- trunk/boost/spirit/include/lex_domain.hpp	(original)
+++ trunk/boost/spirit/include/lex_domain.hpp	2009-04-26 10:42:24 EDT (Sun, 26 Apr 2009)
@@ -1,6 +1,6 @@
 /*=============================================================================
-    Copyright (c) 2001-2008 Joel de Guzman
-    Copyright (c) 2001-2008 Hartmut Kaiser
+    Copyright (c) 2001-2009 Joel de Guzman
+    Copyright (c) 2001-2009 Hartmut Kaiser
     http://spirit.sourceforge.net/
 
     Distributed under the Boost Software License, Version 1.0. (See accompanying
Modified: trunk/boost/spirit/include/lex_lexer.hpp
==============================================================================
--- trunk/boost/spirit/include/lex_lexer.hpp	(original)
+++ trunk/boost/spirit/include/lex_lexer.hpp	2009-04-26 10:42:24 EDT (Sun, 26 Apr 2009)
@@ -1,6 +1,6 @@
 /*=============================================================================
-    Copyright (c) 2001-2008 Joel de Guzman
-    Copyright (c) 2001-2008 Hartmut Kaiser
+    Copyright (c) 2001-2009 Joel de Guzman
+    Copyright (c) 2001-2009 Hartmut Kaiser
     http://spirit.sourceforge.net/
 
     Distributed under the Boost Software License, Version 1.0. (See accompanying
Deleted: trunk/boost/spirit/include/lex_lexer_lexertl.hpp
==============================================================================
--- trunk/boost/spirit/include/lex_lexer_lexertl.hpp	2009-04-26 10:42:24 EDT (Sun, 26 Apr 2009)
+++ (empty file)
@@ -1,12 +0,0 @@
-/*=============================================================================
-    Copyright (c) 2001-2008 Joel de Guzman
-    Copyright (c) 2001-2008 Hartmut Kaiser
-    http://spirit.sourceforge.net/
-
-    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)
-=============================================================================*/
-#ifndef BOOST_SPIRIT_INCLUDE_LEX_LEXER_LEXERTL
-#define BOOST_SPIRIT_INCLUDE_LEX_LEXER_LEXERTL
-#include <boost/spirit/home/lex/lexer_lexertl.hpp>
-#endif
Deleted: trunk/boost/spirit/include/lex_lexer_static_lexertl.hpp
==============================================================================
--- trunk/boost/spirit/include/lex_lexer_static_lexertl.hpp	2009-04-26 10:42:24 EDT (Sun, 26 Apr 2009)
+++ (empty file)
@@ -1,12 +0,0 @@
-/*=============================================================================
-    Copyright (c) 2001-2008 Joel de Guzman
-    Copyright (c) 2001-2008 Hartmut Kaiser
-    http://spirit.sourceforge.net/
-
-    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)
-=============================================================================*/
-#ifndef BOOST_SPIRIT_INCLUDE_LEX_LEXER_STATIC_LEXERTL
-#define BOOST_SPIRIT_INCLUDE_LEX_LEXER_STATIC_LEXERTL
-#include <boost/spirit/home/lex/lexer_static_lexertl.hpp>
-#endif
Deleted: trunk/boost/spirit/include/lex_meta_grammar.hpp
==============================================================================
--- trunk/boost/spirit/include/lex_meta_grammar.hpp	2009-04-26 10:42:24 EDT (Sun, 26 Apr 2009)
+++ (empty file)
@@ -1,12 +0,0 @@
-/*=============================================================================
-    Copyright (c) 2001-2008 Joel de Guzman
-    Copyright (c) 2001-2008 Hartmut Kaiser
-    http://spirit.sourceforge.net/
-
-    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)
-=============================================================================*/
-#ifndef BOOST_SPIRIT_INCLUDE_LEX_META_GRAMMAR
-#define BOOST_SPIRIT_INCLUDE_LEX_META_GRAMMAR
-#include <boost/spirit/home/lex/meta_grammar.hpp>
-#endif
Deleted: trunk/boost/spirit/include/lex_set_state.hpp
==============================================================================
--- trunk/boost/spirit/include/lex_set_state.hpp	2009-04-26 10:42:24 EDT (Sun, 26 Apr 2009)
+++ (empty file)
@@ -1,12 +0,0 @@
-/*=============================================================================
-    Copyright (c) 2001-2008 Joel de Guzman
-    Copyright (c) 2001-2008 Hartmut Kaiser
-    http://spirit.sourceforge.net/
-
-    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)
-=============================================================================*/
-#ifndef BOOST_SPIRIT_INCLUDE_LEX_SET_STATE
-#define BOOST_SPIRIT_INCLUDE_LEX_SET_STATE
-#include <boost/spirit/home/lex/set_state.hpp>
-#endif
Modified: trunk/boost/spirit/include/lex_tokenize_and_parse.hpp
==============================================================================
--- trunk/boost/spirit/include/lex_tokenize_and_parse.hpp	(original)
+++ trunk/boost/spirit/include/lex_tokenize_and_parse.hpp	2009-04-26 10:42:24 EDT (Sun, 26 Apr 2009)
@@ -1,6 +1,6 @@
 /*=============================================================================
-    Copyright (c) 2001-2008 Joel de Guzman
-    Copyright (c) 2001-2008 Hartmut Kaiser
+    Copyright (c) 2001-2009 Joel de Guzman
+    Copyright (c) 2001-2009 Hartmut Kaiser
     http://spirit.sourceforge.net/
 
     Distributed under the Boost Software License, Version 1.0. (See accompanying
Modified: trunk/boost/spirit/include/phoenix.hpp
==============================================================================
--- trunk/boost/spirit/include/phoenix.hpp	(original)
+++ trunk/boost/spirit/include/phoenix.hpp	2009-04-26 10:42:24 EDT (Sun, 26 Apr 2009)
@@ -1,6 +1,6 @@
 /*=============================================================================
-    Copyright (c) 2001-2008 Joel de Guzman
-    Copyright (c) 2001-2008 Hartmut Kaiser
+    Copyright (c) 2001-2009 Joel de Guzman
+    Copyright (c) 2001-2009 Hartmut Kaiser
     http://spirit.sourceforge.net/
 
     Distributed under the Boost Software License, Version 1.0. (See accompanying
Modified: trunk/boost/spirit/include/phoenix_algorithm.hpp
==============================================================================
--- trunk/boost/spirit/include/phoenix_algorithm.hpp	(original)
+++ trunk/boost/spirit/include/phoenix_algorithm.hpp	2009-04-26 10:42:24 EDT (Sun, 26 Apr 2009)
@@ -1,6 +1,6 @@
 /*=============================================================================
-    Copyright (c) 2001-2008 Joel de Guzman
-    Copyright (c) 2001-2008 Hartmut Kaiser
+    Copyright (c) 2001-2009 Joel de Guzman
+    Copyright (c) 2001-2009 Hartmut Kaiser
     http://spirit.sourceforge.net/
 
     Distributed under the Boost Software License, Version 1.0. (See accompanying
Modified: trunk/boost/spirit/include/phoenix_bind.hpp
==============================================================================
--- trunk/boost/spirit/include/phoenix_bind.hpp	(original)
+++ trunk/boost/spirit/include/phoenix_bind.hpp	2009-04-26 10:42:24 EDT (Sun, 26 Apr 2009)
@@ -1,6 +1,6 @@
 /*=============================================================================
-    Copyright (c) 2001-2008 Joel de Guzman
-    Copyright (c) 2001-2008 Hartmut Kaiser
+    Copyright (c) 2001-2009 Joel de Guzman
+    Copyright (c) 2001-2009 Hartmut Kaiser
     http://spirit.sourceforge.net/
 
     Distributed under the Boost Software License, Version 1.0. (See accompanying
Modified: trunk/boost/spirit/include/phoenix_container.hpp
==============================================================================
--- trunk/boost/spirit/include/phoenix_container.hpp	(original)
+++ trunk/boost/spirit/include/phoenix_container.hpp	2009-04-26 10:42:24 EDT (Sun, 26 Apr 2009)
@@ -1,6 +1,6 @@
 /*=============================================================================
-    Copyright (c) 2001-2008 Joel de Guzman
-    Copyright (c) 2001-2008 Hartmut Kaiser
+    Copyright (c) 2001-2009 Joel de Guzman
+    Copyright (c) 2001-2009 Hartmut Kaiser
     http://spirit.sourceforge.net/
 
     Distributed under the Boost Software License, Version 1.0. (See accompanying
Modified: trunk/boost/spirit/include/phoenix_core.hpp
==============================================================================
--- trunk/boost/spirit/include/phoenix_core.hpp	(original)
+++ trunk/boost/spirit/include/phoenix_core.hpp	2009-04-26 10:42:24 EDT (Sun, 26 Apr 2009)
@@ -1,6 +1,6 @@
 /*=============================================================================
-    Copyright (c) 2001-2008 Joel de Guzman
-    Copyright (c) 2001-2008 Hartmut Kaiser
+    Copyright (c) 2001-2009 Joel de Guzman
+    Copyright (c) 2001-2009 Hartmut Kaiser
     http://spirit.sourceforge.net/
 
     Distributed under the Boost Software License, Version 1.0. (See accompanying
Modified: trunk/boost/spirit/include/phoenix_function.hpp
==============================================================================
--- trunk/boost/spirit/include/phoenix_function.hpp	(original)
+++ trunk/boost/spirit/include/phoenix_function.hpp	2009-04-26 10:42:24 EDT (Sun, 26 Apr 2009)
@@ -1,6 +1,6 @@
 /*=============================================================================
-    Copyright (c) 2001-2008 Joel de Guzman
-    Copyright (c) 2001-2008 Hartmut Kaiser
+    Copyright (c) 2001-2009 Joel de Guzman
+    Copyright (c) 2001-2009 Hartmut Kaiser
     http://spirit.sourceforge.net/
 
     Distributed under the Boost Software License, Version 1.0. (See accompanying
Modified: trunk/boost/spirit/include/phoenix_fusion.hpp
==============================================================================
--- trunk/boost/spirit/include/phoenix_fusion.hpp	(original)
+++ trunk/boost/spirit/include/phoenix_fusion.hpp	2009-04-26 10:42:24 EDT (Sun, 26 Apr 2009)
@@ -1,6 +1,6 @@
 /*=============================================================================
-    Copyright (c) 2001-2008 Joel de Guzman
-    Copyright (c) 2001-2008 Hartmut Kaiser
+    Copyright (c) 2001-2009 Joel de Guzman
+    Copyright (c) 2001-2009 Hartmut Kaiser
     http://spirit.sourceforge.net/
 
     Distributed under the Boost Software License, Version 1.0. (See accompanying
Modified: trunk/boost/spirit/include/phoenix_object.hpp
==============================================================================
--- trunk/boost/spirit/include/phoenix_object.hpp	(original)
+++ trunk/boost/spirit/include/phoenix_object.hpp	2009-04-26 10:42:24 EDT (Sun, 26 Apr 2009)
@@ -1,6 +1,6 @@
 /*=============================================================================
-    Copyright (c) 2001-2008 Joel de Guzman
-    Copyright (c) 2001-2008 Hartmut Kaiser
+    Copyright (c) 2001-2009 Joel de Guzman
+    Copyright (c) 2001-2009 Hartmut Kaiser
     http://spirit.sourceforge.net/
 
     Distributed under the Boost Software License, Version 1.0. (See accompanying
Modified: trunk/boost/spirit/include/phoenix_operator.hpp
==============================================================================
--- trunk/boost/spirit/include/phoenix_operator.hpp	(original)
+++ trunk/boost/spirit/include/phoenix_operator.hpp	2009-04-26 10:42:24 EDT (Sun, 26 Apr 2009)
@@ -1,6 +1,6 @@
 /*=============================================================================
-    Copyright (c) 2001-2008 Joel de Guzman
-    Copyright (c) 2001-2008 Hartmut Kaiser
+    Copyright (c) 2001-2009 Joel de Guzman
+    Copyright (c) 2001-2009 Hartmut Kaiser
     http://spirit.sourceforge.net/
 
     Distributed under the Boost Software License, Version 1.0. (See accompanying
Modified: trunk/boost/spirit/include/phoenix_scope.hpp
==============================================================================
--- trunk/boost/spirit/include/phoenix_scope.hpp	(original)
+++ trunk/boost/spirit/include/phoenix_scope.hpp	2009-04-26 10:42:24 EDT (Sun, 26 Apr 2009)
@@ -1,6 +1,6 @@
 /*=============================================================================
-    Copyright (c) 2001-2008 Joel de Guzman
-    Copyright (c) 2001-2008 Hartmut Kaiser
+    Copyright (c) 2001-2009 Joel de Guzman
+    Copyright (c) 2001-2009 Hartmut Kaiser
     http://spirit.sourceforge.net/
 
     Distributed under the Boost Software License, Version 1.0. (See accompanying
Modified: trunk/boost/spirit/include/phoenix_statement.hpp
==============================================================================
--- trunk/boost/spirit/include/phoenix_statement.hpp	(original)
+++ trunk/boost/spirit/include/phoenix_statement.hpp	2009-04-26 10:42:24 EDT (Sun, 26 Apr 2009)
@@ -1,6 +1,6 @@
 /*=============================================================================
-    Copyright (c) 2001-2008 Joel de Guzman
-    Copyright (c) 2001-2008 Hartmut Kaiser
+    Copyright (c) 2001-2009 Joel de Guzman
+    Copyright (c) 2001-2009 Hartmut Kaiser
     http://spirit.sourceforge.net/
 
     Distributed under the Boost Software License, Version 1.0. (See accompanying
Modified: trunk/boost/spirit/include/phoenix_stl.hpp
==============================================================================
--- trunk/boost/spirit/include/phoenix_stl.hpp	(original)
+++ trunk/boost/spirit/include/phoenix_stl.hpp	2009-04-26 10:42:24 EDT (Sun, 26 Apr 2009)
@@ -1,6 +1,6 @@
 /*=============================================================================
-    Copyright (c) 2001-2008 Joel de Guzman
-    Copyright (c) 2001-2008 Hartmut Kaiser
+    Copyright (c) 2001-2009 Joel de Guzman
+    Copyright (c) 2001-2009 Hartmut Kaiser
     http://spirit.sourceforge.net/
 
     Distributed under the Boost Software License, Version 1.0. (See accompanying
Modified: trunk/boost/spirit/include/phoenix_version.hpp
==============================================================================
--- trunk/boost/spirit/include/phoenix_version.hpp	(original)
+++ trunk/boost/spirit/include/phoenix_version.hpp	2009-04-26 10:42:24 EDT (Sun, 26 Apr 2009)
@@ -1,6 +1,6 @@
 /*=============================================================================
-    Copyright (c) 2001-2008 Joel de Guzman
-    Copyright (c) 2001-2008 Hartmut Kaiser
+    Copyright (c) 2001-2009 Joel de Guzman
+    Copyright (c) 2001-2009 Hartmut Kaiser
     http://spirit.sourceforge.net/
 
     Distributed under the Boost Software License, Version 1.0. (See accompanying
Modified: trunk/boost/spirit/include/qi.hpp
==============================================================================
--- trunk/boost/spirit/include/qi.hpp	(original)
+++ trunk/boost/spirit/include/qi.hpp	2009-04-26 10:42:24 EDT (Sun, 26 Apr 2009)
@@ -1,6 +1,6 @@
 /*=============================================================================
-    Copyright (c) 2001-2008 Joel de Guzman
-    Copyright (c) 2001-2008 Hartmut Kaiser
+    Copyright (c) 2001-2009 Joel de Guzman
+    Copyright (c) 2001-2009 Hartmut Kaiser
     http://spirit.sourceforge.net/
 
     Distributed under the Boost Software License, Version 1.0. (See accompanying
Modified: trunk/boost/spirit/include/qi_action.hpp
==============================================================================
--- trunk/boost/spirit/include/qi_action.hpp	(original)
+++ trunk/boost/spirit/include/qi_action.hpp	2009-04-26 10:42:24 EDT (Sun, 26 Apr 2009)
@@ -1,6 +1,6 @@
 /*=============================================================================
-    Copyright (c) 2001-2008 Joel de Guzman
-    Copyright (c) 2001-2008 Hartmut Kaiser
+    Copyright (c) 2001-2009 Joel de Guzman
+    Copyright (c) 2001-2009 Hartmut Kaiser
     http://spirit.sourceforge.net/
 
     Distributed under the Boost Software License, Version 1.0. (See accompanying
Modified: trunk/boost/spirit/include/qi_auxiliary.hpp
==============================================================================
--- trunk/boost/spirit/include/qi_auxiliary.hpp	(original)
+++ trunk/boost/spirit/include/qi_auxiliary.hpp	2009-04-26 10:42:24 EDT (Sun, 26 Apr 2009)
@@ -1,6 +1,6 @@
 /*=============================================================================
-    Copyright (c) 2001-2008 Joel de Guzman
-    Copyright (c) 2001-2008 Hartmut Kaiser
+    Copyright (c) 2001-2009 Joel de Guzman
+    Copyright (c) 2001-2009 Hartmut Kaiser
     http://spirit.sourceforge.net/
 
     Distributed under the Boost Software License, Version 1.0. (See accompanying
Modified: trunk/boost/spirit/include/qi_binary.hpp
==============================================================================
--- trunk/boost/spirit/include/qi_binary.hpp	(original)
+++ trunk/boost/spirit/include/qi_binary.hpp	2009-04-26 10:42:24 EDT (Sun, 26 Apr 2009)
@@ -1,6 +1,6 @@
 /*=============================================================================
-    Copyright (c) 2001-2008 Joel de Guzman
-    Copyright (c) 2001-2008 Hartmut Kaiser
+    Copyright (c) 2001-2009 Joel de Guzman
+    Copyright (c) 2001-2009 Hartmut Kaiser
     http://spirit.sourceforge.net/
 
     Distributed under the Boost Software License, Version 1.0. (See accompanying
Modified: trunk/boost/spirit/include/qi_char.hpp
==============================================================================
--- trunk/boost/spirit/include/qi_char.hpp	(original)
+++ trunk/boost/spirit/include/qi_char.hpp	2009-04-26 10:42:24 EDT (Sun, 26 Apr 2009)
@@ -1,6 +1,6 @@
 /*=============================================================================
-    Copyright (c) 2001-2008 Joel de Guzman
-    Copyright (c) 2001-2008 Hartmut Kaiser
+    Copyright (c) 2001-2009 Joel de Guzman
+    Copyright (c) 2001-2009 Hartmut Kaiser
     http://spirit.sourceforge.net/
 
     Distributed under the Boost Software License, Version 1.0. (See accompanying
Modified: trunk/boost/spirit/include/qi_debug.hpp
==============================================================================
--- trunk/boost/spirit/include/qi_debug.hpp	(original)
+++ trunk/boost/spirit/include/qi_debug.hpp	2009-04-26 10:42:24 EDT (Sun, 26 Apr 2009)
@@ -1,6 +1,6 @@
 /*=============================================================================
-    Copyright (c) 2001-2008 Joel de Guzman
-    Copyright (c) 2001-2008 Hartmut Kaiser
+    Copyright (c) 2001-2009 Joel de Guzman
+    Copyright (c) 2001-2009 Hartmut Kaiser
     http://spirit.sourceforge.net/
 
     Distributed under the Boost Software License, Version 1.0. (See accompanying
Modified: trunk/boost/spirit/include/qi_directive.hpp
==============================================================================
--- trunk/boost/spirit/include/qi_directive.hpp	(original)
+++ trunk/boost/spirit/include/qi_directive.hpp	2009-04-26 10:42:24 EDT (Sun, 26 Apr 2009)
@@ -1,6 +1,6 @@
 /*=============================================================================
-    Copyright (c) 2001-2008 Joel de Guzman
-    Copyright (c) 2001-2008 Hartmut Kaiser
+    Copyright (c) 2001-2009 Joel de Guzman
+    Copyright (c) 2001-2009 Hartmut Kaiser
     http://spirit.sourceforge.net/
 
     Distributed under the Boost Software License, Version 1.0. (See accompanying
Modified: trunk/boost/spirit/include/qi_domain.hpp
==============================================================================
--- trunk/boost/spirit/include/qi_domain.hpp	(original)
+++ trunk/boost/spirit/include/qi_domain.hpp	2009-04-26 10:42:24 EDT (Sun, 26 Apr 2009)
@@ -1,6 +1,6 @@
 /*=============================================================================
-    Copyright (c) 2001-2008 Joel de Guzman
-    Copyright (c) 2001-2008 Hartmut Kaiser
+    Copyright (c) 2001-2009 Joel de Guzman
+    Copyright (c) 2001-2009 Hartmut Kaiser
     http://spirit.sourceforge.net/
 
     Distributed under the Boost Software License, Version 1.0. (See accompanying
Deleted: trunk/boost/spirit/include/qi_meta_grammar.hpp
==============================================================================
--- trunk/boost/spirit/include/qi_meta_grammar.hpp	2009-04-26 10:42:24 EDT (Sun, 26 Apr 2009)
+++ (empty file)
@@ -1,12 +0,0 @@
-/*=============================================================================
-    Copyright (c) 2001-2008 Joel de Guzman
-    Copyright (c) 2001-2008 Hartmut Kaiser
-    http://spirit.sourceforge.net/
-
-    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)
-=============================================================================*/
-#ifndef BOOST_SPIRIT_INCLUDE_QI_META_GRAMMAR
-#define BOOST_SPIRIT_INCLUDE_QI_META_GRAMMAR
-#include <boost/spirit/home/qi/meta_grammar.hpp>
-#endif
Modified: trunk/boost/spirit/include/qi_nonterminal.hpp
==============================================================================
--- trunk/boost/spirit/include/qi_nonterminal.hpp	(original)
+++ trunk/boost/spirit/include/qi_nonterminal.hpp	2009-04-26 10:42:24 EDT (Sun, 26 Apr 2009)
@@ -1,6 +1,6 @@
 /*=============================================================================
-    Copyright (c) 2001-2008 Joel de Guzman
-    Copyright (c) 2001-2008 Hartmut Kaiser
+    Copyright (c) 2001-2009 Joel de Guzman
+    Copyright (c) 2001-2009 Hartmut Kaiser
     http://spirit.sourceforge.net/
 
     Distributed under the Boost Software License, Version 1.0. (See accompanying
Modified: trunk/boost/spirit/include/qi_numeric.hpp
==============================================================================
--- trunk/boost/spirit/include/qi_numeric.hpp	(original)
+++ trunk/boost/spirit/include/qi_numeric.hpp	2009-04-26 10:42:24 EDT (Sun, 26 Apr 2009)
@@ -1,6 +1,6 @@
 /*=============================================================================
-    Copyright (c) 2001-2008 Joel de Guzman
-    Copyright (c) 2001-2008 Hartmut Kaiser
+    Copyright (c) 2001-2009 Joel de Guzman
+    Copyright (c) 2001-2009 Hartmut Kaiser
     http://spirit.sourceforge.net/
 
     Distributed under the Boost Software License, Version 1.0. (See accompanying
Modified: trunk/boost/spirit/include/qi_operator.hpp
==============================================================================
--- trunk/boost/spirit/include/qi_operator.hpp	(original)
+++ trunk/boost/spirit/include/qi_operator.hpp	2009-04-26 10:42:24 EDT (Sun, 26 Apr 2009)
@@ -1,6 +1,6 @@
 /*=============================================================================
-    Copyright (c) 2001-2008 Joel de Guzman
-    Copyright (c) 2001-2008 Hartmut Kaiser
+    Copyright (c) 2001-2009 Joel de Guzman
+    Copyright (c) 2001-2009 Hartmut Kaiser
     http://spirit.sourceforge.net/
 
     Distributed under the Boost Software License, Version 1.0. (See accompanying
Modified: trunk/boost/spirit/include/qi_parse.hpp
==============================================================================
--- trunk/boost/spirit/include/qi_parse.hpp	(original)
+++ trunk/boost/spirit/include/qi_parse.hpp	2009-04-26 10:42:24 EDT (Sun, 26 Apr 2009)
@@ -1,6 +1,6 @@
 /*=============================================================================
-    Copyright (c) 2001-2008 Joel de Guzman
-    Copyright (c) 2001-2008 Hartmut Kaiser
+    Copyright (c) 2001-2009 Joel de Guzman
+    Copyright (c) 2001-2009 Hartmut Kaiser
     http://spirit.sourceforge.net/
 
     Distributed under the Boost Software License, Version 1.0. (See accompanying
Modified: trunk/boost/spirit/include/qi_skip.hpp
==============================================================================
--- trunk/boost/spirit/include/qi_skip.hpp	(original)
+++ trunk/boost/spirit/include/qi_skip.hpp	2009-04-26 10:42:24 EDT (Sun, 26 Apr 2009)
@@ -1,6 +1,6 @@
 /*=============================================================================
-    Copyright (c) 2001-2008 Joel de Guzman
-    Copyright (c) 2001-2008 Hartmut Kaiser
+    Copyright (c) 2001-2009 Joel de Guzman
+    Copyright (c) 2001-2009 Hartmut Kaiser
     http://spirit.sourceforge.net/
 
     Distributed under the Boost Software License, Version 1.0. (See accompanying
@@ -8,5 +8,5 @@
 =============================================================================*/
 #ifndef BOOST_SPIRIT_INCLUDE_QI_SKIP
 #define BOOST_SPIRIT_INCLUDE_QI_SKIP
-#include <boost/spirit/home/qi/skip.hpp>
+#include <boost/spirit/home/qi/skip_over.hpp>
 #endif
Modified: trunk/boost/spirit/include/qi_stream.hpp
==============================================================================
--- trunk/boost/spirit/include/qi_stream.hpp	(original)
+++ trunk/boost/spirit/include/qi_stream.hpp	2009-04-26 10:42:24 EDT (Sun, 26 Apr 2009)
@@ -1,6 +1,6 @@
 /*=============================================================================
-    Copyright (c) 2001-2008 Joel de Guzman
-    Copyright (c) 2001-2008 Hartmut Kaiser
+    Copyright (c) 2001-2009 Joel de Guzman
+    Copyright (c) 2001-2009 Hartmut Kaiser
     http://spirit.sourceforge.net/
 
     Distributed under the Boost Software License, Version 1.0. (See accompanying
Modified: trunk/boost/spirit/include/qi_string.hpp
==============================================================================
--- trunk/boost/spirit/include/qi_string.hpp	(original)
+++ trunk/boost/spirit/include/qi_string.hpp	2009-04-26 10:42:24 EDT (Sun, 26 Apr 2009)
@@ -1,6 +1,6 @@
 /*=============================================================================
-    Copyright (c) 2001-2008 Joel de Guzman
-    Copyright (c) 2001-2008 Hartmut Kaiser
+    Copyright (c) 2001-2009 Joel de Guzman
+    Copyright (c) 2001-2009 Hartmut Kaiser
     http://spirit.sourceforge.net/
 
     Distributed under the Boost Software License, Version 1.0. (See accompanying
Modified: trunk/boost/spirit/include/qi_what.hpp
==============================================================================
--- trunk/boost/spirit/include/qi_what.hpp	(original)
+++ trunk/boost/spirit/include/qi_what.hpp	2009-04-26 10:42:24 EDT (Sun, 26 Apr 2009)
@@ -1,6 +1,6 @@
 /*=============================================================================
-    Copyright (c) 2001-2008 Joel de Guzman
-    Copyright (c) 2001-2008 Hartmut Kaiser
+    Copyright (c) 2001-2009 Joel de Guzman
+    Copyright (c) 2001-2009 Hartmut Kaiser
     http://spirit.sourceforge.net/
 
     Distributed under the Boost Software License, Version 1.0. (See accompanying
Modified: trunk/boost/spirit/include/support.hpp
==============================================================================
--- trunk/boost/spirit/include/support.hpp	(original)
+++ trunk/boost/spirit/include/support.hpp	2009-04-26 10:42:24 EDT (Sun, 26 Apr 2009)
@@ -1,6 +1,6 @@
 /*=============================================================================
-    Copyright (c) 2001-2008 Joel de Guzman
-    Copyright (c) 2001-2008 Hartmut Kaiser
+    Copyright (c) 2001-2009 Joel de Guzman
+    Copyright (c) 2001-2009 Hartmut Kaiser
     http://spirit.sourceforge.net/
 
     Distributed under the Boost Software License, Version 1.0. (See accompanying
Modified: trunk/boost/spirit/include/support_any.hpp
==============================================================================
--- trunk/boost/spirit/include/support_any.hpp	(original)
+++ trunk/boost/spirit/include/support_any.hpp	2009-04-26 10:42:24 EDT (Sun, 26 Apr 2009)
@@ -1,6 +1,6 @@
 /*=============================================================================
-    Copyright (c) 2001-2008 Joel de Guzman
-    Copyright (c) 2001-2008 Hartmut Kaiser
+    Copyright (c) 2001-2009 Joel de Guzman
+    Copyright (c) 2001-2009 Hartmut Kaiser
     http://spirit.sourceforge.net/
 
     Distributed under the Boost Software License, Version 1.0. (See accompanying
Modified: trunk/boost/spirit/include/support_any_if.hpp
==============================================================================
--- trunk/boost/spirit/include/support_any_if.hpp	(original)
+++ trunk/boost/spirit/include/support_any_if.hpp	2009-04-26 10:42:24 EDT (Sun, 26 Apr 2009)
@@ -1,6 +1,6 @@
 /*=============================================================================
-    Copyright (c) 2001-2008 Joel de Guzman
-    Copyright (c) 2001-2008 Hartmut Kaiser
+    Copyright (c) 2001-2009 Joel de Guzman
+    Copyright (c) 2001-2009 Hartmut Kaiser
     http://spirit.sourceforge.net/
 
     Distributed under the Boost Software License, Version 1.0. (See accompanying
Modified: trunk/boost/spirit/include/support_any_ns.hpp
==============================================================================
--- trunk/boost/spirit/include/support_any_ns.hpp	(original)
+++ trunk/boost/spirit/include/support_any_ns.hpp	2009-04-26 10:42:24 EDT (Sun, 26 Apr 2009)
@@ -1,6 +1,6 @@
 /*=============================================================================
-    Copyright (c) 2001-2008 Joel de Guzman
-    Copyright (c) 2001-2008 Hartmut Kaiser
+    Copyright (c) 2001-2009 Joel de Guzman
+    Copyright (c) 2001-2009 Hartmut Kaiser
     http://spirit.sourceforge.net/
 
     Distributed under the Boost Software License, Version 1.0. (See accompanying
Modified: trunk/boost/spirit/include/support_argument.hpp
==============================================================================
--- trunk/boost/spirit/include/support_argument.hpp	(original)
+++ trunk/boost/spirit/include/support_argument.hpp	2009-04-26 10:42:24 EDT (Sun, 26 Apr 2009)
@@ -1,6 +1,6 @@
 /*=============================================================================
-    Copyright (c) 2001-2008 Joel de Guzman
-    Copyright (c) 2001-2008 Hartmut Kaiser
+    Copyright (c) 2001-2009 Joel de Guzman
+    Copyright (c) 2001-2009 Hartmut Kaiser
     http://spirit.sourceforge.net/
 
     Distributed under the Boost Software License, Version 1.0. (See accompanying
Deleted: trunk/boost/spirit/include/support_as_variant.hpp
==============================================================================
--- trunk/boost/spirit/include/support_as_variant.hpp	2009-04-26 10:42:24 EDT (Sun, 26 Apr 2009)
+++ (empty file)
@@ -1,12 +0,0 @@
-/*=============================================================================
-    Copyright (c) 2001-2008 Joel de Guzman
-    Copyright (c) 2001-2008 Hartmut Kaiser
-    http://spirit.sourceforge.net/
-
-    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)
-=============================================================================*/
-#ifndef BOOST_SPIRIT_INCLUDE_SUPPORT_AS_VARIANT
-#define BOOST_SPIRIT_INCLUDE_SUPPORT_AS_VARIANT
-#include <boost/spirit/home/support/as_variant.hpp>
-#endif
Modified: trunk/boost/spirit/include/support_ascii.hpp
==============================================================================
--- trunk/boost/spirit/include/support_ascii.hpp	(original)
+++ trunk/boost/spirit/include/support_ascii.hpp	2009-04-26 10:42:24 EDT (Sun, 26 Apr 2009)
@@ -1,6 +1,6 @@
 /*=============================================================================
-    Copyright (c) 2001-2008 Joel de Guzman
-    Copyright (c) 2001-2008 Hartmut Kaiser
+    Copyright (c) 2001-2009 Joel de Guzman
+    Copyright (c) 2001-2009 Hartmut Kaiser
     http://spirit.sourceforge.net/
 
     Distributed under the Boost Software License, Version 1.0. (See accompanying
@@ -8,5 +8,5 @@
 =============================================================================*/
 #ifndef BOOST_SPIRIT_INCLUDE_SUPPORT_ASCII
 #define BOOST_SPIRIT_INCLUDE_SUPPORT_ASCII
-#include <boost/spirit/home/support/ascii.hpp>
+#include <boost/spirit/home/support/char_encoding/ascii.hpp>
 #endif
Deleted: trunk/boost/spirit/include/support_attribute_of.hpp
==============================================================================
--- trunk/boost/spirit/include/support_attribute_of.hpp	2009-04-26 10:42:24 EDT (Sun, 26 Apr 2009)
+++ (empty file)
@@ -1,12 +0,0 @@
-/*=============================================================================
-    Copyright (c) 2001-2008 Joel de Guzman
-    Copyright (c) 2001-2008 Hartmut Kaiser
-    http://spirit.sourceforge.net/
-
-    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)
-=============================================================================*/
-#ifndef BOOST_SPIRIT_INCLUDE_SUPPORT_ATTRIBUTE_OF
-#define BOOST_SPIRIT_INCLUDE_SUPPORT_ATTRIBUTE_OF
-#include <boost/spirit/home/support/attribute_of.hpp>
-#endif
Deleted: trunk/boost/spirit/include/support_attribute_transform.hpp
==============================================================================
--- trunk/boost/spirit/include/support_attribute_transform.hpp	2009-04-26 10:42:24 EDT (Sun, 26 Apr 2009)
+++ (empty file)
@@ -1,12 +0,0 @@
-/*=============================================================================
-    Copyright (c) 2001-2008 Joel de Guzman
-    Copyright (c) 2001-2008 Hartmut Kaiser
-    http://spirit.sourceforge.net/
-
-    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)
-=============================================================================*/
-#ifndef BOOST_SPIRIT_INCLUDE_SUPPORT_ATTRIBUTE_TRANSFORM
-#define BOOST_SPIRIT_INCLUDE_SUPPORT_ATTRIBUTE_TRANSFORM
-#include <boost/spirit/home/support/attribute_transform.hpp>
-#endif
Deleted: trunk/boost/spirit/include/support_basic_rules.hpp
==============================================================================
--- trunk/boost/spirit/include/support_basic_rules.hpp	2009-04-26 10:42:24 EDT (Sun, 26 Apr 2009)
+++ (empty file)
@@ -1,12 +0,0 @@
-/*=============================================================================
-    Copyright (c) 2001-2008 Joel de Guzman
-    Copyright (c) 2001-2008 Hartmut Kaiser
-    http://spirit.sourceforge.net/
-
-    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)
-=============================================================================*/
-#ifndef BOOST_SPIRIT_INCLUDE_SUPPORT_BASIC_RULES
-#define BOOST_SPIRIT_INCLUDE_SUPPORT_BASIC_RULES
-#include <boost/spirit/home/support/meta_grammar/basic_rules.hpp>
-#endif
Deleted: trunk/boost/spirit/include/support_basic_transforms.hpp
==============================================================================
--- trunk/boost/spirit/include/support_basic_transforms.hpp	2009-04-26 10:42:24 EDT (Sun, 26 Apr 2009)
+++ (empty file)
@@ -1,12 +0,0 @@
-/*=============================================================================
-    Copyright (c) 2001-2008 Joel de Guzman
-    Copyright (c) 2001-2008 Hartmut Kaiser
-    http://spirit.sourceforge.net/
-
-    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)
-=============================================================================*/
-#ifndef BOOST_SPIRIT_INCLUDE_SUPPORT_BASIC_TRANSFORMS
-#define BOOST_SPIRIT_INCLUDE_SUPPORT_BASIC_TRANSFORMS
-#include <boost/spirit/home/support/meta_grammar/basic_transforms.hpp>
-#endif
Modified: trunk/boost/spirit/include/support_char_class.hpp
==============================================================================
--- trunk/boost/spirit/include/support_char_class.hpp	(original)
+++ trunk/boost/spirit/include/support_char_class.hpp	2009-04-26 10:42:24 EDT (Sun, 26 Apr 2009)
@@ -1,6 +1,6 @@
 /*=============================================================================
-    Copyright (c) 2001-2008 Joel de Guzman
-    Copyright (c) 2001-2008 Hartmut Kaiser
+    Copyright (c) 2001-2009 Joel de Guzman
+    Copyright (c) 2001-2009 Hartmut Kaiser
     http://spirit.sourceforge.net/
 
     Distributed under the Boost Software License, Version 1.0. (See accompanying
Deleted: trunk/boost/spirit/include/support_component.hpp
==============================================================================
--- trunk/boost/spirit/include/support_component.hpp	2009-04-26 10:42:24 EDT (Sun, 26 Apr 2009)
+++ (empty file)
@@ -1,12 +0,0 @@
-/*=============================================================================
-    Copyright (c) 2001-2008 Joel de Guzman
-    Copyright (c) 2001-2008 Hartmut Kaiser
-    http://spirit.sourceforge.net/
-
-    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)
-=============================================================================*/
-#ifndef BOOST_SPIRIT_INCLUDE_SUPPORT_COMPONENT
-#define BOOST_SPIRIT_INCLUDE_SUPPORT_COMPONENT
-#include <boost/spirit/home/support/component.hpp>
-#endif
Deleted: trunk/boost/spirit/include/support_functor_holder.hpp
==============================================================================
--- trunk/boost/spirit/include/support_functor_holder.hpp	2009-04-26 10:42:24 EDT (Sun, 26 Apr 2009)
+++ (empty file)
@@ -1,12 +0,0 @@
-/*=============================================================================
-    Copyright (c) 2001-2008 Joel de Guzman
-    Copyright (c) 2001-2008 Hartmut Kaiser
-    http://spirit.sourceforge.net/
-
-    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)
-=============================================================================*/
-#ifndef BOOST_SPIRIT_INCLUDE_SUPPORT_FUNCTOR_HOLDER
-#define BOOST_SPIRIT_INCLUDE_SUPPORT_FUNCTOR_HOLDER
-#include <boost/spirit/home/support/auxiliary/functor_holder.hpp>
-#endif
Deleted: trunk/boost/spirit/include/support_grammar.hpp
==============================================================================
--- trunk/boost/spirit/include/support_grammar.hpp	2009-04-26 10:42:24 EDT (Sun, 26 Apr 2009)
+++ (empty file)
@@ -1,12 +0,0 @@
-/*=============================================================================
-    Copyright (c) 2001-2008 Joel de Guzman
-    Copyright (c) 2001-2008 Hartmut Kaiser
-    http://spirit.sourceforge.net/
-
-    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)
-=============================================================================*/
-#ifndef BOOST_SPIRIT_INCLUDE_SUPPORT_GRAMMAR
-#define BOOST_SPIRIT_INCLUDE_SUPPORT_GRAMMAR
-#include <boost/spirit/home/support/meta_grammar/grammar.hpp>
-#endif
Modified: trunk/boost/spirit/include/support_iso8859_1.hpp
==============================================================================
--- trunk/boost/spirit/include/support_iso8859_1.hpp	(original)
+++ trunk/boost/spirit/include/support_iso8859_1.hpp	2009-04-26 10:42:24 EDT (Sun, 26 Apr 2009)
@@ -1,6 +1,6 @@
 /*=============================================================================
-    Copyright (c) 2001-2008 Joel de Guzman
-    Copyright (c) 2001-2008 Hartmut Kaiser
+    Copyright (c) 2001-2009 Joel de Guzman
+    Copyright (c) 2001-2009 Hartmut Kaiser
     http://spirit.sourceforge.net/
 
     Distributed under the Boost Software License, Version 1.0. (See accompanying
@@ -8,5 +8,5 @@
 =============================================================================*/
 #ifndef BOOST_SPIRIT_INCLUDE_SUPPORT_ISO8859_1
 #define BOOST_SPIRIT_INCLUDE_SUPPORT_ISO8859_1
-#include <boost/spirit/home/support/iso8859_1.hpp>
+#include <boost/spirit/home/support/char_encoding/iso8859_1.hpp>
 #endif
Modified: trunk/boost/spirit/include/support_locals.hpp
==============================================================================
--- trunk/boost/spirit/include/support_locals.hpp	(original)
+++ trunk/boost/spirit/include/support_locals.hpp	2009-04-26 10:42:24 EDT (Sun, 26 Apr 2009)
@@ -1,6 +1,6 @@
 /*=============================================================================
-    Copyright (c) 2001-2008 Joel de Guzman
-    Copyright (c) 2001-2008 Hartmut Kaiser
+    Copyright (c) 2001-2009 Joel de Guzman
+    Copyright (c) 2001-2009 Hartmut Kaiser
     http://spirit.sourceforge.net/
 
     Distributed under the Boost Software License, Version 1.0. (See accompanying
Modified: trunk/boost/spirit/include/support_look_ahead.hpp
==============================================================================
--- trunk/boost/spirit/include/support_look_ahead.hpp	(original)
+++ trunk/boost/spirit/include/support_look_ahead.hpp	2009-04-26 10:42:24 EDT (Sun, 26 Apr 2009)
@@ -1,6 +1,6 @@
 /*=============================================================================
-    Copyright (c) 2001-2008 Joel de Guzman
-    Copyright (c) 2001-2008 Hartmut Kaiser
+    Copyright (c) 2001-2009 Joel de Guzman
+    Copyright (c) 2001-2009 Hartmut Kaiser
     http://spirit.sourceforge.net/
 
     Distributed under the Boost Software License, Version 1.0. (See accompanying
Deleted: trunk/boost/spirit/include/support_meta_function_holder.hpp
==============================================================================
--- trunk/boost/spirit/include/support_meta_function_holder.hpp	2009-04-26 10:42:24 EDT (Sun, 26 Apr 2009)
+++ (empty file)
@@ -1,12 +0,0 @@
-/*=============================================================================
-    Copyright (c) 2001-2008 Joel de Guzman
-    Copyright (c) 2001-2008 Hartmut Kaiser
-    http://spirit.sourceforge.net/
-
-    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)
-=============================================================================*/
-#ifndef BOOST_SPIRIT_INCLUDE_SUPPORT_META_FUNCTION_HOLDER
-#define BOOST_SPIRIT_INCLUDE_SUPPORT_META_FUNCTION_HOLDER
-#include <boost/spirit/home/support/auxiliary/meta_function_holder.hpp>
-#endif
Deleted: trunk/boost/spirit/include/support_meta_grammar.hpp
==============================================================================
--- trunk/boost/spirit/include/support_meta_grammar.hpp	2009-04-26 10:42:24 EDT (Sun, 26 Apr 2009)
+++ (empty file)
@@ -1,12 +0,0 @@
-/*=============================================================================
-    Copyright (c) 2001-2008 Joel de Guzman
-    Copyright (c) 2001-2008 Hartmut Kaiser
-    http://spirit.sourceforge.net/
-
-    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)
-=============================================================================*/
-#ifndef BOOST_SPIRIT_INCLUDE_SUPPORT_META_GRAMMAR
-#define BOOST_SPIRIT_INCLUDE_SUPPORT_META_GRAMMAR
-#include <boost/spirit/home/support/meta_grammar.hpp>
-#endif
Deleted: trunk/boost/spirit/include/support_modifier.hpp
==============================================================================
--- trunk/boost/spirit/include/support_modifier.hpp	2009-04-26 10:42:24 EDT (Sun, 26 Apr 2009)
+++ (empty file)
@@ -1,12 +0,0 @@
-/*=============================================================================
-    Copyright (c) 2001-2008 Joel de Guzman
-    Copyright (c) 2001-2008 Hartmut Kaiser
-    http://spirit.sourceforge.net/
-
-    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)
-=============================================================================*/
-#ifndef BOOST_SPIRIT_INCLUDE_SUPPORT_MODIFIER
-#define BOOST_SPIRIT_INCLUDE_SUPPORT_MODIFIER
-#include <boost/spirit/home/support/modifier.hpp>
-#endif
Modified: trunk/boost/spirit/include/support_multi_pass.hpp
==============================================================================
--- trunk/boost/spirit/include/support_multi_pass.hpp	(original)
+++ trunk/boost/spirit/include/support_multi_pass.hpp	2009-04-26 10:42:24 EDT (Sun, 26 Apr 2009)
@@ -1,6 +1,6 @@
 /*=============================================================================
-    Copyright (c) 2001-2008 Joel de Guzman
-    Copyright (c) 2001-2008 Hartmut Kaiser
+    Copyright (c) 2001-2009 Joel de Guzman
+    Copyright (c) 2001-2009 Hartmut Kaiser
     http://spirit.sourceforge.net/
 
     Distributed under the Boost Software License, Version 1.0. (See accompanying
Modified: trunk/boost/spirit/include/support_multi_pass_fwd.hpp
==============================================================================
--- trunk/boost/spirit/include/support_multi_pass_fwd.hpp	(original)
+++ trunk/boost/spirit/include/support_multi_pass_fwd.hpp	2009-04-26 10:42:24 EDT (Sun, 26 Apr 2009)
@@ -1,6 +1,6 @@
 /*=============================================================================
-    Copyright (c) 2001-2008 Joel de Guzman
-    Copyright (c) 2001-2008 Hartmut Kaiser
+    Copyright (c) 2001-2009 Joel de Guzman
+    Copyright (c) 2001-2009 Hartmut Kaiser
     http://spirit.sourceforge.net/
 
     Distributed under the Boost Software License, Version 1.0. (See accompanying
Deleted: trunk/boost/spirit/include/support_nonterminal.hpp
==============================================================================
--- trunk/boost/spirit/include/support_nonterminal.hpp	2009-04-26 10:42:24 EDT (Sun, 26 Apr 2009)
+++ (empty file)
@@ -1,12 +0,0 @@
-/*=============================================================================
-    Copyright (c) 2001-2008 Joel de Guzman
-    Copyright (c) 2001-2008 Hartmut Kaiser
-    http://spirit.sourceforge.net/
-
-    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)
-=============================================================================*/
-#ifndef BOOST_SPIRIT_INCLUDE_SUPPORT_NONTERMINAL
-#define BOOST_SPIRIT_INCLUDE_SUPPORT_NONTERMINAL
-#include <boost/spirit/home/support/nonterminal/nonterminal.hpp>
-#endif
Deleted: trunk/boost/spirit/include/support_placeholders.hpp
==============================================================================
--- trunk/boost/spirit/include/support_placeholders.hpp	2009-04-26 10:42:24 EDT (Sun, 26 Apr 2009)
+++ (empty file)
@@ -1,12 +0,0 @@
-/*=============================================================================
-    Copyright (c) 2001-2008 Joel de Guzman
-    Copyright (c) 2001-2008 Hartmut Kaiser
-    http://spirit.sourceforge.net/
-
-    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)
-=============================================================================*/
-#ifndef BOOST_SPIRIT_INCLUDE_SUPPORT_PLACEHOLDERS
-#define BOOST_SPIRIT_INCLUDE_SUPPORT_PLACEHOLDERS
-#include <boost/spirit/home/support/placeholders.hpp>
-#endif
Modified: trunk/boost/spirit/include/support_safe_bool.hpp
==============================================================================
--- trunk/boost/spirit/include/support_safe_bool.hpp	(original)
+++ trunk/boost/spirit/include/support_safe_bool.hpp	2009-04-26 10:42:24 EDT (Sun, 26 Apr 2009)
@@ -1,6 +1,6 @@
 /*=============================================================================
-    Copyright (c) 2001-2008 Joel de Guzman
-    Copyright (c) 2001-2008 Hartmut Kaiser
+    Copyright (c) 2001-2009 Joel de Guzman
+    Copyright (c) 2001-2009 Hartmut Kaiser
     http://spirit.sourceforge.net/
 
     Distributed under the Boost Software License, Version 1.0. (See accompanying
Modified: trunk/boost/spirit/include/support_standard.hpp
==============================================================================
--- trunk/boost/spirit/include/support_standard.hpp	(original)
+++ trunk/boost/spirit/include/support_standard.hpp	2009-04-26 10:42:24 EDT (Sun, 26 Apr 2009)
@@ -1,6 +1,6 @@
 /*=============================================================================
-    Copyright (c) 2001-2008 Joel de Guzman
-    Copyright (c) 2001-2008 Hartmut Kaiser
+    Copyright (c) 2001-2009 Joel de Guzman
+    Copyright (c) 2001-2009 Hartmut Kaiser
     http://spirit.sourceforge.net/
 
     Distributed under the Boost Software License, Version 1.0. (See accompanying
@@ -8,5 +8,5 @@
 =============================================================================*/
 #ifndef BOOST_SPIRIT_INCLUDE_SUPPORT_STANDARD
 #define BOOST_SPIRIT_INCLUDE_SUPPORT_STANDARD
-#include <boost/spirit/home/support/standard.hpp>
+#include <boost/spirit/home/support/char_encoding/standard.hpp>
 #endif
Modified: trunk/boost/spirit/include/support_standard_wide.hpp
==============================================================================
--- trunk/boost/spirit/include/support_standard_wide.hpp	(original)
+++ trunk/boost/spirit/include/support_standard_wide.hpp	2009-04-26 10:42:24 EDT (Sun, 26 Apr 2009)
@@ -1,6 +1,6 @@
 /*=============================================================================
-    Copyright (c) 2001-2008 Joel de Guzman
-    Copyright (c) 2001-2008 Hartmut Kaiser
+    Copyright (c) 2001-2009 Joel de Guzman
+    Copyright (c) 2001-2009 Hartmut Kaiser
     http://spirit.sourceforge.net/
 
     Distributed under the Boost Software License, Version 1.0. (See accompanying
@@ -8,5 +8,5 @@
 =============================================================================*/
 #ifndef BOOST_SPIRIT_INCLUDE_SUPPORT_STANDARD_WIDE
 #define BOOST_SPIRIT_INCLUDE_SUPPORT_STANDARD_WIDE
-#include <boost/spirit/home/support/standard_wide.hpp>
+#include <boost/spirit/home/support/char_encoding/standard_wide.hpp>
 #endif
Modified: trunk/boost/spirit/include/support_unused.hpp
==============================================================================
--- trunk/boost/spirit/include/support_unused.hpp	(original)
+++ trunk/boost/spirit/include/support_unused.hpp	2009-04-26 10:42:24 EDT (Sun, 26 Apr 2009)
@@ -1,6 +1,6 @@
 /*=============================================================================
-    Copyright (c) 2001-2008 Joel de Guzman
-    Copyright (c) 2001-2008 Hartmut Kaiser
+    Copyright (c) 2001-2009 Joel de Guzman
+    Copyright (c) 2001-2009 Hartmut Kaiser
     http://spirit.sourceforge.net/
 
     Distributed under the Boost Software License, Version 1.0. (See accompanying
Modified: trunk/boost/spirit/version.hpp
==============================================================================
--- trunk/boost/spirit/version.hpp	(original)
+++ trunk/boost/spirit/version.hpp	2009-04-26 10:42:24 EDT (Sun, 26 Apr 2009)
@@ -1,6 +1,6 @@
 /*=============================================================================
-  Copyright (c) 2001-2008 Joel de Guzman
-  Copyright (c) 2001-2008 Hartmut Kaiser
+  Copyright (c) 2001-2009 Joel de Guzman
+  Copyright (c) 2001-2009 Hartmut Kaiser
   http://spirit.sourceforge.net/
 
   Distributed under the Boost Software License, Version 1.0. (See accompanying
@@ -14,7 +14,7 @@
 //  This is the version of the current Spirit distribution
 //
 ///////////////////////////////////////////////////////////////////////////////
-#define SPIRIT_VERSION 0x2000
-#define SPIRIT_PIZZA_VERSION EVERYTHING_BUT_ANCHOVIES  // :-)
+#define SPIRIT_VERSION 0x2010
+#define SPIRIT_PIZZA_VERSION COSMIC_KARMA  // :-)
 
 #endif