Boost logo

Boost-Commit :

Subject: [Boost-commit] svn:boost r56189 - in branches/release/boost/spirit: . home home/classic home/classic/actor home/classic/core/composite home/classic/core/non_terminal/impl home/classic/core/primitives/impl home/classic/meta home/classic/phoenix home/classic/utility home/karma home/karma/action home/karma/auxiliary home/karma/binary home/karma/char home/karma/detail home/karma/directive home/karma/directive/detail home/karma/nonterminal home/karma/nonterminal/detail home/karma/numeric home/karma/numeric/detail home/karma/operator home/karma/operator/detail home/karma/operator/karma-alt home/karma/stream home/karma/stream/detail home/karma/string home/lex home/lex/detail home/lex/lexer home/lex/lexer/detail home/lex/lexer/lexertl home/lex/qi home/lex/qi/state home/lex/qi/utility home/phoenix/core home/phoenix/operator home/phoenix/operator/detail home/phoenix/scope home/phoenix/statement home/phoenix/statement/detail home/phoenix/stl/algorithm/detail home/phoenix/stl/container 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/char_set home/support/detail home/support/detail/integer home/support/detail/lexer home/support/detail/lexer/containers home/support/detail/lexer/conversion home/support/detail/lexer/parser home/support/detail/lexer/parser/tokeniser home/support/detail/lexer/parser/tree home/support/detail/lexer/partition home/support/detail/math home/support/detail/math/detail home/support/iterators home/support/iterators/detail home/support/meta_grammar home/support/nonterminal home/support/nonterminal/detail include repository repository/home repository/home/karma repository/home/karma/directive repository/home/karma/nonterminal repository/home/qi repository/home/qi/directive repository/home/qi/nonterminal repository/home/qi/primitive repository/home/support repository/include
From: hartmut.kaiser_at_[hidden]
Date: 2009-09-14 12:51:03


Author: hkaiser
Date: 2009-09-14 12:50:29 EDT (Mon, 14 Sep 2009)
New Revision: 56189
URL: http://svn.boost.org/trac/boost/changeset/56189

Log:
Spirit: merging V2.1 from trunk
Added:
   branches/release/boost/spirit/home/karma/char/char_class.hpp
      - copied unchanged from r56182, /trunk/boost/spirit/home/karma/char/char_class.hpp
   branches/release/boost/spirit/home/karma/char/char_generator.hpp
      - copied unchanged from r56182, /trunk/boost/spirit/home/karma/char/char_generator.hpp
   branches/release/boost/spirit/home/karma/delimit_out.hpp
      - copied unchanged from r56182, /trunk/boost/spirit/home/karma/delimit_out.hpp
   branches/release/boost/spirit/home/karma/detail/alternative_function.hpp
      - copied unchanged from r56182, /trunk/boost/spirit/home/karma/detail/alternative_function.hpp
   branches/release/boost/spirit/home/karma/detail/default_width.hpp
      - copied unchanged from r56182, /trunk/boost/spirit/home/karma/detail/default_width.hpp
   branches/release/boost/spirit/home/karma/detail/fail_function.hpp
      - copied unchanged from r56182, /trunk/boost/spirit/home/karma/detail/fail_function.hpp
   branches/release/boost/spirit/home/karma/detail/get_casetag.hpp
      - copied unchanged from r56182, /trunk/boost/spirit/home/karma/detail/get_casetag.hpp
   branches/release/boost/spirit/home/karma/detail/pass_container.hpp
      - copied unchanged from r56182, /trunk/boost/spirit/home/karma/detail/pass_container.hpp
   branches/release/boost/spirit/home/karma/detail/string_compare.hpp
      - copied unchanged from r56182, /trunk/boost/spirit/home/karma/detail/string_compare.hpp
   branches/release/boost/spirit/home/karma/detail/unused_delimiter.hpp
      - copied unchanged from r56182, /trunk/boost/spirit/home/karma/detail/unused_delimiter.hpp
   branches/release/boost/spirit/home/karma/directive/buffer.hpp
      - copied unchanged from r56182, /trunk/boost/spirit/home/karma/directive/buffer.hpp
   branches/release/boost/spirit/home/karma/directive/maxwidth.hpp
      - copied unchanged from r56182, /trunk/boost/spirit/home/karma/directive/maxwidth.hpp
   branches/release/boost/spirit/home/karma/directive/omit.hpp
      - copied unchanged from r56182, /trunk/boost/spirit/home/karma/directive/omit.hpp
   branches/release/boost/spirit/home/karma/directive/repeat.hpp
      - copied unchanged from r56182, /trunk/boost/spirit/home/karma/directive/repeat.hpp
   branches/release/boost/spirit/home/karma/directive/upper_lower_case.hpp
      - copied unchanged from r56182, /trunk/boost/spirit/home/karma/directive/upper_lower_case.hpp
   branches/release/boost/spirit/home/karma/generate_attr.hpp
      - copied unchanged from r56182, /trunk/boost/spirit/home/karma/generate_attr.hpp
   branches/release/boost/spirit/home/karma/generator.hpp
      - copied unchanged from r56182, /trunk/boost/spirit/home/karma/generator.hpp
   branches/release/boost/spirit/home/karma/meta_compiler.hpp
      - copied unchanged from r56182, /trunk/boost/spirit/home/karma/meta_compiler.hpp
   branches/release/boost/spirit/home/karma/nonterminal/detail/fcall.hpp
      - copied unchanged from r56182, /trunk/boost/spirit/home/karma/nonterminal/detail/fcall.hpp
   branches/release/boost/spirit/home/karma/nonterminal/detail/generator_binder.hpp
      - copied unchanged from r56182, /trunk/boost/spirit/home/karma/nonterminal/detail/generator_binder.hpp
   branches/release/boost/spirit/home/karma/nonterminal/detail/parameterized.hpp
      - copied unchanged from r56182, /trunk/boost/spirit/home/karma/nonterminal/detail/parameterized.hpp
   branches/release/boost/spirit/home/karma/numeric/detail/real_utils.hpp
      - copied unchanged from r56182, /trunk/boost/spirit/home/karma/numeric/detail/real_utils.hpp
   branches/release/boost/spirit/home/karma/operator/and_predicate.hpp
      - copied unchanged from r56182, /trunk/boost/spirit/home/karma/operator/and_predicate.hpp
   branches/release/boost/spirit/home/karma/operator/not_predicate.hpp
      - copied unchanged from r56182, /trunk/boost/spirit/home/karma/operator/not_predicate.hpp
   branches/release/boost/spirit/home/karma/reference.hpp
      - copied unchanged from r56182, /trunk/boost/spirit/home/karma/reference.hpp
   branches/release/boost/spirit/home/karma/stream/detail/iterator_sink.hpp
      - copied unchanged from r56182, /trunk/boost/spirit/home/karma/stream/detail/iterator_sink.hpp
   branches/release/boost/spirit/home/karma/stream/format_manip_attr.hpp
      - copied unchanged from r56182, /trunk/boost/spirit/home/karma/stream/format_manip_attr.hpp
   branches/release/boost/spirit/home/karma/stream/ostream_iterator.hpp
      - copied unchanged from r56182, /trunk/boost/spirit/home/karma/stream/ostream_iterator.hpp
   branches/release/boost/spirit/home/lex/argument.hpp
      - copied unchanged from r56182, /trunk/boost/spirit/home/lex/argument.hpp
   branches/release/boost/spirit/home/lex/detail/
      - copied from r56182, /trunk/boost/spirit/home/lex/detail/
   branches/release/boost/spirit/home/lex/detail/sequence_function.hpp
      - copied unchanged from r56182, /trunk/boost/spirit/home/lex/detail/sequence_function.hpp
   branches/release/boost/spirit/home/lex/lexer/lexertl/functor.hpp
      - copied unchanged from r56182, /trunk/boost/spirit/home/lex/lexer/lexertl/functor.hpp
   branches/release/boost/spirit/home/lex/lexer/lexertl/functor_data.hpp
      - copied unchanged from r56182, /trunk/boost/spirit/home/lex/lexer/lexertl/functor_data.hpp
   branches/release/boost/spirit/home/lex/lexer/lexertl/generate_static.hpp
      - copied unchanged from r56182, /trunk/boost/spirit/home/lex/lexer/lexertl/generate_static.hpp
   branches/release/boost/spirit/home/lex/lexer/lexertl/iterator.hpp
      - copied unchanged from r56182, /trunk/boost/spirit/home/lex/lexer/lexertl/iterator.hpp
   branches/release/boost/spirit/home/lex/lexer/lexertl/lexer.hpp
      - copied unchanged from r56182, /trunk/boost/spirit/home/lex/lexer/lexertl/lexer.hpp
   branches/release/boost/spirit/home/lex/lexer/lexertl/semantic_action_data.hpp
      - copied unchanged from r56182, /trunk/boost/spirit/home/lex/lexer/lexertl/semantic_action_data.hpp
   branches/release/boost/spirit/home/lex/lexer/lexertl/static_functor_data.hpp
      - copied unchanged from r56182, /trunk/boost/spirit/home/lex/lexer/lexertl/static_functor_data.hpp
   branches/release/boost/spirit/home/lex/lexer/lexertl/static_lexer.hpp
      - copied unchanged from r56182, /trunk/boost/spirit/home/lex/lexer/lexertl/static_lexer.hpp
   branches/release/boost/spirit/home/lex/lexer/lexertl/static_version.hpp
      - copied unchanged from r56182, /trunk/boost/spirit/home/lex/lexer/lexertl/static_version.hpp
   branches/release/boost/spirit/home/lex/lexer/lexertl/token.hpp
      - copied unchanged from r56182, /trunk/boost/spirit/home/lex/lexer/lexertl/token.hpp
   branches/release/boost/spirit/home/lex/lexer/pass_flags.hpp
      - copied unchanged from r56182, /trunk/boost/spirit/home/lex/lexer/pass_flags.hpp
   branches/release/boost/spirit/home/lex/lexer/support_functions.hpp
      - copied unchanged from r56182, /trunk/boost/spirit/home/lex/lexer/support_functions.hpp
   branches/release/boost/spirit/home/lex/lexer/terminals.hpp
      - copied unchanged from r56182, /trunk/boost/spirit/home/lex/lexer/terminals.hpp
   branches/release/boost/spirit/home/lex/lexer_type.hpp
      - copied unchanged from r56182, /trunk/boost/spirit/home/lex/lexer_type.hpp
   branches/release/boost/spirit/home/lex/meta_compiler.hpp
      - copied unchanged from r56182, /trunk/boost/spirit/home/lex/meta_compiler.hpp
   branches/release/boost/spirit/home/lex/primitives.hpp
      - copied unchanged from r56182, /trunk/boost/spirit/home/lex/primitives.hpp
   branches/release/boost/spirit/home/lex/qi.hpp
      - copied unchanged from r56182, /trunk/boost/spirit/home/lex/qi.hpp
   branches/release/boost/spirit/home/lex/qi/in_state.hpp
      - copied unchanged from r56182, /trunk/boost/spirit/home/lex/qi/in_state.hpp
   branches/release/boost/spirit/home/lex/qi/plain_token.hpp
      - copied unchanged from r56182, /trunk/boost/spirit/home/lex/qi/plain_token.hpp
   branches/release/boost/spirit/home/lex/qi/state_switcher.hpp
      - copied unchanged from r56182, /trunk/boost/spirit/home/lex/qi/state_switcher.hpp
   branches/release/boost/spirit/home/lex/reference.hpp
      - copied unchanged from r56182, /trunk/boost/spirit/home/lex/reference.hpp
   branches/release/boost/spirit/home/lex/tokenize_and_parse_attr.hpp
      - copied unchanged from r56182, /trunk/boost/spirit/home/lex/tokenize_and_parse_attr.hpp
   branches/release/boost/spirit/home/qi/auxiliary/attr.hpp
      - copied unchanged from r56182, /trunk/boost/spirit/home/qi/auxiliary/attr.hpp
   branches/release/boost/spirit/home/qi/auxiliary/eoi.hpp
      - copied unchanged from r56182, /trunk/boost/spirit/home/qi/auxiliary/eoi.hpp
   branches/release/boost/spirit/home/qi/auxiliary/eol.hpp
      - copied unchanged from r56182, /trunk/boost/spirit/home/qi/auxiliary/eol.hpp
   branches/release/boost/spirit/home/qi/detail/pass_container.hpp
      - copied unchanged from r56182, /trunk/boost/spirit/home/qi/detail/pass_container.hpp
   branches/release/boost/spirit/home/qi/detail/unused_skipper.hpp
      - copied unchanged from r56182, /trunk/boost/spirit/home/qi/detail/unused_skipper.hpp
   branches/release/boost/spirit/home/qi/directive/no_case.hpp
      - copied unchanged from r56182, /trunk/boost/spirit/home/qi/directive/no_case.hpp
   branches/release/boost/spirit/home/qi/directive/repeat.hpp
      - copied unchanged from r56182, /trunk/boost/spirit/home/qi/directive/repeat.hpp
   branches/release/boost/spirit/home/qi/directive/skip.hpp
      - copied unchanged from r56182, /trunk/boost/spirit/home/qi/directive/skip.hpp
   branches/release/boost/spirit/home/qi/meta_compiler.hpp
      - copied unchanged from r56182, /trunk/boost/spirit/home/qi/meta_compiler.hpp
   branches/release/boost/spirit/home/qi/nonterminal/debug_handler.hpp
      - copied unchanged from r56182, /trunk/boost/spirit/home/qi/nonterminal/debug_handler.hpp
   branches/release/boost/spirit/home/qi/nonterminal/detail/fcall.hpp
      - copied unchanged from r56182, /trunk/boost/spirit/home/qi/nonterminal/detail/fcall.hpp
   branches/release/boost/spirit/home/qi/nonterminal/detail/parameterized.hpp
      - copied unchanged from r56182, /trunk/boost/spirit/home/qi/nonterminal/detail/parameterized.hpp
   branches/release/boost/spirit/home/qi/nonterminal/detail/parser_binder.hpp
      - copied unchanged from r56182, /trunk/boost/spirit/home/qi/nonterminal/detail/parser_binder.hpp
   branches/release/boost/spirit/home/qi/nonterminal/error_handler.hpp
      - copied unchanged from r56182, /trunk/boost/spirit/home/qi/nonterminal/error_handler.hpp
   branches/release/boost/spirit/home/qi/nonterminal/simple_trace.hpp
      - copied unchanged from r56182, /trunk/boost/spirit/home/qi/nonterminal/simple_trace.hpp
   branches/release/boost/spirit/home/qi/parse_attr.hpp
      - copied unchanged from r56182, /trunk/boost/spirit/home/qi/parse_attr.hpp
   branches/release/boost/spirit/home/qi/parser.hpp
      - copied unchanged from r56182, /trunk/boost/spirit/home/qi/parser.hpp
   branches/release/boost/spirit/home/qi/reference.hpp
      - copied unchanged from r56182, /trunk/boost/spirit/home/qi/reference.hpp
   branches/release/boost/spirit/home/qi/skip_over.hpp
      - copied unchanged from r56182, /trunk/boost/spirit/home/qi/skip_over.hpp
   branches/release/boost/spirit/home/qi/stream/detail/iterator_source.hpp
      - copied unchanged from r56182, /trunk/boost/spirit/home/qi/stream/detail/iterator_source.hpp
   branches/release/boost/spirit/home/qi/stream/match_manip_attr.hpp
      - copied unchanged from r56182, /trunk/boost/spirit/home/qi/stream/match_manip_attr.hpp
   branches/release/boost/spirit/home/qi/string/lit.hpp
      - copied unchanged from r56182, /trunk/boost/spirit/home/qi/string/lit.hpp
   branches/release/boost/spirit/home/qi/string/symbols.hpp
      - copied unchanged from r56182, /trunk/boost/spirit/home/qi/string/symbols.hpp
   branches/release/boost/spirit/home/qi/string/tst.hpp
      - copied unchanged from r56182, /trunk/boost/spirit/home/qi/string/tst.hpp
   branches/release/boost/spirit/home/qi/string/tst_map.hpp
      - copied unchanged from r56182, /trunk/boost/spirit/home/qi/string/tst_map.hpp
   branches/release/boost/spirit/home/support/action_dispatch.hpp
      - copied unchanged from r56182, /trunk/boost/spirit/home/support/action_dispatch.hpp
   branches/release/boost/spirit/home/support/algorithm/any_if_ns.hpp
      - copied unchanged from r56182, /trunk/boost/spirit/home/support/algorithm/any_if_ns.hpp
   branches/release/boost/spirit/home/support/assert_msg.hpp
      - copied unchanged from r56182, /trunk/boost/spirit/home/support/assert_msg.hpp
   branches/release/boost/spirit/home/support/attributes.hpp
      - copied unchanged from r56182, /trunk/boost/spirit/home/support/attributes.hpp
   branches/release/boost/spirit/home/support/char_encoding/
      - copied from r56182, /trunk/boost/spirit/home/support/char_encoding/
   branches/release/boost/spirit/home/support/char_encoding/ascii.hpp
      - copied unchanged from r56182, /trunk/boost/spirit/home/support/char_encoding/ascii.hpp
   branches/release/boost/spirit/home/support/char_encoding/iso8859_1.hpp
      - copied unchanged from r56182, /trunk/boost/spirit/home/support/char_encoding/iso8859_1.hpp
   branches/release/boost/spirit/home/support/char_encoding/standard.hpp
      - copied unchanged from r56182, /trunk/boost/spirit/home/support/char_encoding/standard.hpp
   branches/release/boost/spirit/home/support/char_encoding/standard_wide.hpp
      - copied unchanged from r56182, /trunk/boost/spirit/home/support/char_encoding/standard_wide.hpp
   branches/release/boost/spirit/home/support/char_set/
      - copied from r56182, /trunk/boost/spirit/home/support/char_set/
   branches/release/boost/spirit/home/support/char_set/basic_chset.hpp
      - copied unchanged from r56182, /trunk/boost/spirit/home/support/char_set/basic_chset.hpp
   branches/release/boost/spirit/home/support/char_set/range.hpp
      - copied unchanged from r56182, /trunk/boost/spirit/home/support/char_set/range.hpp
   branches/release/boost/spirit/home/support/char_set/range_functions.hpp
      - copied unchanged from r56182, /trunk/boost/spirit/home/support/char_set/range_functions.hpp
   branches/release/boost/spirit/home/support/char_set/range_run.hpp
      - copied unchanged from r56182, /trunk/boost/spirit/home/support/char_set/range_run.hpp
   branches/release/boost/spirit/home/support/char_set/range_run_impl.hpp
      - copied unchanged from r56182, /trunk/boost/spirit/home/support/char_set/range_run_impl.hpp
   branches/release/boost/spirit/home/support/common_terminals.hpp
      - copied unchanged from r56182, /trunk/boost/spirit/home/support/common_terminals.hpp
   branches/release/boost/spirit/home/support/container.hpp
      - copied unchanged from r56182, /trunk/boost/spirit/home/support/container.hpp
   branches/release/boost/spirit/home/support/context.hpp
      - copied unchanged from r56182, /trunk/boost/spirit/home/support/context.hpp
   branches/release/boost/spirit/home/support/detail/as_variant.hpp
      - copied unchanged from r56182, /trunk/boost/spirit/home/support/detail/as_variant.hpp
   branches/release/boost/spirit/home/support/detail/endian.hpp
      - copied unchanged from r56182, /trunk/boost/spirit/home/support/detail/endian.hpp
   branches/release/boost/spirit/home/support/detail/get_encoding.hpp
      - copied unchanged from r56182, /trunk/boost/spirit/home/support/detail/get_encoding.hpp
   branches/release/boost/spirit/home/support/detail/lexer/internals.hpp
      - copied unchanged from r56182, /trunk/boost/spirit/home/support/detail/lexer/internals.hpp
   branches/release/boost/spirit/home/support/detail/make_cons.hpp
      - copied unchanged from r56182, /trunk/boost/spirit/home/support/detail/make_cons.hpp
   branches/release/boost/spirit/home/support/detail/make_vector.hpp
      - copied unchanged from r56182, /trunk/boost/spirit/home/support/detail/make_vector.hpp
   branches/release/boost/spirit/home/support/detail/pow10.hpp
      - copied unchanged from r56182, /trunk/boost/spirit/home/support/detail/pow10.hpp
   branches/release/boost/spirit/home/support/detail/scoped_enum_emulation.hpp
      - copied unchanged from r56182, /trunk/boost/spirit/home/support/detail/scoped_enum_emulation.hpp
   branches/release/boost/spirit/home/support/detail/sign.hpp
      - copied unchanged from r56182, /trunk/boost/spirit/home/support/detail/sign.hpp
   branches/release/boost/spirit/home/support/info.hpp
      - copied unchanged from r56182, /trunk/boost/spirit/home/support/info.hpp
   branches/release/boost/spirit/home/support/lazy.hpp
      - copied unchanged from r56182, /trunk/boost/spirit/home/support/lazy.hpp
   branches/release/boost/spirit/home/support/make_component.hpp
      - copied unchanged from r56182, /trunk/boost/spirit/home/support/make_component.hpp
   branches/release/boost/spirit/home/support/meta_compiler.hpp
      - copied unchanged from r56182, /trunk/boost/spirit/home/support/meta_compiler.hpp
   branches/release/boost/spirit/home/support/modify.hpp
      - copied unchanged from r56182, /trunk/boost/spirit/home/support/modify.hpp
   branches/release/boost/spirit/home/support/multi_pass.hpp
      - copied unchanged from r56182, /trunk/boost/spirit/home/support/multi_pass.hpp
   branches/release/boost/spirit/home/support/multi_pass_wrapper.hpp
      - copied unchanged from r56182, /trunk/boost/spirit/home/support/multi_pass_wrapper.hpp
   branches/release/boost/spirit/home/support/nonterminal/expand_arg.hpp
      - copied unchanged from r56182, /trunk/boost/spirit/home/support/nonterminal/expand_arg.hpp
   branches/release/boost/spirit/home/support/nonterminal/extract_param.hpp
      - copied unchanged from r56182, /trunk/boost/spirit/home/support/nonterminal/extract_param.hpp
   branches/release/boost/spirit/home/support/sequence_base_id.hpp
      - copied unchanged from r56182, /trunk/boost/spirit/home/support/sequence_base_id.hpp
   branches/release/boost/spirit/home/support/string_traits.hpp
      - copied unchanged from r56182, /trunk/boost/spirit/home/support/string_traits.hpp
   branches/release/boost/spirit/home/support/terminal.hpp
      - copied unchanged from r56182, /trunk/boost/spirit/home/support/terminal.hpp
   branches/release/boost/spirit/home/support/utf8.hpp
      - copied unchanged from r56182, /trunk/boost/spirit/home/support/utf8.hpp
   branches/release/boost/spirit/include/karma_alternative.hpp
      - copied unchanged from r56182, /trunk/boost/spirit/include/karma_alternative.hpp
   branches/release/boost/spirit/include/karma_and_predicate.hpp
      - copied unchanged from r56182, /trunk/boost/spirit/include/karma_and_predicate.hpp
   branches/release/boost/spirit/include/karma_buffer.hpp
      - copied unchanged from r56182, /trunk/boost/spirit/include/karma_buffer.hpp
   branches/release/boost/spirit/include/karma_center_alignment.hpp
      - copied unchanged from r56182, /trunk/boost/spirit/include/karma_center_alignment.hpp
   branches/release/boost/spirit/include/karma_char_.hpp
      - copied unchanged from r56182, /trunk/boost/spirit/include/karma_char_.hpp
   branches/release/boost/spirit/include/karma_char_class.hpp
      - copied unchanged from r56182, /trunk/boost/spirit/include/karma_char_class.hpp
   branches/release/boost/spirit/include/karma_eol.hpp
      - copied unchanged from r56182, /trunk/boost/spirit/include/karma_eol.hpp
   branches/release/boost/spirit/include/karma_eps.hpp
      - copied unchanged from r56182, /trunk/boost/spirit/include/karma_eps.hpp
   branches/release/boost/spirit/include/karma_generate_attr.hpp
      - copied unchanged from r56182, /trunk/boost/spirit/include/karma_generate_attr.hpp
   branches/release/boost/spirit/include/karma_int.hpp
      - copied unchanged from r56182, /trunk/boost/spirit/include/karma_int.hpp
   branches/release/boost/spirit/include/karma_kleene.hpp
      - copied unchanged from r56182, /trunk/boost/spirit/include/karma_kleene.hpp
   branches/release/boost/spirit/include/karma_lazy.hpp
      - copied unchanged from r56182, /trunk/boost/spirit/include/karma_lazy.hpp
   branches/release/boost/spirit/include/karma_left_alignment.hpp
      - copied unchanged from r56182, /trunk/boost/spirit/include/karma_left_alignment.hpp
   branches/release/boost/spirit/include/karma_list.hpp
      - copied unchanged from r56182, /trunk/boost/spirit/include/karma_list.hpp
   branches/release/boost/spirit/include/karma_maxwidth.hpp
      - copied unchanged from r56182, /trunk/boost/spirit/include/karma_maxwidth.hpp
   branches/release/boost/spirit/include/karma_not_predicate.hpp
      - copied unchanged from r56182, /trunk/boost/spirit/include/karma_not_predicate.hpp
   branches/release/boost/spirit/include/karma_omit.hpp
      - copied unchanged from r56182, /trunk/boost/spirit/include/karma_omit.hpp
   branches/release/boost/spirit/include/karma_optional.hpp
      - copied unchanged from r56182, /trunk/boost/spirit/include/karma_optional.hpp
   branches/release/boost/spirit/include/karma_plus.hpp
      - copied unchanged from r56182, /trunk/boost/spirit/include/karma_plus.hpp
   branches/release/boost/spirit/include/karma_real.hpp
      - copied unchanged from r56182, /trunk/boost/spirit/include/karma_real.hpp
   branches/release/boost/spirit/include/karma_repeat.hpp
      - copied unchanged from r56182, /trunk/boost/spirit/include/karma_repeat.hpp
   branches/release/boost/spirit/include/karma_right_alignment.hpp
      - copied unchanged from r56182, /trunk/boost/spirit/include/karma_right_alignment.hpp
   branches/release/boost/spirit/include/karma_sequence.hpp
      - copied unchanged from r56182, /trunk/boost/spirit/include/karma_sequence.hpp
   branches/release/boost/spirit/include/karma_uint.hpp
      - copied unchanged from r56182, /trunk/boost/spirit/include/karma_uint.hpp
   branches/release/boost/spirit/include/karma_upper_lower_case.hpp
      - copied unchanged from r56182, /trunk/boost/spirit/include/karma_upper_lower_case.hpp
   branches/release/boost/spirit/include/karma_verbatim.hpp
      - copied unchanged from r56182, /trunk/boost/spirit/include/karma_verbatim.hpp
   branches/release/boost/spirit/include/lex_char_token_def.hpp
      - copied unchanged from r56182, /trunk/boost/spirit/include/lex_char_token_def.hpp
   branches/release/boost/spirit/include/lex_generate_static_lexertl.hpp
      - copied unchanged from r56182, /trunk/boost/spirit/include/lex_generate_static_lexertl.hpp
   branches/release/boost/spirit/include/lex_lexertl.hpp
      - copied unchanged from r56182, /trunk/boost/spirit/include/lex_lexertl.hpp
   branches/release/boost/spirit/include/lex_primitives.hpp
      - copied unchanged from r56182, /trunk/boost/spirit/include/lex_primitives.hpp
   branches/release/boost/spirit/include/lex_static_lexertl.hpp
      - copied unchanged from r56182, /trunk/boost/spirit/include/lex_static_lexertl.hpp
   branches/release/boost/spirit/include/qi_core.hpp
      - copied unchanged from r56182, /trunk/boost/spirit/include/qi_core.hpp
   branches/release/boost/spirit/include/qi_parse_attr.hpp
      - copied unchanged from r56182, /trunk/boost/spirit/include/qi_parse_attr.hpp
   branches/release/boost/spirit/include/support_any_if_ns.hpp
      - copied unchanged from r56182, /trunk/boost/spirit/include/support_any_if_ns.hpp
   branches/release/boost/spirit/include/support_attributes.hpp
      - copied unchanged from r56182, /trunk/boost/spirit/include/support_attributes.hpp
   branches/release/boost/spirit/include/support_modify.hpp
      - copied unchanged from r56182, /trunk/boost/spirit/include/support_modify.hpp
   branches/release/boost/spirit/repository/
      - copied from r56182, /trunk/boost/spirit/repository/
   branches/release/boost/spirit/repository/home/
      - copied from r56182, /trunk/boost/spirit/repository/home/
   branches/release/boost/spirit/repository/home/karma/
      - copied from r56182, /trunk/boost/spirit/repository/home/karma/
   branches/release/boost/spirit/repository/home/karma.hpp
      - copied unchanged from r56182, /trunk/boost/spirit/repository/home/karma.hpp
   branches/release/boost/spirit/repository/home/karma/directive/
      - copied from r56182, /trunk/boost/spirit/repository/home/karma/directive/
   branches/release/boost/spirit/repository/home/karma/directive.hpp
      - copied unchanged from r56182, /trunk/boost/spirit/repository/home/karma/directive.hpp
   branches/release/boost/spirit/repository/home/karma/directive/confix.hpp
      - copied unchanged from r56182, /trunk/boost/spirit/repository/home/karma/directive/confix.hpp
   branches/release/boost/spirit/repository/home/karma/nonterminal/
      - copied from r56182, /trunk/boost/spirit/repository/home/karma/nonterminal/
   branches/release/boost/spirit/repository/home/karma/nonterminal.hpp
      - copied unchanged from r56182, /trunk/boost/spirit/repository/home/karma/nonterminal.hpp
   branches/release/boost/spirit/repository/home/karma/nonterminal/subrule.hpp
      - copied unchanged from r56182, /trunk/boost/spirit/repository/home/karma/nonterminal/subrule.hpp
   branches/release/boost/spirit/repository/home/qi/
      - copied from r56182, /trunk/boost/spirit/repository/home/qi/
   branches/release/boost/spirit/repository/home/qi.hpp
      - copied unchanged from r56182, /trunk/boost/spirit/repository/home/qi.hpp
   branches/release/boost/spirit/repository/home/qi/directive/
      - copied from r56182, /trunk/boost/spirit/repository/home/qi/directive/
   branches/release/boost/spirit/repository/home/qi/directive.hpp
      - copied unchanged from r56182, /trunk/boost/spirit/repository/home/qi/directive.hpp
   branches/release/boost/spirit/repository/home/qi/directive/confix.hpp
      - copied unchanged from r56182, /trunk/boost/spirit/repository/home/qi/directive/confix.hpp
   branches/release/boost/spirit/repository/home/qi/directive/distinct.hpp
      - copied unchanged from r56182, /trunk/boost/spirit/repository/home/qi/directive/distinct.hpp
   branches/release/boost/spirit/repository/home/qi/nonterminal/
      - copied from r56182, /trunk/boost/spirit/repository/home/qi/nonterminal/
   branches/release/boost/spirit/repository/home/qi/nonterminal.hpp
      - copied unchanged from r56182, /trunk/boost/spirit/repository/home/qi/nonterminal.hpp
   branches/release/boost/spirit/repository/home/qi/nonterminal/subrule.hpp
      - copied unchanged from r56182, /trunk/boost/spirit/repository/home/qi/nonterminal/subrule.hpp
   branches/release/boost/spirit/repository/home/qi/primitive/
      - copied from r56182, /trunk/boost/spirit/repository/home/qi/primitive/
   branches/release/boost/spirit/repository/home/qi/primitive.hpp
      - copied unchanged from r56182, /trunk/boost/spirit/repository/home/qi/primitive.hpp
   branches/release/boost/spirit/repository/home/qi/primitive/flush_multi_pass.hpp
      - copied unchanged from r56182, /trunk/boost/spirit/repository/home/qi/primitive/flush_multi_pass.hpp
   branches/release/boost/spirit/repository/home/support/
      - copied from r56182, /trunk/boost/spirit/repository/home/support/
   branches/release/boost/spirit/repository/home/support/confix.hpp
      - copied unchanged from r56182, /trunk/boost/spirit/repository/home/support/confix.hpp
   branches/release/boost/spirit/repository/home/support/distinct.hpp
      - copied unchanged from r56182, /trunk/boost/spirit/repository/home/support/distinct.hpp
   branches/release/boost/spirit/repository/home/support/flush_multi_pass.hpp
      - copied unchanged from r56182, /trunk/boost/spirit/repository/home/support/flush_multi_pass.hpp
   branches/release/boost/spirit/repository/home/support/subrule_context.hpp
      - copied unchanged from r56182, /trunk/boost/spirit/repository/home/support/subrule_context.hpp
   branches/release/boost/spirit/repository/include/
      - copied from r56182, /trunk/boost/spirit/repository/include/
   branches/release/boost/spirit/repository/include/karma.hpp
      - copied unchanged from r56182, /trunk/boost/spirit/repository/include/karma.hpp
   branches/release/boost/spirit/repository/include/karma_confix.hpp
      - copied unchanged from r56182, /trunk/boost/spirit/repository/include/karma_confix.hpp
   branches/release/boost/spirit/repository/include/karma_directive.hpp
      - copied unchanged from r56182, /trunk/boost/spirit/repository/include/karma_directive.hpp
   branches/release/boost/spirit/repository/include/karma_nonterminal.hpp
      - copied unchanged from r56182, /trunk/boost/spirit/repository/include/karma_nonterminal.hpp
   branches/release/boost/spirit/repository/include/karma_subrule.hpp
      - copied unchanged from r56182, /trunk/boost/spirit/repository/include/karma_subrule.hpp
   branches/release/boost/spirit/repository/include/qi.hpp
      - copied unchanged from r56182, /trunk/boost/spirit/repository/include/qi.hpp
   branches/release/boost/spirit/repository/include/qi_confix.hpp
      - copied unchanged from r56182, /trunk/boost/spirit/repository/include/qi_confix.hpp
   branches/release/boost/spirit/repository/include/qi_directive.hpp
      - copied unchanged from r56182, /trunk/boost/spirit/repository/include/qi_directive.hpp
   branches/release/boost/spirit/repository/include/qi_distinct.hpp
      - copied unchanged from r56182, /trunk/boost/spirit/repository/include/qi_distinct.hpp
   branches/release/boost/spirit/repository/include/qi_flush_multi_pass.hpp
      - copied unchanged from r56182, /trunk/boost/spirit/repository/include/qi_flush_multi_pass.hpp
   branches/release/boost/spirit/repository/include/qi_nonterminal.hpp
      - copied unchanged from r56182, /trunk/boost/spirit/repository/include/qi_nonterminal.hpp
   branches/release/boost/spirit/repository/include/qi_primitive.hpp
      - copied unchanged from r56182, /trunk/boost/spirit/repository/include/qi_primitive.hpp
   branches/release/boost/spirit/repository/include/qi_subrule.hpp
      - copied unchanged from r56182, /trunk/boost/spirit/repository/include/qi_subrule.hpp
Removed:
   branches/release/boost/spirit/home/karma/action/meta_grammar.hpp
   branches/release/boost/spirit/home/karma/auxiliary/confix.hpp
   branches/release/boost/spirit/home/karma/auxiliary/functor.hpp
   branches/release/boost/spirit/home/karma/auxiliary/functor_director.hpp
   branches/release/boost/spirit/home/karma/auxiliary/meta_grammar.hpp
   branches/release/boost/spirit/home/karma/auxiliary/none.hpp
   branches/release/boost/spirit/home/karma/binary/meta_grammar.hpp
   branches/release/boost/spirit/home/karma/char/meta_grammar.hpp
   branches/release/boost/spirit/home/karma/char/space.hpp
   branches/release/boost/spirit/home/karma/delimit.hpp
   branches/release/boost/spirit/home/karma/detail/ostream_iterator.hpp
   branches/release/boost/spirit/home/karma/directive/alignment_meta_grammar.hpp
   branches/release/boost/spirit/home/karma/directive/case_meta_grammar.hpp
   branches/release/boost/spirit/home/karma/directive/delimiter_meta_grammar.hpp
   branches/release/boost/spirit/home/karma/directive/detail/
   branches/release/boost/spirit/home/karma/meta_grammar.hpp
   branches/release/boost/spirit/home/karma/nonterminal/detail/rule.hpp
   branches/release/boost/spirit/home/karma/nonterminal/grammar_fwd.hpp
   branches/release/boost/spirit/home/karma/nonterminal/meta_grammar.hpp
   branches/release/boost/spirit/home/karma/nonterminal/nonterminal.hpp
   branches/release/boost/spirit/home/karma/nonterminal/nonterminal_director.hpp
   branches/release/boost/spirit/home/karma/numeric/meta_grammar.hpp
   branches/release/boost/spirit/home/karma/numeric/numeric_fwd.hpp
   branches/release/boost/spirit/home/karma/operator/detail/
   branches/release/boost/spirit/home/karma/operator/karma-alt/
   branches/release/boost/spirit/home/karma/operator/karma-alt.zip
   branches/release/boost/spirit/home/karma/operator/meta_grammar.hpp
   branches/release/boost/spirit/home/karma/stream/detail/iterator_ostream.hpp
   branches/release/boost/spirit/home/karma/stream/meta_grammar.hpp
   branches/release/boost/spirit/home/karma/string/meta_grammar.hpp
   branches/release/boost/spirit/home/lex/lexer/detail/
   branches/release/boost/spirit/home/lex/lexer/lexer_actions.hpp
   branches/release/boost/spirit/home/lex/lexer/lexer_fwd.hpp
   branches/release/boost/spirit/home/lex/lexer/lexertl/lexertl_functor.hpp
   branches/release/boost/spirit/home/lex/lexer/lexertl/lexertl_generate_static.hpp
   branches/release/boost/spirit/home/lex/lexer/lexertl/lexertl_iterator.hpp
   branches/release/boost/spirit/home/lex/lexer/lexertl/lexertl_lexer.hpp
   branches/release/boost/spirit/home/lex/lexer/lexertl/lexertl_static_functor.hpp
   branches/release/boost/spirit/home/lex/lexer/lexertl/lexertl_static_lexer.hpp
   branches/release/boost/spirit/home/lex/lexer/lexertl/lexertl_token.hpp
   branches/release/boost/spirit/home/lex/lexer/meta_grammar.hpp
   branches/release/boost/spirit/home/lex/lexer/terminal_director.hpp
   branches/release/boost/spirit/home/lex/lexer/terminal_holder.hpp
   branches/release/boost/spirit/home/lex/lexer/token_set.hpp
   branches/release/boost/spirit/home/lex/meta_grammar.hpp
   branches/release/boost/spirit/home/lex/qi/meta_grammar.hpp
   branches/release/boost/spirit/home/lex/qi/state/
   branches/release/boost/spirit/home/lex/qi/utility/
   branches/release/boost/spirit/home/lex/set_state.hpp
   branches/release/boost/spirit/home/phoenix/stl/algorithm/detail/std_list_fwd.hpp
   branches/release/boost/spirit/home/phoenix/stl/algorithm/detail/std_map_fwd.hpp
   branches/release/boost/spirit/home/phoenix/stl/algorithm/detail/std_set_fwd.hpp
   branches/release/boost/spirit/home/qi/action/meta_grammar.hpp
   branches/release/boost/spirit/home/qi/auxiliary/confix.hpp
   branches/release/boost/spirit/home/qi/auxiliary/functor.hpp
   branches/release/boost/spirit/home/qi/auxiliary/functor_director.hpp
   branches/release/boost/spirit/home/qi/auxiliary/meta_grammar.hpp
   branches/release/boost/spirit/home/qi/auxiliary/none.hpp
   branches/release/boost/spirit/home/qi/auxiliary/primitives.hpp
   branches/release/boost/spirit/home/qi/binary/meta_grammar.hpp
   branches/release/boost/spirit/home/qi/char/detail/
   branches/release/boost/spirit/home/qi/char/meta_grammar.hpp
   branches/release/boost/spirit/home/qi/debug/
   branches/release/boost/spirit/home/qi/debug.hpp
   branches/release/boost/spirit/home/qi/detail/construct_fwd.hpp
   branches/release/boost/spirit/home/qi/directive/meta_grammar.hpp
   branches/release/boost/spirit/home/qi/meta_grammar.hpp
   branches/release/boost/spirit/home/qi/nonterminal/detail/error_handler.hpp
   branches/release/boost/spirit/home/qi/nonterminal/detail/rule.hpp
   branches/release/boost/spirit/home/qi/nonterminal/error_handler_result.hpp
   branches/release/boost/spirit/home/qi/nonterminal/grammar_fwd.hpp
   branches/release/boost/spirit/home/qi/nonterminal/meta_grammar.hpp
   branches/release/boost/spirit/home/qi/nonterminal/nonterminal.hpp
   branches/release/boost/spirit/home/qi/nonterminal/nonterminal_director.hpp
   branches/release/boost/spirit/home/qi/nonterminal/virtual_component_base.hpp
   branches/release/boost/spirit/home/qi/numeric/meta_grammar.hpp
   branches/release/boost/spirit/home/qi/operator/meta_grammar.hpp
   branches/release/boost/spirit/home/qi/skip.hpp
   branches/release/boost/spirit/home/qi/stream/detail/iterator_istream.hpp
   branches/release/boost/spirit/home/qi/stream/meta_grammar.hpp
   branches/release/boost/spirit/home/qi/string/meta_grammar.hpp
   branches/release/boost/spirit/home/support/as_variant.hpp
   branches/release/boost/spirit/home/support/ascii.hpp
   branches/release/boost/spirit/home/support/attribute_of.hpp
   branches/release/boost/spirit/home/support/attribute_transform.hpp
   branches/release/boost/spirit/home/support/auxiliary/
   branches/release/boost/spirit/home/support/char_class/
   branches/release/boost/spirit/home/support/component.hpp
   branches/release/boost/spirit/home/support/detail/action_dispatch.hpp
   branches/release/boost/spirit/home/support/detail/container.hpp
   branches/release/boost/spirit/home/support/detail/math/nonfinite_num_facets.hpp
   branches/release/boost/spirit/home/support/detail/to_narrow.hpp
   branches/release/boost/spirit/home/support/detail/values.hpp
   branches/release/boost/spirit/home/support/iso8859_1.hpp
   branches/release/boost/spirit/home/support/meta_grammar/
   branches/release/boost/spirit/home/support/meta_grammar.hpp
   branches/release/boost/spirit/home/support/modifier.hpp
   branches/release/boost/spirit/home/support/nonterminal/detail/
   branches/release/boost/spirit/home/support/nonterminal/nonterminal.hpp
   branches/release/boost/spirit/home/support/placeholders.hpp
   branches/release/boost/spirit/home/support/standard.hpp
   branches/release/boost/spirit/home/support/standard_wide.hpp
   branches/release/boost/spirit/include/karma_meta_grammar.hpp
   branches/release/boost/spirit/include/lex_lexer_lexertl.hpp
   branches/release/boost/spirit/include/lex_lexer_static_lexertl.hpp
   branches/release/boost/spirit/include/lex_meta_grammar.hpp
   branches/release/boost/spirit/include/lex_set_state.hpp
   branches/release/boost/spirit/include/qi_debug.hpp
   branches/release/boost/spirit/include/qi_meta_grammar.hpp
   branches/release/boost/spirit/include/support_as_variant.hpp
   branches/release/boost/spirit/include/support_attribute_of.hpp
   branches/release/boost/spirit/include/support_attribute_transform.hpp
   branches/release/boost/spirit/include/support_basic_rules.hpp
   branches/release/boost/spirit/include/support_basic_transforms.hpp
   branches/release/boost/spirit/include/support_component.hpp
   branches/release/boost/spirit/include/support_functor_holder.hpp
   branches/release/boost/spirit/include/support_grammar.hpp
   branches/release/boost/spirit/include/support_meta_function_holder.hpp
   branches/release/boost/spirit/include/support_meta_grammar.hpp
   branches/release/boost/spirit/include/support_modifier.hpp
   branches/release/boost/spirit/include/support_nonterminal.hpp
   branches/release/boost/spirit/include/support_placeholders.hpp
Properties modified:
   branches/release/boost/spirit/ (props changed)
Text files modified:
   branches/release/boost/spirit/home/classic/actor/ref_value_actor.hpp | 9
   branches/release/boost/spirit/home/classic/core/composite/actions.hpp | 5
   branches/release/boost/spirit/home/classic/core/composite/alternative.hpp | 9
   branches/release/boost/spirit/home/classic/core/composite/composite.hpp | 5
   branches/release/boost/spirit/home/classic/core/composite/difference.hpp | 11
   branches/release/boost/spirit/home/classic/core/composite/kleene_star.hpp | 9
   branches/release/boost/spirit/home/classic/core/composite/positive.hpp | 9
   branches/release/boost/spirit/home/classic/core/composite/sequence.hpp | 9
   branches/release/boost/spirit/home/classic/core/non_terminal/impl/rule.ipp | 9
   branches/release/boost/spirit/home/classic/core/primitives/impl/numerics.ipp | 12
   branches/release/boost/spirit/home/classic/dynamic.hpp | 2
   branches/release/boost/spirit/home/classic/meta/refactoring.hpp | 9
   branches/release/boost/spirit/home/classic/phoenix/actor.hpp | 9
   branches/release/boost/spirit/home/classic/phoenix/closures.hpp | 9
   branches/release/boost/spirit/home/classic/phoenix/composite.hpp | 9
   branches/release/boost/spirit/home/classic/phoenix/primitives.hpp | 9
   branches/release/boost/spirit/home/classic/phoenix/tuples.hpp | 9
   branches/release/boost/spirit/home/classic/utility/confix.hpp | 9
   branches/release/boost/spirit/home/classic/utility/rule_parser.hpp | 2
   branches/release/boost/spirit/home/karma.hpp | 9
   branches/release/boost/spirit/home/karma/action.hpp | 5
   branches/release/boost/spirit/home/karma/action/action.hpp | 134 ++++---
   branches/release/boost/spirit/home/karma/auxiliary.hpp | 9
   branches/release/boost/spirit/home/karma/auxiliary/eol.hpp | 67 +++
   branches/release/boost/spirit/home/karma/auxiliary/eps.hpp | 117 +++++-
   branches/release/boost/spirit/home/karma/auxiliary/lazy.hpp | 223 ++++++++++--
   branches/release/boost/spirit/home/karma/binary.hpp | 5
   branches/release/boost/spirit/home/karma/binary/binary.hpp | 282 +++++++++++++----
   branches/release/boost/spirit/home/karma/binary/padding.hpp | 100 ++++-
   branches/release/boost/spirit/home/karma/char.hpp | 7
   branches/release/boost/spirit/home/karma/char/char.hpp | 586 ++++++++++++++++++++++-------------
   branches/release/boost/spirit/home/karma/detail/generate_to.hpp | 49 +-
   branches/release/boost/spirit/home/karma/detail/output_iterator.hpp | 574 +++++++++++++++++++++++-----------
   branches/release/boost/spirit/home/karma/detail/string_generate.hpp | 124 +++++--
   branches/release/boost/spirit/home/karma/directive.hpp | 32 +
   branches/release/boost/spirit/home/karma/directive/center_alignment.hpp | 392 +++++++++++++---------
   branches/release/boost/spirit/home/karma/directive/delimit.hpp | 205 +++++++----
   branches/release/boost/spirit/home/karma/directive/left_alignment.hpp | 372 ++++++++++++---------
   branches/release/boost/spirit/home/karma/directive/right_alignment.hpp | 385 +++++++++++++---------
   branches/release/boost/spirit/home/karma/directive/verbatim.hpp | 104 +++--
   branches/release/boost/spirit/home/karma/domain.hpp | 48 ++
   branches/release/boost/spirit/home/karma/generate.hpp | 385 ++++++++++------------
   branches/release/boost/spirit/home/karma/nonterminal.hpp | 5
   branches/release/boost/spirit/home/karma/nonterminal/grammar.hpp | 92 +++--
   branches/release/boost/spirit/home/karma/nonterminal/rule.hpp | 379 ++++++++++++++--------
   branches/release/boost/spirit/home/karma/numeric.hpp | 6
   branches/release/boost/spirit/home/karma/numeric/detail/numeric_utils.hpp | 542 +++++++++++++++-----------------
   branches/release/boost/spirit/home/karma/numeric/int.hpp | 510 +++++++++++++++++++++---------
   branches/release/boost/spirit/home/karma/numeric/real.hpp | 503 ++++++++++++++++++++----------
   branches/release/boost/spirit/home/karma/numeric/real_policies.hpp | 255 +++++++++------
   branches/release/boost/spirit/home/karma/numeric/uint.hpp | 563 +++++++++++++++++++++++++--------
   branches/release/boost/spirit/home/karma/operator.hpp | 7
   branches/release/boost/spirit/home/karma/operator/alternative.hpp | 150 ++++++--
   branches/release/boost/spirit/home/karma/operator/kleene.hpp | 127 ++++---
   branches/release/boost/spirit/home/karma/operator/list.hpp | 137 ++++---
   branches/release/boost/spirit/home/karma/operator/optional.hpp | 128 ++++---
   branches/release/boost/spirit/home/karma/operator/plus.hpp | 131 ++++---
   branches/release/boost/spirit/home/karma/operator/sequence.hpp | 201 +++++++++--
   branches/release/boost/spirit/home/karma/stream.hpp | 7
   branches/release/boost/spirit/home/karma/stream/detail/format_manip.hpp | 96 +++--
   branches/release/boost/spirit/home/karma/stream/format_manip.hpp | 143 ++++----
   branches/release/boost/spirit/home/karma/stream/stream.hpp | 351 +++++++++++++++-----
   branches/release/boost/spirit/home/karma/string.hpp | 5
   branches/release/boost/spirit/home/karma/string/lit.hpp | 444 +++++++++++++-------------
   branches/release/boost/spirit/home/karma/what.hpp | 31 -
   branches/release/boost/spirit/home/lex.hpp | 8
   branches/release/boost/spirit/home/lex/domain.hpp | 22
   branches/release/boost/spirit/home/lex/lexer.hpp | 15
   branches/release/boost/spirit/home/lex/lexer/action.hpp | 125 +++---
   branches/release/boost/spirit/home/lex/lexer/char_token_def.hpp | 152 ++++++++
   branches/release/boost/spirit/home/lex/lexer/lexer.hpp | 351 +++++++++-----------
   branches/release/boost/spirit/home/lex/lexer/lexertl/iterator_tokenizer.hpp | 129 ++-----
   branches/release/boost/spirit/home/lex/lexer/lexertl/wrap_action.hpp | 297 ++++++++++-------
   branches/release/boost/spirit/home/lex/lexer/sequence.hpp | 59 ++
   branches/release/boost/spirit/home/lex/lexer/string_token_def.hpp | 101 +++++
   branches/release/boost/spirit/home/lex/lexer/token_def.hpp | 226 +++++++------
   branches/release/boost/spirit/home/lex/lexer_lexertl.hpp | 6
   branches/release/boost/spirit/home/lex/lexer_static_lexertl.hpp | 10
   branches/release/boost/spirit/home/lex/tokenize_and_parse.hpp | 273 ++++++++--------
   branches/release/boost/spirit/home/phoenix/core/actor.hpp | 9
   branches/release/boost/spirit/home/phoenix/core/argument.hpp | 6
   branches/release/boost/spirit/home/phoenix/core/basic_environment.hpp | 5
   branches/release/boost/spirit/home/phoenix/core/composite.hpp | 4
   branches/release/boost/spirit/home/phoenix/core/limits.hpp | 59 +++
   branches/release/boost/spirit/home/phoenix/operator/detail/mem_fun_ptr_eval.hpp | 3
   branches/release/boost/spirit/home/phoenix/operator/detail/mem_fun_ptr_gen.hpp | 4
   branches/release/boost/spirit/home/phoenix/operator/member.hpp | 6
   branches/release/boost/spirit/home/phoenix/scope/dynamic.hpp | 12
   branches/release/boost/spirit/home/phoenix/scope/lambda.hpp | 4
   branches/release/boost/spirit/home/phoenix/scope/let.hpp | 4
   branches/release/boost/spirit/home/phoenix/scope/local_variable.hpp | 4
   branches/release/boost/spirit/home/phoenix/statement/detail/catch_all_eval.hpp | 4
   branches/release/boost/spirit/home/phoenix/statement/detail/catch_eval.hpp | 4
   branches/release/boost/spirit/home/phoenix/statement/try_catch.hpp | 6
   branches/release/boost/spirit/home/phoenix/stl/algorithm/detail/is_std_hash_map.hpp | 43 ++
   branches/release/boost/spirit/home/phoenix/stl/algorithm/detail/is_std_hash_set.hpp | 39 +
   branches/release/boost/spirit/home/phoenix/stl/algorithm/detail/is_std_list.hpp | 2
   branches/release/boost/spirit/home/phoenix/stl/algorithm/detail/is_std_map.hpp | 2
   branches/release/boost/spirit/home/phoenix/stl/algorithm/detail/is_std_set.hpp | 2
   branches/release/boost/spirit/home/phoenix/stl/algorithm/detail/std_hash_map_fwd.hpp | 33 +
   branches/release/boost/spirit/home/phoenix/stl/algorithm/detail/std_hash_set_fwd.hpp | 29 +
   branches/release/boost/spirit/home/phoenix/stl/container/container.hpp | 6
   branches/release/boost/spirit/home/qi.hpp | 22
   branches/release/boost/spirit/home/qi/action.hpp | 11
   branches/release/boost/spirit/home/qi/action/action.hpp | 136 ++++---
   branches/release/boost/spirit/home/qi/auxiliary.hpp | 19
   branches/release/boost/spirit/home/qi/auxiliary/eps.hpp | 114 +++++-
   branches/release/boost/spirit/home/qi/auxiliary/lazy.hpp | 231 ++++++++++---
   branches/release/boost/spirit/home/qi/binary.hpp | 14
   branches/release/boost/spirit/home/qi/binary/binary.hpp | 234 ++++++++++---
   branches/release/boost/spirit/home/qi/char.hpp | 11
   branches/release/boost/spirit/home/qi/char/char.hpp | 661 ++++++++++++++++++++++++---------------
   branches/release/boost/spirit/home/qi/char/char_class.hpp | 118 +++---
   branches/release/boost/spirit/home/qi/char/char_parser.hpp | 149 ++++++--
   branches/release/boost/spirit/home/qi/detail/alternative_function.hpp | 40 +
   branches/release/boost/spirit/home/qi/detail/assign_to.hpp | 30 +
   branches/release/boost/spirit/home/qi/detail/construct.hpp | 24
   branches/release/boost/spirit/home/qi/detail/expect_function.hpp | 36 +
   branches/release/boost/spirit/home/qi/detail/fail_function.hpp | 23
   branches/release/boost/spirit/home/qi/detail/pass_function.hpp | 19
   branches/release/boost/spirit/home/qi/detail/permute_function.hpp | 18
   branches/release/boost/spirit/home/qi/detail/string_parse.hpp | 6
   branches/release/boost/spirit/home/qi/directive.hpp | 14
   branches/release/boost/spirit/home/qi/directive/lexeme.hpp | 92 +++--
   branches/release/boost/spirit/home/qi/directive/omit.hpp | 86 +++-
   branches/release/boost/spirit/home/qi/directive/raw.hpp | 86 +++-
   branches/release/boost/spirit/home/qi/domain.hpp | 49 ++
   branches/release/boost/spirit/home/qi/nonterminal.hpp | 16
   branches/release/boost/spirit/home/qi/nonterminal/grammar.hpp | 96 +++--
   branches/release/boost/spirit/home/qi/nonterminal/rule.hpp | 521 +++++++++++++------------------
   branches/release/boost/spirit/home/qi/numeric.hpp | 11
   branches/release/boost/spirit/home/qi/numeric/detail/numeric_utils.hpp | 46 +-
   branches/release/boost/spirit/home/qi/numeric/detail/real_impl.hpp | 191 +++++++----
   branches/release/boost/spirit/home/qi/numeric/int.hpp | 122 ++++++-
   branches/release/boost/spirit/home/qi/numeric/numeric_utils.hpp | 30 +
   branches/release/boost/spirit/home/qi/numeric/real.hpp | 110 +++++-
   branches/release/boost/spirit/home/qi/numeric/real_policies.hpp | 56 +-
   branches/release/boost/spirit/home/qi/numeric/uint.hpp | 159 ++++++++-
   branches/release/boost/spirit/home/qi/operator.hpp | 11
   branches/release/boost/spirit/home/qi/operator/alternative.hpp | 119 +++---
   branches/release/boost/spirit/home/qi/operator/and_predicate.hpp | 75 ++-
   branches/release/boost/spirit/home/qi/operator/difference.hpp | 102 +++---
   branches/release/boost/spirit/home/qi/operator/expect.hpp | 45 ++
   branches/release/boost/spirit/home/qi/operator/kleene.hpp | 122 +++---
   branches/release/boost/spirit/home/qi/operator/list.hpp | 126 +++---
   branches/release/boost/spirit/home/qi/operator/not_predicate.hpp | 74 ++-
   branches/release/boost/spirit/home/qi/operator/optional.hpp | 106 +++---
   branches/release/boost/spirit/home/qi/operator/permutation.hpp | 123 ++++--
   branches/release/boost/spirit/home/qi/operator/plus.hpp | 123 +++---
   branches/release/boost/spirit/home/qi/operator/sequence.hpp | 42 ++
   branches/release/boost/spirit/home/qi/operator/sequence_base.hpp | 135 +++++--
   branches/release/boost/spirit/home/qi/operator/sequential_or.hpp | 112 ++++--
   branches/release/boost/spirit/home/qi/parse.hpp | 162 ++++----
   branches/release/boost/spirit/home/qi/stream.hpp | 16
   branches/release/boost/spirit/home/qi/stream/detail/match_manip.hpp | 111 ++++--
   branches/release/boost/spirit/home/qi/stream/match_manip.hpp | 154 +++++----
   branches/release/boost/spirit/home/qi/stream/stream.hpp | 84 +++-
   branches/release/boost/spirit/home/qi/string.hpp | 11
   branches/release/boost/spirit/home/qi/string/detail/tst.hpp | 207 ------------
   branches/release/boost/spirit/home/qi/what.hpp | 29
   branches/release/boost/spirit/home/support.hpp | 35 +
   branches/release/boost/spirit/home/support/algorithm/any.hpp | 10
   branches/release/boost/spirit/home/support/algorithm/any_if.hpp | 62 +--
   branches/release/boost/spirit/home/support/algorithm/any_ns.hpp | 8
   branches/release/boost/spirit/home/support/argument.hpp | 153 +-------
   branches/release/boost/spirit/home/support/char_class.hpp | 200 +++++++----
   branches/release/boost/spirit/home/support/detail/hold_any.hpp | 47 +-
   branches/release/boost/spirit/home/support/detail/integer/cover_operators.hpp | 48 ++
   branches/release/boost/spirit/home/support/detail/integer/endian.hpp | 330 ++++++++++++-------
   branches/release/boost/spirit/home/support/detail/lexer/char_traits.hpp | 2
   branches/release/boost/spirit/home/support/detail/lexer/consts.hpp | 16
   branches/release/boost/spirit/home/support/detail/lexer/containers/ptr_list.hpp | 6
   branches/release/boost/spirit/home/support/detail/lexer/containers/ptr_vector.hpp | 6
   branches/release/boost/spirit/home/support/detail/lexer/conversion/char_state_machine.hpp | 4
   branches/release/boost/spirit/home/support/detail/lexer/debug.hpp | 205 +++++++----
   branches/release/boost/spirit/home/support/detail/lexer/file_input.hpp | 67 ++-
   branches/release/boost/spirit/home/support/detail/lexer/generate_cpp.hpp | 33 +
   branches/release/boost/spirit/home/support/detail/lexer/generator.hpp | 123 ++++--
   branches/release/boost/spirit/home/support/detail/lexer/input.hpp | 124 +++++--
   branches/release/boost/spirit/home/support/detail/lexer/parser/parser.hpp | 42 -
   branches/release/boost/spirit/home/support/detail/lexer/parser/tokeniser/num_token.hpp | 2
   branches/release/boost/spirit/home/support/detail/lexer/parser/tokeniser/re_tokeniser.hpp | 15
   branches/release/boost/spirit/home/support/detail/lexer/parser/tokeniser/re_tokeniser_helper.hpp | 132 +++---
   branches/release/boost/spirit/home/support/detail/lexer/parser/tokeniser/re_tokeniser_state.hpp | 5
   branches/release/boost/spirit/home/support/detail/lexer/parser/tree/end_node.hpp | 12
   branches/release/boost/spirit/home/support/detail/lexer/parser/tree/iteration_node.hpp | 2
   branches/release/boost/spirit/home/support/detail/lexer/parser/tree/leaf_node.hpp | 2
   branches/release/boost/spirit/home/support/detail/lexer/parser/tree/node.hpp | 10
   branches/release/boost/spirit/home/support/detail/lexer/parser/tree/selection_node.hpp | 2
   branches/release/boost/spirit/home/support/detail/lexer/parser/tree/sequence_node.hpp | 2
   branches/release/boost/spirit/home/support/detail/lexer/partition/charset.hpp | 2
   branches/release/boost/spirit/home/support/detail/lexer/partition/equivset.hpp | 2
   branches/release/boost/spirit/home/support/detail/lexer/rules.hpp | 340 +++++++++++++++++--
   branches/release/boost/spirit/home/support/detail/lexer/runtime_error.hpp | 2
   branches/release/boost/spirit/home/support/detail/lexer/serialise.hpp | 19
   branches/release/boost/spirit/home/support/detail/lexer/size_t.hpp | 2
   branches/release/boost/spirit/home/support/detail/lexer/state_machine.hpp | 111 +++---
   branches/release/boost/spirit/home/support/detail/lexer/string_token.hpp | 7
   branches/release/boost/spirit/home/support/detail/math/detail/fp_traits.hpp | 4
   branches/release/boost/spirit/home/support/detail/math/fpclassify.hpp | 6
   branches/release/boost/spirit/home/support/detail/math/signbit.hpp | 4
   branches/release/boost/spirit/home/support/detail/what_function.hpp | 28
   branches/release/boost/spirit/home/support/iterators/detail/buf_id_check_policy.hpp | 22
   branches/release/boost/spirit/home/support/iterators/detail/combine_policies.hpp | 181 +++++-----
   branches/release/boost/spirit/home/support/iterators/detail/first_owner_policy.hpp | 22
   branches/release/boost/spirit/home/support/iterators/detail/fixed_size_queue.hpp | 14
   branches/release/boost/spirit/home/support/iterators/detail/fixed_size_queue_policy.hpp | 24
   branches/release/boost/spirit/home/support/iterators/detail/functor_input_policy.hpp | 8
   branches/release/boost/spirit/home/support/iterators/detail/input_iterator_policy.hpp | 42 +-
   branches/release/boost/spirit/home/support/iterators/detail/lex_input_policy.hpp | 18
   branches/release/boost/spirit/home/support/iterators/detail/multi_pass.hpp | 39 +-
   branches/release/boost/spirit/home/support/iterators/detail/no_check_policy.hpp | 9
   branches/release/boost/spirit/home/support/iterators/detail/ref_counted_policy.hpp | 25
   branches/release/boost/spirit/home/support/iterators/detail/split_functor_input_policy.hpp | 34 -
   branches/release/boost/spirit/home/support/iterators/detail/split_std_deque_policy.hpp | 77 ++--
   branches/release/boost/spirit/home/support/iterators/look_ahead.hpp | 33 +
   branches/release/boost/spirit/home/support/iterators/multi_pass.hpp | 109 ++++-
   branches/release/boost/spirit/home/support/iterators/multi_pass_fwd.hpp | 56 ++
   branches/release/boost/spirit/home/support/nonterminal/locals.hpp | 29
   branches/release/boost/spirit/home/support/safe_bool.hpp | 50 --
   branches/release/boost/spirit/home/support/unused.hpp | 69 ++-
   branches/release/boost/spirit/include/karma.hpp | 10
   branches/release/boost/spirit/include/karma_action.hpp | 10
   branches/release/boost/spirit/include/karma_auxiliary.hpp | 10
   branches/release/boost/spirit/include/karma_binary.hpp | 10
   branches/release/boost/spirit/include/karma_char.hpp | 10
   branches/release/boost/spirit/include/karma_delimit.hpp | 12
   branches/release/boost/spirit/include/karma_directive.hpp | 10
   branches/release/boost/spirit/include/karma_domain.hpp | 10
   branches/release/boost/spirit/include/karma_generate.hpp | 10
   branches/release/boost/spirit/include/karma_nonterminal.hpp | 10
   branches/release/boost/spirit/include/karma_numeric.hpp | 10
   branches/release/boost/spirit/include/karma_operator.hpp | 10
   branches/release/boost/spirit/include/karma_stream.hpp | 10
   branches/release/boost/spirit/include/karma_string.hpp | 10
   branches/release/boost/spirit/include/karma_what.hpp | 10
   branches/release/boost/spirit/include/lex.hpp | 10
   branches/release/boost/spirit/include/lex_domain.hpp | 10
   branches/release/boost/spirit/include/lex_lexer.hpp | 10
   branches/release/boost/spirit/include/lex_tokenize_and_parse.hpp | 11
   branches/release/boost/spirit/include/phoenix.hpp | 4
   branches/release/boost/spirit/include/phoenix_algorithm.hpp | 4
   branches/release/boost/spirit/include/phoenix_bind.hpp | 4
   branches/release/boost/spirit/include/phoenix_container.hpp | 4
   branches/release/boost/spirit/include/phoenix_core.hpp | 4
   branches/release/boost/spirit/include/phoenix_function.hpp | 4
   branches/release/boost/spirit/include/phoenix_fusion.hpp | 4
   branches/release/boost/spirit/include/phoenix_object.hpp | 4
   branches/release/boost/spirit/include/phoenix_operator.hpp | 4
   branches/release/boost/spirit/include/phoenix_scope.hpp | 4
   branches/release/boost/spirit/include/phoenix_statement.hpp | 4
   branches/release/boost/spirit/include/phoenix_stl.hpp | 4
   branches/release/boost/spirit/include/phoenix_version.hpp | 4
   branches/release/boost/spirit/include/qi.hpp | 10
   branches/release/boost/spirit/include/qi_action.hpp | 10
   branches/release/boost/spirit/include/qi_auxiliary.hpp | 10
   branches/release/boost/spirit/include/qi_binary.hpp | 10
   branches/release/boost/spirit/include/qi_char.hpp | 10
   branches/release/boost/spirit/include/qi_directive.hpp | 10
   branches/release/boost/spirit/include/qi_domain.hpp | 10
   branches/release/boost/spirit/include/qi_nonterminal.hpp | 10
   branches/release/boost/spirit/include/qi_numeric.hpp | 10
   branches/release/boost/spirit/include/qi_operator.hpp | 10
   branches/release/boost/spirit/include/qi_parse.hpp | 10
   branches/release/boost/spirit/include/qi_skip.hpp | 12
   branches/release/boost/spirit/include/qi_stream.hpp | 10
   branches/release/boost/spirit/include/qi_string.hpp | 10
   branches/release/boost/spirit/include/qi_what.hpp | 10
   branches/release/boost/spirit/include/support.hpp | 10
   branches/release/boost/spirit/include/support_any.hpp | 10
   branches/release/boost/spirit/include/support_any_if.hpp | 10
   branches/release/boost/spirit/include/support_any_ns.hpp | 10
   branches/release/boost/spirit/include/support_argument.hpp | 10
   branches/release/boost/spirit/include/support_ascii.hpp | 12
   branches/release/boost/spirit/include/support_char_class.hpp | 10
   branches/release/boost/spirit/include/support_iso8859_1.hpp | 12
   branches/release/boost/spirit/include/support_locals.hpp | 10
   branches/release/boost/spirit/include/support_look_ahead.hpp | 10
   branches/release/boost/spirit/include/support_multi_pass.hpp | 10
   branches/release/boost/spirit/include/support_multi_pass_fwd.hpp | 10
   branches/release/boost/spirit/include/support_safe_bool.hpp | 10
   branches/release/boost/spirit/include/support_standard.hpp | 12
   branches/release/boost/spirit/include/support_standard_wide.hpp | 12
   branches/release/boost/spirit/include/support_unused.hpp | 10
   branches/release/boost/spirit/version.hpp | 8
   285 files changed, 12688 insertions(+), 7913 deletions(-)

Modified: branches/release/boost/spirit/home/classic/actor/ref_value_actor.hpp
==============================================================================
--- branches/release/boost/spirit/home/classic/actor/ref_value_actor.hpp (original)
+++ branches/release/boost/spirit/home/classic/actor/ref_value_actor.hpp 2009-09-14 12:50:29 EDT (Mon, 14 Sep 2009)
@@ -14,6 +14,11 @@
 
 BOOST_SPIRIT_CLASSIC_NAMESPACE_BEGIN
 
+#if BOOST_WORKAROUND(BOOST_MSVC, >= 1400)
+#pragma warning(push)
+#pragma warning(disable:4512) //assignment operator could not be generated
+#endif
+
     ///////////////////////////////////////////////////////////////////////////
     // Summary:
     // A semantic action policy holder. This holder stores a reference to ref.
@@ -65,6 +70,10 @@
 
 BOOST_SPIRIT_CLASSIC_NAMESPACE_END
 
+#if BOOST_WORKAROUND(BOOST_MSVC, >= 1400)
+#pragma warning(pop)
+#endif
+
 }}
 
 #endif

Modified: branches/release/boost/spirit/home/classic/core/composite/actions.hpp
==============================================================================
--- branches/release/boost/spirit/home/classic/core/composite/actions.hpp (original)
+++ branches/release/boost/spirit/home/classic/core/composite/actions.hpp 2009-09-14 12:50:29 EDT (Mon, 14 Sep 2009)
@@ -16,6 +16,11 @@
 
 BOOST_SPIRIT_CLASSIC_NAMESPACE_BEGIN
 
+#if BOOST_WORKAROUND(BOOST_MSVC, >= 1400)
+#pragma warning(push)
+#pragma warning(disable:4512) //assignment operator could not be generated
+#endif
+
     ///////////////////////////////////////////////////////////////////////////
     //
     // action class

Modified: branches/release/boost/spirit/home/classic/core/composite/alternative.hpp
==============================================================================
--- branches/release/boost/spirit/home/classic/core/composite/alternative.hpp (original)
+++ branches/release/boost/spirit/home/classic/core/composite/alternative.hpp 2009-09-14 12:50:29 EDT (Mon, 14 Sep 2009)
@@ -39,6 +39,11 @@
     ///////////////////////////////////////////////////////////////////////////
     struct alternative_parser_gen;
     
+#if BOOST_WORKAROUND(BOOST_MSVC, >= 1400)
+#pragma warning(push)
+#pragma warning(disable:4512) //assignment operator could not be generated
+#endif
+
     template <typename A, typename B>
     struct alternative
     : public binary<A, B, parser<alternative<A, B> > >
@@ -66,6 +71,10 @@
             return this->right().parse(scan);
         }
     };
+
+#if BOOST_WORKAROUND(BOOST_MSVC, >= 1400)
+#pragma warning(pop)
+#endif
     
     struct alternative_parser_gen
     {

Modified: branches/release/boost/spirit/home/classic/core/composite/composite.hpp
==============================================================================
--- branches/release/boost/spirit/home/classic/core/composite/composite.hpp (original)
+++ branches/release/boost/spirit/home/classic/core/composite/composite.hpp 2009-09-14 12:50:29 EDT (Mon, 14 Sep 2009)
@@ -17,6 +17,11 @@
 
 BOOST_SPIRIT_CLASSIC_NAMESPACE_BEGIN
 
+#if BOOST_WORKAROUND(BOOST_MSVC, >= 1400)
+#pragma warning(push)
+#pragma warning(disable:4512) //assignment operator could not be generated
+#endif
+
     ///////////////////////////////////////////////////////////////////////////
     //
     // unary class.

Modified: branches/release/boost/spirit/home/classic/core/composite/difference.hpp
==============================================================================
--- branches/release/boost/spirit/home/classic/core/composite/difference.hpp (original)
+++ branches/release/boost/spirit/home/classic/core/composite/difference.hpp 2009-09-14 12:50:29 EDT (Mon, 14 Sep 2009)
@@ -35,7 +35,12 @@
     //
     ///////////////////////////////////////////////////////////////////////////
     struct difference_parser_gen;
-
+
+#if BOOST_WORKAROUND(BOOST_MSVC, >= 1400)
+#pragma warning(push)
+#pragma warning(disable:4512) //assignment operator could not be generated
+#endif
+
     template <typename A, typename B>
     struct difference
     : public binary<A, B, parser<difference<A, B> > >
@@ -69,6 +74,10 @@
             return scan.no_match();
         }
     };
+
+#if BOOST_WORKAROUND(BOOST_MSVC, >= 1400)
+#pragma warning(pop)
+#endif
     
     struct difference_parser_gen
     {

Modified: branches/release/boost/spirit/home/classic/core/composite/kleene_star.hpp
==============================================================================
--- branches/release/boost/spirit/home/classic/core/composite/kleene_star.hpp (original)
+++ branches/release/boost/spirit/home/classic/core/composite/kleene_star.hpp 2009-09-14 12:50:29 EDT (Mon, 14 Sep 2009)
@@ -34,6 +34,11 @@
     ///////////////////////////////////////////////////////////////////////////
     struct kleene_star_parser_gen;
     
+#if BOOST_WORKAROUND(BOOST_MSVC, >= 1400)
+#pragma warning(push)
+#pragma warning(disable:4512) //assignment operator could not be generated
+#endif
+
     template <typename S>
     struct kleene_star
     : public unary<S, parser<kleene_star<S> > >
@@ -70,6 +75,10 @@
         }
     };
     
+#if BOOST_WORKAROUND(BOOST_MSVC, >= 1400)
+#pragma warning(pop)
+#endif
+
     struct kleene_star_parser_gen
     {
         template <typename S>

Modified: branches/release/boost/spirit/home/classic/core/composite/positive.hpp
==============================================================================
--- branches/release/boost/spirit/home/classic/core/composite/positive.hpp (original)
+++ branches/release/boost/spirit/home/classic/core/composite/positive.hpp 2009-09-14 12:50:29 EDT (Mon, 14 Sep 2009)
@@ -34,6 +34,11 @@
     ///////////////////////////////////////////////////////////////////////////
     struct positive_parser_gen;
     
+#if BOOST_WORKAROUND(BOOST_MSVC, >= 1400)
+#pragma warning(push)
+#pragma warning(disable:4512) //assignment operator could not be generated
+#endif
+
     template <typename S>
     struct positive
     : public unary<S, parser<positive<S> > >
@@ -73,6 +78,10 @@
             return hit;
         }
     };
+
+#if BOOST_WORKAROUND(BOOST_MSVC, >= 1400)
+#pragma warning(pop)
+#endif
     
     struct positive_parser_gen
     {

Modified: branches/release/boost/spirit/home/classic/core/composite/sequence.hpp
==============================================================================
--- branches/release/boost/spirit/home/classic/core/composite/sequence.hpp (original)
+++ branches/release/boost/spirit/home/classic/core/composite/sequence.hpp 2009-09-14 12:50:29 EDT (Mon, 14 Sep 2009)
@@ -36,6 +36,11 @@
     //////////////////////////////////////////////////////////////////////////
     struct sequence_parser_gen;
     
+#if BOOST_WORKAROUND(BOOST_MSVC, >= 1400)
+#pragma warning(push)
+#pragma warning(disable:4512) //assignment operator could not be generated
+#endif
+
     template <typename A, typename B>
     struct sequence : public binary<A, B, parser<sequence<A, B> > >
     {
@@ -61,6 +66,10 @@
             return scan.no_match();
         }
     };
+
+#if BOOST_WORKAROUND(BOOST_MSVC, >= 1400)
+#pragma warning(pop)
+#endif
     
     struct sequence_parser_gen
     {

Modified: branches/release/boost/spirit/home/classic/core/non_terminal/impl/rule.ipp
==============================================================================
--- branches/release/boost/spirit/home/classic/core/non_terminal/impl/rule.ipp (original)
+++ branches/release/boost/spirit/home/classic/core/non_terminal/impl/rule.ipp 2009-09-14 12:50:29 EDT (Mon, 14 Sep 2009)
@@ -223,6 +223,11 @@
         // concrete_parser class
         //
         ///////////////////////////////////////////////////////////////////////
+#if BOOST_WORKAROUND(BOOST_MSVC, >= 1400)
+#pragma warning(push)
+#pragma warning(disable:4512) //assignment operator could not be generated
+#endif
+
         template <typename ParserT, typename ScannerT, typename AttrT>
         struct concrete_parser : abstract_parser<ScannerT, AttrT>
         {
@@ -243,6 +248,10 @@
 
             typename ParserT::embed_t p;
         };
+
+#if BOOST_WORKAROUND(BOOST_MSVC, >= 1400)
+#pragma warning(pop)
+#endif
 
 #if BOOST_SPIRIT_RULE_SCANNERTYPE_LIMIT > 1
 

Modified: branches/release/boost/spirit/home/classic/core/primitives/impl/numerics.ipp
==============================================================================
--- branches/release/boost/spirit/home/classic/core/primitives/impl/numerics.ipp (original)
+++ branches/release/boost/spirit/home/classic/core/primitives/impl/numerics.ipp 2009-09-14 12:50:29 EDT (Mon, 14 Sep 2009)
@@ -151,6 +151,11 @@
         // initialized before calling this function.
         //
         ///////////////////////////////////////////////////////////////////////
+#if defined(BOOST_MSVC)
+#pragma warning(push)
+#pragma warning(disable:4127) //conditional expression is constant
+#endif
+
         template <typename T, int Radix>
         struct positive_accumulate
         {
@@ -351,11 +356,6 @@
         // real_parser_impl class
         //
         ///////////////////////////////////////////////////////////////////////
-#if (defined(BOOST_MSVC) && (BOOST_MSVC <= 1310))
-#pragma warning(push)
-#pragma warning(disable:4127)
-#endif
-
         template <typename RT, typename T, typename RealPoliciesT>
         struct real_parser_impl
         {
@@ -464,7 +464,7 @@
             }
         };
 
-#if (defined(BOOST_MSVC) && (BOOST_MSVC <= 1310))
+#if defined(BOOST_MSVC)
 #pragma warning(pop)
 #endif
 

Modified: branches/release/boost/spirit/home/classic/dynamic.hpp
==============================================================================
--- branches/release/boost/spirit/home/classic/dynamic.hpp (original)
+++ branches/release/boost/spirit/home/classic/dynamic.hpp 2009-09-14 12:50:29 EDT (Mon, 14 Sep 2009)
@@ -23,6 +23,8 @@
 #include <boost/spirit/home/classic/dynamic/lazy.hpp>
 #include <boost/spirit/home/classic/dynamic/stored_rule.hpp>
 #include <boost/spirit/home/classic/dynamic/rule_alias.hpp>
+#include <boost/spirit/home/classic/dynamic/select.hpp>
+#include <boost/spirit/home/classic/dynamic/switch.hpp>
 
 ////////////////////////////////////////////////////////////////////////////////
 #endif // BOOST_SPIRIT_DYNAMIC_HPP

Modified: branches/release/boost/spirit/home/classic/meta/refactoring.hpp
==============================================================================
--- branches/release/boost/spirit/home/classic/meta/refactoring.hpp (original)
+++ branches/release/boost/spirit/home/classic/meta/refactoring.hpp 2009-09-14 12:50:29 EDT (Mon, 14 Sep 2009)
@@ -21,6 +21,11 @@
 
 BOOST_SPIRIT_CLASSIC_NAMESPACE_BEGIN
 
+#if BOOST_WORKAROUND(BOOST_MSVC, >= 1400)
+#pragma warning(push)
+#pragma warning(disable:4512) //assignment operator could not be generated
+#endif
+
 ///////////////////////////////////////////////////////////////////////////////
 //
 // refactor_unary_parser class
@@ -269,6 +274,10 @@
 
 const attach_action_gen<> attach_action_d = attach_action_gen<>();
 
+#if BOOST_WORKAROUND(BOOST_MSVC, >= 1400)
+#pragma warning(pop)
+#endif
+
 ///////////////////////////////////////////////////////////////////////////////
 BOOST_SPIRIT_CLASSIC_NAMESPACE_END
 

Modified: branches/release/boost/spirit/home/classic/phoenix/actor.hpp
==============================================================================
--- branches/release/boost/spirit/home/classic/phoenix/actor.hpp (original)
+++ branches/release/boost/spirit/home/classic/phoenix/actor.hpp 2009-09-14 12:50:29 EDT (Mon, 14 Sep 2009)
@@ -124,6 +124,11 @@
 };
 
 //////////////////////////////////
+#if BOOST_WORKAROUND(BOOST_MSVC, >= 1400)
+#pragma warning(push)
+#pragma warning(disable:4512) //assignment operator could not be generated
+#endif
+
 template <typename BaseT>
 struct actor : public BaseT {
 
@@ -270,6 +275,10 @@
     operator[](B const& b) const;
 };
 
+#if BOOST_WORKAROUND(BOOST_MSVC, >= 1400)
+#pragma warning(pop)
+#endif
+
 ///////////////////////////////////////////////////////////////////////////
 //
 // as_actor

Modified: branches/release/boost/spirit/home/classic/phoenix/closures.hpp
==============================================================================
--- branches/release/boost/spirit/home/classic/phoenix/closures.hpp (original)
+++ branches/release/boost/spirit/home/classic/phoenix/closures.hpp 2009-09-14 12:50:29 EDT (Mon, 14 Sep 2009)
@@ -21,6 +21,11 @@
 ///////////////////////////////////////////////////////////////////////////////
 namespace phoenix {
 
+#if BOOST_WORKAROUND(BOOST_MSVC, >= 1400)
+#pragma warning(push)
+#pragma warning(disable:4512) //assignment operator could not be generated
+#endif
+
 ///////////////////////////////////////////////////////////////////////////////
 //
 // Adaptable closures
@@ -431,6 +436,10 @@
     mutable holder_t frame;
 };
 
+#if BOOST_WORKAROUND(BOOST_MSVC, >= 1400)
+#pragma warning(pop)
+#endif
+
 }
    // namespace phoenix
 

Modified: branches/release/boost/spirit/home/classic/phoenix/composite.hpp
==============================================================================
--- branches/release/boost/spirit/home/classic/phoenix/composite.hpp (original)
+++ branches/release/boost/spirit/home/classic/phoenix/composite.hpp 2009-09-14 12:50:29 EDT (Mon, 14 Sep 2009)
@@ -14,6 +14,11 @@
 ///////////////////////////////////////////////////////////////////////////////
 namespace phoenix {
 
+#if BOOST_WORKAROUND(BOOST_MSVC, >= 1400)
+#pragma warning(push)
+#pragma warning(disable:4512) //assignment operator could not be generated
+#endif
+
 ///////////////////////////////////////////////////////////////////////////////
 //
 // composite class
@@ -1417,6 +1422,10 @@
 
 } // namespace impl
 
+#if BOOST_WORKAROUND(BOOST_MSVC, >= 1400)
+#pragma warning(pop)
+#endif
+
 } // namespace phoenix
 
 #endif

Modified: branches/release/boost/spirit/home/classic/phoenix/primitives.hpp
==============================================================================
--- branches/release/boost/spirit/home/classic/phoenix/primitives.hpp (original)
+++ branches/release/boost/spirit/home/classic/phoenix/primitives.hpp 2009-09-14 12:50:29 EDT (Mon, 14 Sep 2009)
@@ -196,6 +196,11 @@
 // a variable<T const&> object using a constant reference.
 //
 ///////////////////////////////////////////////////////////////////////////////
+#if BOOST_WORKAROUND(BOOST_MSVC, >= 1400)
+#pragma warning(push)
+#pragma warning(disable:4512) //assignment operator could not be generated
+#endif
+
 template <typename T>
 struct variable {
 
@@ -215,6 +220,10 @@
     T& var;
 };
 
+#if BOOST_WORKAROUND(BOOST_MSVC, >= 1400)
+#pragma warning(pop)
+#endif
+
 //////////////////////////////////
 template <typename T>
 inline actor<variable<T> > const

Modified: branches/release/boost/spirit/home/classic/phoenix/tuples.hpp
==============================================================================
--- branches/release/boost/spirit/home/classic/phoenix/tuples.hpp (original)
+++ branches/release/boost/spirit/home/classic/phoenix/tuples.hpp 2009-09-14 12:50:29 EDT (Mon, 14 Sep 2009)
@@ -60,6 +60,11 @@
 #include <boost/call_traits.hpp>
 #include <boost/type_traits/remove_reference.hpp>
 
+#if BOOST_WORKAROUND(BOOST_MSVC, >= 1400)
+#pragma warning(push)
+#pragma warning(disable:4512) //assignment operator could not be generated
+#endif
+
 ///////////////////////////////////////////////////////////////////////////////
 namespace phoenix {
 
@@ -1323,6 +1328,10 @@
 #endif
 #endif
 
+#if BOOST_WORKAROUND(BOOST_MSVC, >= 1400)
+#pragma warning(pop)
+#endif
+
 ///////////////////////////////////////////////////////////////////////////////
 } // namespace phoenix
 

Modified: branches/release/boost/spirit/home/classic/utility/confix.hpp
==============================================================================
--- branches/release/boost/spirit/home/classic/utility/confix.hpp (original)
+++ branches/release/boost/spirit/home/classic/utility/confix.hpp 2009-09-14 12:50:29 EDT (Mon, 14 Sep 2009)
@@ -36,6 +36,11 @@
 //
 ///////////////////////////////////////////////////////////////////////////////
 
+#if BOOST_WORKAROUND(BOOST_MSVC, >= 1400)
+#pragma warning(push)
+#pragma warning(disable:4512) //assignment operator could not be generated
+#endif
+
 template<typename NestedT = non_nested, typename LexemeT = non_lexeme>
 struct confix_parser_gen;
 
@@ -71,6 +76,10 @@
     typename as_parser<CloseT>::type::embed_t close;
 };
 
+#if BOOST_WORKAROUND(BOOST_MSVC, >= 1400)
+#pragma warning(pop)
+#endif
+
 ///////////////////////////////////////////////////////////////////////////////
 //
 // Confix parser generator template

Modified: branches/release/boost/spirit/home/classic/utility/rule_parser.hpp
==============================================================================
--- branches/release/boost/spirit/home/classic/utility/rule_parser.hpp (original)
+++ branches/release/boost/spirit/home/classic/utility/rule_parser.hpp 2009-09-14 12:50:29 EDT (Mon, 14 Sep 2009)
@@ -419,7 +419,7 @@
           BOOST_SPIRIT_RP_EMIT(MV_STATIC,mbrs,BOOST_PP_IDENTITY(typename)) \
         public: \
           BOOST_TYPEOF_NESTED_TYPEDEF_TPL(__expr, \
- ::BOOST_SPIRIT_CLASSIC_NS::type_of::depend_on_type<__Dummy>(x) ) \
+ ::BOOST_SPIRIT_CLASSIC_NS::type_of::depend_on_type<__Dummy>(x) ) \
         }; \
                                                                                \
       public: \

Modified: branches/release/boost/spirit/home/karma.hpp
==============================================================================
--- branches/release/boost/spirit/home/karma.hpp (original)
+++ branches/release/boost/spirit/home/karma.hpp 2009-09-14 12:50:29 EDT (Mon, 14 Sep 2009)
@@ -6,8 +6,8 @@
 #if !defined(SPIRIT_KARMA_CORE_MARCH_06_2007_0833PM)
 #define SPIRIT_KARMA_CORE_MARCH_06_2007_0833PM
 
-#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/char.hpp>
@@ -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: branches/release/boost/spirit/home/karma/action.hpp
==============================================================================
--- branches/release/boost/spirit/home/karma/action.hpp (original)
+++ branches/release/boost/spirit/home/karma/action.hpp 2009-09-14 12:50:29 EDT (Mon, 14 Sep 2009)
@@ -6,11 +6,10 @@
 #if !defined(BOOST_SPIRIT_KARMA_ACTION_MAR_04_2007_0912AM)
 #define BOOST_SPIRIT_KARMA_ACTION_MAR_04_2007_0912AM
 
-#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/action/action.hpp>
-#include <boost/spirit/home/karma/action/meta_grammar.hpp>
 
 #endif

Modified: branches/release/boost/spirit/home/karma/action/action.hpp
==============================================================================
--- branches/release/boost/spirit/home/karma/action/action.hpp (original)
+++ branches/release/boost/spirit/home/karma/action/action.hpp 2009-09-14 12:50:29 EDT (Mon, 14 Sep 2009)
@@ -6,84 +6,112 @@
 #if !defined(BOOST_SPIRIT_KARMA_ACTION_MAR_07_2007_0851AM)
 #define BOOST_SPIRIT_KARMA_ACTION_MAR_07_2007_0851AM
 
-#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/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>
+ typedef Subject subject_type;
+ typedef typename subject_type::properties properties;
+
+ template <typename Context, typename Iterator>
         struct attribute
- : traits::attribute_of<
- karma::domain,
- typename result_of::left<Component>::type,
- Context
- >
- {
- };
+ : traits::attribute_of<Subject, Context, Iterator>
+ {};
 
- 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_type 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: branches/release/boost/spirit/home/karma/action/meta_grammar.hpp
==============================================================================
--- branches/release/boost/spirit/home/karma/action/meta_grammar.hpp 2009-09-14 12:50:29 EDT (Mon, 14 Sep 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: branches/release/boost/spirit/home/karma/auxiliary.hpp
==============================================================================
--- branches/release/boost/spirit/home/karma/auxiliary.hpp (original)
+++ branches/release/boost/spirit/home/karma/auxiliary.hpp 2009-09-14 12:50:29 EDT (Mon, 14 Sep 2009)
@@ -6,13 +6,12 @@
 #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>
+#if defined(_MSC_VER)
+#pragma once
+#endif
+
 #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>
 
 #endif

Deleted: branches/release/boost/spirit/home/karma/auxiliary/confix.hpp
==============================================================================
--- branches/release/boost/spirit/home/karma/auxiliary/confix.hpp 2009-09-14 12:50:29 EDT (Mon, 14 Sep 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: branches/release/boost/spirit/home/karma/auxiliary/eol.hpp
==============================================================================
--- branches/release/boost/spirit/home/karma/auxiliary/eol.hpp (original)
+++ branches/release/boost/spirit/home/karma/auxiliary/eol.hpp 2009-09-14 12:50:29 EDT (Mon, 14 Sep 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,36 +6,71 @@
 #if !defined(BOOST_SPIRIT_KARMA_EOL_JUL_08_2008_1014AM)
 #define BOOST_SPIRIT_KARMA_EOL_JUL_08_2008_1014AM
 
-#include <boost/spirit/home/karma/domain.hpp>
-#include <boost/spirit/home/karma/delimit.hpp>
+#if defined(_MSC_VER)
+#pragma once
+#endif
+
+#include <boost/spirit/home/support/common_terminals.hpp>
+#include <boost/spirit/home/support/info.hpp>
 #include <boost/spirit/home/support/unused.hpp>
+#include <boost/spirit/home/support/attributes.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/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
 {
- struct eol_generator
+ using boost::spirit::eol;
+ using boost::spirit::eoi_type;
+
+ struct eol_generator : primitive_generator<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)
+ {
+ return detail::generate_to(sink, '\n') &&
+ karma::delimit_out(sink, d); // always do post-delimiting
+ }
+
+ template <typename Context>
+ info what(Context const& ctx) const
         {
- detail::generate_to(sink, '\n');
- karma::delimit(sink, d); // always do post-delimiting
- return true;
+ return info("eol");
         }
+ };
 
- template <typename Component, typename Context>
- static std::string what(Component const& component, Context const& ctx)
+ ///////////////////////////////////////////////////////////////////////////
+ // 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: branches/release/boost/spirit/home/karma/auxiliary/eps.hpp
==============================================================================
--- branches/release/boost/spirit/home/karma/auxiliary/eps.hpp (original)
+++ branches/release/boost/spirit/home/karma/auxiliary/eps.hpp 2009-09-14 12:50:29 EDT (Mon, 14 Sep 2009)
@@ -6,60 +6,127 @@
 #if !defined(BOOST_SPIRIT_KARMA_EPS_APRIL_21_2007_0246PM)
 #define BOOST_SPIRIT_KARMA_EPS_APRIL_21_2007_0246PM
 
+#if defined(_MSC_VER)
+#pragma once
+#endif
+
+#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
 {
- struct eps_generator
+ using boost::spirit::eps;
+ using boost::spirit::eps_type;
+
+ struct eps_generator : primitive_generator<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
+ struct semantic_predicate : primitive_generator<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) const
+ {
+ // only do post-delimiting when predicate is true
+ return predicate_ && karma::delimit_out(sink, d);
+ }
+
+ template <typename Context>
+ info what(Context const& ctx) const
         {
- karma::delimit(sink, d);
- return fusion::at_c<0>(component.elements)(unused, ctx);
+ return info("semantic-predicate");
         }
 
- template <typename Component, typename Context>
- static std::string what(Component const& component, Context const& ctx)
+ 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
+ {
+ 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));
         }
     };
 

Deleted: branches/release/boost/spirit/home/karma/auxiliary/functor.hpp
==============================================================================
--- branches/release/boost/spirit/home/karma/auxiliary/functor.hpp 2009-09-14 12:50:29 EDT (Mon, 14 Sep 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: branches/release/boost/spirit/home/karma/auxiliary/functor_director.hpp
==============================================================================
--- branches/release/boost/spirit/home/karma/auxiliary/functor_director.hpp 2009-09-14 12:50:29 EDT (Mon, 14 Sep 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: branches/release/boost/spirit/home/karma/auxiliary/lazy.hpp
==============================================================================
--- branches/release/boost/spirit/home/karma/auxiliary/lazy.hpp (original)
+++ branches/release/boost/spirit/home/karma/auxiliary/lazy.hpp 2009-09-14 12:50:29 EDT (Mon, 14 Sep 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,222 @@
 #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;
+ typedef modify<karma::domain> karma_modify;
+
+ template <typename Function, typename Modifiers>
+ struct lazy_generator : generator<lazy_generator<Function, Modifiers> >
     {
- template <typename Component, typename Context, typename Unused>
+ typedef mpl::int_<generator_properties::all_properties> properties;
+
+ template <typename Context, typename Iterator>
         struct attribute
         {
             typedef typename
- result_of::subject<Component>::type
- subject_type;
+ boost::result_of<karma_modify(tag::lazy_eval, Modifiers)>::type
+ modifier;
 
             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, modifier>::type
+ generator_type;
 
             typedef typename
- traits::attribute_of<
- karma::domain, component_type, Context>::type
+ traits::attribute_of<generator_type, Context, Iterator>::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, Modifiers const& modifiers)
+ : func(func), modifiers(modifiers) {}
+
+ template <
+ typename OutputIterator, typename Context,
+ typename Delimiter, typename Attribute
+ >
+ bool generate(OutputIterator& sink, Context& context,
+ Delimiter const& d, Attribute const& attr) const
+ {
+ return compile<karma::domain>(func(unused, context)
+ , karma_modify()(tag::lazy_eval(), modifiers))
+ .generate(sink, context, d, attr);
+ }
+
+ template <typename Context>
+ info what(Context& context) const
+ {
+ return info("lazy"
+ , compile<karma::domain>(func(unused, context)
+ , karma_modify()(tag::lazy_eval(), modifiers))
+ .what(context)
+ );
+ }
+
+ Function func;
+ Modifiers modifiers;
+ };
+
+ ///////////////////////////////////////////////////////////////////////////
+ template <typename Function, typename Subject, typename Modifiers>
+ struct lazy_directive
+ : unary_generator<lazy_directive<Function, Subject, Modifiers> >
+ {
+ typedef mpl::int_<generator_properties::all_properties> properties;
+
+ typedef Subject subject_type;
+
+ template <typename Context, typename Iterator>
+ struct attribute
         {
             typedef typename
- result_of::subject<Component>::type
- subject_type;
+ boost::result_of<karma_modify(tag::lazy_eval, Modifiers)>::type
+ modifier;
 
             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::as_component<karma::domain, expr_type>::type
- component_type;
+ result_of::compile<karma::domain, expr_type, modifier>::type
+ generator_type;
 
- 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;
+ typedef typename
+ traits::attribute_of<generator_type, Context, Iterator>::type
+ type;
+ };
+
+ lazy_directive(Function const& function, Subject const& subject
+ , Modifiers const& modifiers)
+ : function(function), subject(subject), modifiers(modifiers) {}
+
+ 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)
+ , karma_modify()(tag::lazy_eval(), modifiers))
+ .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)
+ , karma_modify()(tag::lazy_eval(), modifiers))
+ .what(ctx)
+ );
+ }
+
+ Function function;
+ Subject subject;
+ Modifiers modifiers;
     };
+
+ ///////////////////////////////////////////////////////////////////////////
+ // Generator generators: make_xxx function (objects)
+ ///////////////////////////////////////////////////////////////////////////
+ template <typename Eval, typename Modifiers>
+ struct make_primitive<phoenix::actor<Eval>, Modifiers>
+ {
+ typedef lazy_generator<phoenix::actor<Eval>, Modifiers> result_type;
+ result_type operator()(phoenix::actor<Eval> const& f
+ , Modifiers const& modifiers) const
+ {
+ return result_type(f, modifiers);
+ }
+ };
+
+ template <typename Terminal, typename Actor, int Arity, typename Modifiers>
+ struct make_primitive<lazy_terminal<Terminal, Actor, Arity>, Modifiers>
+ {
+ typedef lazy_generator<Actor, Modifiers> result_type;
+ result_type operator()(
+ lazy_terminal<Terminal, Actor, Arity> const& lt
+ , Modifiers const& modifiers) const
+ {
+ return result_type(lt.actor, modifiers);
+ }
+ };
+
+ 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, Modifiers> result_type;
+ result_type operator()(
+ lazy_terminal<Terminal, Actor, Arity> const& lt
+ , Subject const& subject, Modifiers const& modifiers) const
+ {
+ return result_type(lt.actor, subject, modifiers);
+ }
+ };
+
 }}}
 
 #endif

Deleted: branches/release/boost/spirit/home/karma/auxiliary/meta_grammar.hpp
==============================================================================
--- branches/release/boost/spirit/home/karma/auxiliary/meta_grammar.hpp 2009-09-14 12:50:29 EDT (Mon, 14 Sep 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: branches/release/boost/spirit/home/karma/auxiliary/none.hpp
==============================================================================
--- branches/release/boost/spirit/home/karma/auxiliary/none.hpp 2009-09-14 12:50:29 EDT (Mon, 14 Sep 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: branches/release/boost/spirit/home/karma/binary.hpp
==============================================================================
--- branches/release/boost/spirit/home/karma/binary.hpp (original)
+++ branches/release/boost/spirit/home/karma/binary.hpp 2009-09-14 12:50:29 EDT (Mon, 14 Sep 2009)
@@ -6,12 +6,11 @@
 #if !defined(BOOST_SPIRIT_KARMA_BINARY_MAY_04_2007_0859AM)
 #define BOOST_SPIRIT_KARMA_BINARY_MAY_04_2007_0859AM
 
-#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/binary/binary.hpp>
 #include <boost/spirit/home/karma/binary/padding.hpp>
-#include <boost/spirit/home/karma/binary/meta_grammar.hpp>
 
 #endif

Modified: branches/release/boost/spirit/home/karma/binary/binary.hpp
==============================================================================
--- branches/release/boost/spirit/home/karma/binary/binary.hpp (original)
+++ branches/release/boost/spirit/home/karma/binary/binary.hpp 2009-09-14 12:50:29 EDT (Mon, 14 Sep 2009)
@@ -6,30 +6,102 @@
 #if !defined(BOOST_SPIRIT_KARMA_BINARY_MAY_04_2007_0904AM)
 #define BOOST_SPIRIT_KARMA_BINARY_MAY_04_2007_0904AM
 
-#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/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(little_word) // enables little_word
+ BOOST_SPIRIT_ENABLE_BINARY(dword) // enables dword
+ 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::byte__type;
+ using boost::spirit::word;
+ using boost::spirit::word_type;
+ using boost::spirit::big_word;
+ using boost::spirit::big_word_type;
+ using boost::spirit::little_word;
+ using boost::spirit::little_word_type;
+ using boost::spirit::dword;
+ using boost::spirit::dword_type;
+ using boost::spirit::big_dword;
+ using boost::spirit::big_dword_type;
+ using boost::spirit::little_dword;
+ using boost::spirit::little_dword_type;
+#ifdef BOOST_HAS_LONG_LONG
+ using boost::spirit::qword;
+ using boost::spirit::qword_type;
+ using boost::spirit::big_qword;
+ using boost::spirit::big_qword_type;
+ using boost::spirit::little_qword;
+ using boost::spirit::little_qword_type;
+#endif
+
     namespace detail
     {
         template <int bits>
         struct integer
         {
 #ifdef BOOST_HAS_LONG_LONG
- BOOST_MPL_ASSERT_MSG(
+ BOOST_SPIRIT_ASSERT_MSG(
                 bits == 8 || bits == 16 || bits == 32 || bits == 64,
                 not_supported_binary_size, ());
 #else
- BOOST_MPL_ASSERT_MSG(
+ BOOST_SPIRIT_ASSERT_MSG(
                 bits == 8 || bits == 16 || bits == 32,
                 not_supported_binary_size, ());
 #endif
@@ -62,124 +134,200 @@
 #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
+ : primitive_generator<any_binary_generator<endian, bits> >
     {
- template <typename Component, typename Context, typename Unused>
- struct attribute
- {
- typedef boost::integer::endian<
+ template <typename Context, typename Unused = unused_type>
+ struct attribute
+ : karma::detail::integer<bits>
+ {};
+
+ 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.
+ boost::integer::endian<
                 endian, typename karma::detail::integer<bits>::type, bits
- > 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);
+ > 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,
+ BOOST_SPIRIT_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>
+ struct literal_binary_generator
+ : primitive_generator<literal_binary_generator<endian, bits> >
     {
- 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 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();
         }
+
+ typedef boost::integer::endian<
+ endian, typename karma::detail::integer<bits>::type, bits
+ > data_type;
+
+ 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
+ {
+ typedef literal_binary_generator<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> \
+ : 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(big_word, big, 16)
+ BOOST_SPIRIT_MAKE_BINARY_PRIMITIVE(little_word, little, 16)
+ BOOST_SPIRIT_MAKE_BINARY_PRIMITIVE(dword, native, 32)
+ BOOST_SPIRIT_MAKE_BINARY_PRIMITIVE(big_dword, big, 32)
+ 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: branches/release/boost/spirit/home/karma/binary/meta_grammar.hpp
==============================================================================
--- branches/release/boost/spirit/home/karma/binary/meta_grammar.hpp 2009-09-14 12:50:29 EDT (Mon, 14 Sep 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: branches/release/boost/spirit/home/karma/binary/padding.hpp
==============================================================================
--- branches/release/boost/spirit/home/karma/binary/padding.hpp (original)
+++ branches/release/boost/spirit/home/karma/binary/padding.hpp 2009-09-14 12:50:29 EDT (Mon, 14 Sep 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,51 +6,105 @@
 #if !defined(BOOST_SPIRIT_KARMA_PADDING_MAY_06_2008_0436PM)
 #define BOOST_SPIRIT_KARMA_PADDING_MAY_06_2008_0436PM
 
-#include <boost/lexical_cast.hpp>
+#if defined(_MSC_VER)
+#pragma once
+#endif
+
+#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
+ : primitive_generator<binary_padding_generator>
     {
- template <typename Component, typename Context, typename Unused>
+ typedef mpl::int_<generator_properties::tracking> properties;
+
+ 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: branches/release/boost/spirit/home/karma/char.hpp
==============================================================================
--- branches/release/boost/spirit/home/karma/char.hpp (original)
+++ branches/release/boost/spirit/home/karma/char.hpp 2009-09-14 12:50:29 EDT (Mon, 14 Sep 2009)
@@ -6,12 +6,11 @@
 #if !defined(BOOST_SPIRIT_KARMA_CHAR_FEB_21_2007_0547PM)
 #define BOOST_SPIRIT_KARMA_CHAR_FEB_21_2007_0547PM
 
-#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/char/char.hpp>
-#include <boost/spirit/home/karma/char/space.hpp>
-#include <boost/spirit/home/karma/char/meta_grammar.hpp>
+#include <boost/spirit/home/karma/char/char_class.hpp>
 
 #endif

Modified: branches/release/boost/spirit/home/karma/char/char.hpp
==============================================================================
--- branches/release/boost/spirit/home/karma/char/char.hpp (original)
+++ branches/release/boost/spirit/home/karma/char/char.hpp 2009-09-14 12:50:29 EDT (Mon, 14 Sep 2009)
@@ -6,71 +6,134 @@
 #if !defined(BOOST_SPIRIT_KARMA_CHAR_FEB_21_2007_0543PM)
 #define BOOST_SPIRIT_KARMA_CHAR_FEB_21_2007_0543PM
 
-#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/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/support/char_set/basic_chset.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/char/char_generator.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, typename A0, typename A1>
+ struct use_terminal<karma::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<
+ 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
- // generates a single character from the associated parameter
+ // generates a single character from the associated attribute
     //
- // Note: this generator has to have an associated parameter
+ // Note: this generator has to have an associated attribute
     //
     ///////////////////////////////////////////////////////////////////////////
- template <typename Char>
+ template <typename CharEncoding, typename Tag>
     struct any_char
+ : char_generator<any_char<CharEncoding, Tag>, 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)
+ // any_char has an attached parameter
+ template <typename Attribute, typename CharParam, typename Context>
+ bool test(Attribute const& attr, CharParam& ch, Context&) const
         {
- detail::generate_to(sink, param);
- karma::delimit(sink, d); // always do post-delimiting
+ ch = attr;
             return true;
         }
 
- // 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 CharParam, typename Context>
+ bool test(unused_type, CharParam&, Context&) const
         {
- BOOST_MPL_ASSERT_MSG(false, char__not_usable_without_attribute, ());
+ // 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_SPIRIT_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 +144,332 @@
     // from
     //
     ///////////////////////////////////////////////////////////////////////////
- template <typename Char>
+ template <typename CharEncoding, typename Tag, bool no_attribute>
     struct literal_char
+ : char_generator<literal_char<CharEncoding, Tag, no_attribute>
+ , CharEncoding, Tag>
     {
- template <typename Component, typename Context, typename Unused>
+ typedef typename CharEncoding::char_type char_type;
+ typedef CharEncoding char_encoding;
+
+ literal_char(char_type ch)
+ : ch (spirit::char_class::convert<char_encoding>::to(Tag(), ch))
+ {}
+
+ template <typename Context, typename Unused>
         struct attribute
- {
- typedef unused_type type;
- };
+ : mpl::if_c<no_attribute, unused_type, char_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*/)
+ // A char_('x') which additionally has an associated attribute emits
+ // its immediate literal only if it matches the attribute, otherwise
+ // it fails.
+ // any_char has an attached parameter
+ template <typename Attribute, typename CharParam, typename Context>
+ bool test(Attribute const& attr, CharParam& ch_, Context&) const
+ {
+ // fail if attribute isn't matched my immediate literal
+ ch_ = attr;
+ return attr == ch;
+ }
+
+ // A char_('x') without any associated attribute just emits its
+ // immediate literal
+ template <typename CharParam, typename Context>
+ bool test(unused_type, CharParam& ch_, Context&) const
         {
- detail::generate_to(sink, fusion::at_c<0>(component.elements));
- karma::delimit(sink, d); // always do post-delimiting
+ ch_ = ch;
             return true;
         }
 
- 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 std::string("'")
- + spirit::detail::to_narrow_char(
- fusion::at_c<0>(component.elements))
- + '\'';
+ return info("literal-char", char_encoding::toucs4(ch));
         }
+
+ char_type ch;
     };
 
     ///////////////////////////////////////////////////////////////////////////
- //
- // lazy_char
- // generates a single character given by a functor it was initialized
- // from
- //
- ///////////////////////////////////////////////////////////////////////////
- struct lazy_char
+ // char range generator
+ template <typename CharEncoding, typename Tag>
+ struct char_range
+ : char_generator<char_range<CharEncoding, Tag>, CharEncoding, Tag>
     {
- 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)(unused, ctx));
- karma::delimit(sink, d); // always do post-delimiting
- return true;
+ char_range(char_type from, char_type to)
+ : from(spirit::char_class::convert<char_encoding>::to(Tag(), from))
+ , to(spirit::char_class::convert<char_encoding>::to(Tag(), to))
+ {}
+
+ // A char_('a', 'z') which has an associated attribute emits it only if
+ // it matches the character range, otherwise it fails.
+ template <typename Attribute, typename CharParam, typename Context>
+ bool test(Attribute const& attr, CharParam& ch, Context&) const
+ {
+ // fail if attribute doesn't belong to character range
+ ch = attr;
+ return (from <= char_type(attr)) && (char_type(attr) <= to);
+ }
+
+ // A char_('a', 'z') without any associated attribute fails compiling
+ template <typename CharParam, typename Context>
+ bool test(unused_type, CharParam&, Context&) const
+ {
+ BOOST_SPIRIT_ASSERT_MSG(false
+ , char_range_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
         {
- return "char";
+ 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;
     };
 
     ///////////////////////////////////////////////////////////////////////////
- //
- // lower and upper case variants of any_char with an associated parameter
- // note: this generator has to have a parameter associated
- //
- ///////////////////////////////////////////////////////////////////////////
- template <typename Char, typename Tag>
- struct case_any_char
+ // character set generator
+ template <typename CharEncoding, typename Tag>
+ struct char_set
+ : char_generator<char_set<CharEncoding, Tag>, CharEncoding, Tag>
     {
- template <typename Component, typename Context, typename Unused>
- struct attribute
- {
- typedef Char type;
- };
-
- typedef typename Tag::char_set char_set;
- typedef typename Tag::char_class char_class_;
+ typedef typename CharEncoding::char_type char_type;
+ typedef CharEncoding char_encoding;
 
- // 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;
- }
+ template <typename String>
+ char_set(String const& str)
+ {
+ typedef typename traits::char_type_of<String>::type in_type;
 
- // 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_SPIRIT_ASSERT_MSG((
+ (sizeof(char_type) == sizeof(in_type))
+ ), cannot_convert_string, (String));
+
+ typedef spirit::char_class::convert<char_encoding> convert_type;
+
+ char_type const* definition =
+ (char_type const*)traits::get_c_string(str);
+ char_type ch = convert_type::to(Tag(), *definition++);
+ while (ch)
+ {
+ char_type next = convert_type::to(Tag(), *definition++);
+ if (next == '-')
+ {
+ next = convert_type::to(Tag(), *definition++);
+ if (next == 0)
+ {
+ chset.set(ch);
+ chset.set('-');
+ break;
+ }
+ chset.set(ch, next);
+ }
+ else
+ {
+ chset.set(ch);
+ }
+ ch = next;
+ }
+ }
+
+ // A char_("a-z") which has an associated attribute emits it only if
+ // it matches the character set, otherwise it fails.
+ template <typename Attribute, typename CharParam, typename Context>
+ bool test(Attribute const& attr, CharParam& ch, Context&) const
+ {
+ // fail if attribute doesn't belong to character set
+ ch = attr;
+ return chset.test(char_type(attr));
+ }
+
+ // A char_("a-z") without any associated attribute fails compiling
+ template <typename CharParam, typename Context>
+ bool test(unused_type, CharParam&, Context&) const
         {
- BOOST_MPL_ASSERT_MSG(false, char__not_usable_without_attribute, ());
+ BOOST_SPIRIT_ASSERT_MSG(false
+ , char_set_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;
- result = std::string("any-") +
- spirit::char_class::what<char_set>::is(char_class_()) +
- "case-char";
- return result;
+ return info("char-set");
         }
- };
 
-}}} // namespace boost::spirit::karma
+ support::detail::basic_chset<char_type> chset;
+ };
 
-namespace boost { namespace spirit { namespace traits
-{
     ///////////////////////////////////////////////////////////////////////////
- // lower_case and upper_case any_char and literal_char generators
+ // Generator generators: make_xxx function (objects)
     ///////////////////////////////////////////////////////////////////////////
- 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
- >
+ namespace detail
     {
- 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);
+ template <typename Modifiers, typename Encoding>
+ struct basic_literal
+ {
+ 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 literal_char<
+ typename spirit::detail::get_encoding<
+ Modifiers, Encoding, lower || upper>::type
+ , typename get_casetag<Modifiers, lower || upper>::type
+ , true>
+ 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<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;
+ static bool const upper =
+ has_modifier<Modifiers, tag::char_code<tag::upper, CharEncoding> >::value;
+
+ typedef any_char<
+ typename spirit::detail::get_encoding<
+ Modifiers, CharEncoding, lower || upper>::type
+ , typename detail::get_casetag<Modifiers, lower || upper>::type
+ > result_type;
+
+ 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_char<Char>, Elements, Modifier,
- typename enable_if<
- is_member_of_modifier<Modifier, spirit::char_class::upper_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::toupper(ch));
- return type(v);
+ 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 typename spirit::detail::get_encoding<
+ Modifiers, CharEncoding, lower || upper>::type encoding;
+ typedef typename detail::get_casetag<
+ Modifiers, lower || upper>::type tag;
+
+ typedef typename mpl::if_<
+ traits::is_string<A0>
+ , char_set<encoding, tag>
+ , literal_char<encoding, tag, false>
+ >::type result_type;
+
+ template <typename Terminal>
+ result_type operator()(Terminal const& term, unused_type) const
+ {
+ return result_type(fusion::at_c<0>(term.args));
         }
     };
 
- ///////////////////////////////////////////////////////////////////////////
- // 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
- >
+ // 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::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 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 literal_char<
+ typename spirit::detail::get_encoding<
+ Modifiers, CharEncoding, lower || upper>::type
+ , typename detail::get_casetag<Modifiers, lower || upper>::type
+ , false
+ > 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)[0]);
         }
     };
 
- 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_('a', 'z')
+ 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>
     {
- 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 bool const upper =
+ has_modifier<Modifiers, tag::char_code<tag::upper, CharEncoding> >::value;
+
+ typedef char_range<
+ typename spirit::detail::get_encoding<
+ Modifiers, CharEncoding, lower || upper>::type
+ , typename detail::get_casetag<Modifiers, lower || upper>::type
+ > 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)
+ , fusion::at_c<1>(term.args));
         }
     };
 
-}}} // namespace boost::spirit::traits
+}}} // namespace boost::spirit::karma
 
-#endif // !defined(BOOST_SPIRIT_KARMA_CHAR_FEB_21_2007_0543PM)
+#endif

Deleted: branches/release/boost/spirit/home/karma/char/meta_grammar.hpp
==============================================================================
--- branches/release/boost/spirit/home/karma/char/meta_grammar.hpp 2009-09-14 12:50:29 EDT (Mon, 14 Sep 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

Deleted: branches/release/boost/spirit/home/karma/char/space.hpp
==============================================================================
--- branches/release/boost/spirit/home/karma/char/space.hpp 2009-09-14 12:50:29 EDT (Mon, 14 Sep 2009)
+++ (empty file)
@@ -1,116 +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_SPACE_MAR_06_2007_0934PM)
-#define BOOST_SPIRIT_KARMA_SPACE_MAR_06_2007_0934PM
-
-#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/delimit.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 { namespace karma
-{
- ///////////////////////////////////////////////////////////////////////////
- //
- // space
- // generates a single character from the associated parameter
- //
- ///////////////////////////////////////////////////////////////////////////
- template <typename Tag, typename Char>
- struct any_space_char
- {
- template <typename Component, typename Context, typename Unused>
- struct attribute
- {
- typedef Char 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;
- }
-
- // 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;
- }
-
- template <typename Component, typename Context>
- static std::string what(Component const& component, Context const& ctx)
- {
- return "any-space";
- }
- };
-
- ///////////////////////////////////////////////////////////////////////////
- //
- // space(...)
- // generates a single space character given by a literal it was
- // initialized from
- //
- ///////////////////////////////////////////////////////////////////////////
- template <typename Tag, typename Char>
- struct literal_space_char
- {
- 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;
- }
-
- template <typename Component, typename Context>
- static std::string what(Component const& component, Context const& ctx)
- {
- return std::string("space('")
- + spirit::detail::to_narrow_char(
- fusion::at_c<0>(component.elements))
- + "')";
- }
- };
-
-}}} // namespace boost::spirit::karma
-
-#endif // !defined(BOOST_SPIRIT_KARMA_CHAR_FEB_21_2007_0543PM)

Deleted: branches/release/boost/spirit/home/karma/delimit.hpp
==============================================================================
--- branches/release/boost/spirit/home/karma/delimit.hpp 2009-09-14 12:50:29 EDT (Mon, 14 Sep 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
-

Modified: branches/release/boost/spirit/home/karma/detail/generate_to.hpp
==============================================================================
--- branches/release/boost/spirit/home/karma/detail/generate_to.hpp (original)
+++ branches/release/boost/spirit/home/karma/detail/generate_to.hpp 2009-09-14 12:50:29 EDT (Mon, 14 Sep 2009)
@@ -3,56 +3,65 @@
 // Distributed under the 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
+#if defined(_MSC_VER)
+#pragma once
 #endif
 
 #include <boost/spirit/home/support/unused.hpp>
 #include <boost/spirit/home/support/char_class.hpp>
+#include <boost/spirit/home/karma/detail/output_iterator.hpp>
 
 namespace boost { namespace spirit { namespace karma { namespace detail
 {
     ///////////////////////////////////////////////////////////////////////////
     // 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 detail::sink_is_good(sink);
     }
 
- 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 detail::sink_is_good(sink);
     }
 
- 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 detail::sink_is_good(sink);
+ }
+
     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

Deleted: branches/release/boost/spirit/home/karma/detail/ostream_iterator.hpp
==============================================================================
--- branches/release/boost/spirit/home/karma/detail/ostream_iterator.hpp 2009-09-14 12:50:29 EDT (Mon, 14 Sep 2009)
+++ (empty file)
@@ -1,57 +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_OSTREAM_ITERATOR_MAY_26_2007_1016PM)
-#define BOOST_SPIRIT_KARMA_OSTREAM_ITERATOR_MAY_26_2007_1016PM
-
-#include <iterator>
-
-///////////////////////////////////////////////////////////////////////////////
-namespace boost { namespace spirit { namespace karma { namespace detail
-{
- ///////////////////////////////////////////////////////////////////////////
- // We need our own implementation of an ostream_iterator just to be able
- // to access the wrapped ostream, which is necessary for the
- // stream_director, where we must generate the output using the original
- // ostream to retain possibly registered facets.
- ///////////////////////////////////////////////////////////////////////////
- template <
- 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>
- {
- public:
- typedef Elem char_type;
- 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_) {}
-
- self_type& operator= (T const& val)
- {
- *os << val;
- if (0 != delim)
- *os << delim;
- return *this;
- }
-
- self_type& operator*() { return *this; }
- self_type& operator++() { return *this; }
- self_type operator++(int) { return *this; }
-
- ostream_type& get_ostream() { return *os; }
-
- protected:
- ostream_type *os;
- Elem const* delim;
- };
-
-}}}}
-
-#endif

Modified: branches/release/boost/spirit/home/karma/detail/output_iterator.hpp
==============================================================================
--- branches/release/boost/spirit/home/karma/detail/output_iterator.hpp (original)
+++ branches/release/boost/spirit/home/karma/detail/output_iterator.hpp 2009-09-14 12:50:29 EDT (Mon, 14 Sep 2009)
@@ -6,16 +6,21 @@
 #if !defined(BOOST_SPIRIT_KARMA_OUTPUT_ITERATOR_MAY_26_2007_0506PM)
 #define BOOST_SPIRIT_KARMA_OUTPUT_ITERATOR_MAY_26_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 <iterator>
 #include <vector>
 #include <algorithm>
 
+#include <boost/config.hpp>
 #include <boost/noncopyable.hpp>
-#include <boost/spirit/home/karma/detail/ostream_iterator.hpp>
+#include <boost/mpl/if.hpp>
+
+#include <boost/spirit/home/karma/generator.hpp>
+#include <boost/spirit/home/karma/stream/ostream_iterator.hpp>
+#include <boost/spirit/home/support/unused.hpp>
 
 namespace boost { namespace spirit { namespace karma { namespace detail
 {
@@ -25,9 +30,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 +56,114 @@
     };
 
     ///////////////////////////////////////////////////////////////////////////
- // This class is used to count the umber of characters streamed into the
+ struct position_policy
+ {
+ position_policy() {}
+ position_policy(position_policy const& rhs)
+ : track_position_data(rhs.track_position_data) {}
+
+ template <typename T>
+ void output(T const& value)
+ {
+ // track position in the output
+ track_position_data.output(value);
+ }
+
+ // return the current count in the output
+ std::size_t get_out_count() const
+ {
+ return track_position_data.get_count();
+ }
+
+ private:
+ position_sink track_position_data; // for position tracking
+ };
+
+ struct no_position_policy
+ {
+ no_position_policy() {}
+ no_position_policy(no_position_policy const& rhs) {}
+
+ template <typename T>
+ void output(T const& value) {}
+ };
+
+ ///////////////////////////////////////////////////////////////////////////
+ // 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)
+ : count(count_), initial_count(count), prev_count(0), sink(sink_)
+ {
+ prev_count = sink.chain_counting(enabled ? this : NULL);
+ }
+ ~counting_sink()
+ {
+ if (prev_count) // propagate count
+ prev_count->update_count(count-initial_count);
+ sink.chain_counting(prev_count);
+ }
+
+ void output()
+ {
+ ++count;
+ }
         std::size_t get_count() const { return count; }
 
+ // propagate count from embedded counters
+ void update_count(std::size_t c)
+ {
+ count += c;
+ }
+
     private:
         std::size_t count;
+ std::size_t initial_count;
+ counting_sink* prev_count; // previous counter in chain
+ OutputIterator& sink;
+ };
+
+ ///////////////////////////////////////////////////////////////////////////
+ template <typename OutputIterator>
+ struct counting_policy
+ {
+ public:
+ counting_policy() : count(NULL) {}
+ counting_policy(counting_policy const& rhs) : count(rhs.count) {}
+
+ // functions related to counting
+ counting_sink<OutputIterator>* chain_counting(
+ counting_sink<OutputIterator>* count_data)
+ {
+ counting_sink<OutputIterator>* prev_count = count;
+ count = count_data;
+ return prev_count;
+ }
+
+ template <typename T>
+ void output(T const&)
+ {
+ // count characters, if appropriate
+ if (NULL != count)
+ count->output();
+ }
+
+ private:
+ counting_sink<OutputIterator>* count; // for counting
+ };
+
+ struct no_counting_policy
+ {
+ no_counting_policy() {}
+ no_counting_policy(no_counting_policy const& rhs) {}
+
+ template <typename T>
+ void output(T const& value) {}
     };
 
     ///////////////////////////////////////////////////////////////////////////
@@ -82,10 +179,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 +193,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 init(std::size_t width_) { width = width_; }
- void tidy() { delete buffer; buffer = 0; width = 0; }
-
+
+ void enable(std::size_t width_)
+ {
+ tidy(); // release existing buffer
+ width = (width_ == std::size_t(-1)) ? 0 : width_;
+ }
+
+ void tidy()
+ {
+ delete buffer; buffer = 0; width = 0;
+ }
+
         template <typename T>
         void output(T const& value)
         {
@@ -140,13 +266,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;
@@ -158,13 +288,116 @@
     };
 
     ///////////////////////////////////////////////////////////////////////////
+ template <typename OutputIterator>
+ struct buffering_policy
+ {
+ public:
+ buffering_policy() : buffer(NULL) {}
+ buffering_policy(buffering_policy const& rhs) : buffer(rhs.buffer) {}
+
+ // functions related to buffering
+ buffer_sink<OutputIterator>* chain_buffering(
+ buffer_sink<OutputIterator>* buffer_data)
+ {
+ buffer_sink<OutputIterator>* prev_buffer = buffer;
+ buffer = buffer_data;
+ return prev_buffer;
+ }
+
+ template <typename T>
+ bool output(T const& value)
+ {
+ // buffer characters, if appropriate
+ if (NULL != buffer) {
+ buffer->output(value);
+ return false;
+ }
+ return true;
+ }
+
+ bool has_buffer() const { return NULL != buffer; }
+
+ private:
+ buffer_sink<OutputIterator>* buffer;
+ };
+
+ struct no_buffering_policy
+ {
+ no_buffering_policy() {}
+ no_buffering_policy(no_counting_policy const& rhs) {}
+
+ template <typename T>
+ bool output(T const& value)
+ {
+ return true;
+ }
+
+ bool has_buffer() const { return false; }
+ };
+
+ ///////////////////////////////////////////////////////////////////////////
     // forward declaration only
+ template <typename OutputIterator>
+ struct enable_buffering;
+
+ template <typename OutputIterator, typename Properties
+ , typename Derived = unused_type>
+ class output_iterator;
+
     ///////////////////////////////////////////////////////////////////////////
- template <typename OutputIterator> struct enable_counting;
- template <typename OutputIterator> struct enable_buffering;
+ template <typename Buffering, typename Counting, typename Tracking>
+ struct output_iterator_base : Buffering, Counting, Tracking
+ {
+ typedef Buffering buffering_policy;
+ typedef Counting counting_policy;
+ typedef Tracking tracking_policy;
+
+ output_iterator_base() {}
+ output_iterator_base(output_iterator_base const& rhs)
+ : buffering_policy(rhs), counting_policy(rhs), tracking_policy(rhs)
+ {}
+
+ template <typename T>
+ bool output(T const& value)
+ {
+ this->counting_policy::output(value);
+ this->tracking_policy::output(value);
+ return this->buffering_policy::output(value);
+ }
+ };
+
+ template <typename OutputIterator, typename Properties, typename Derived>
+ struct make_output_iterator
+ {
+ // get the most derived type of this class
+ typedef typename mpl::if_<
+ traits::is_not_unused<Derived>, Derived
+ , output_iterator<OutputIterator, Properties, Derived>
+ >::type most_derived_type;
+
+ enum { properties = Properties::value };
+
+ typedef typename mpl::if_c<
+ properties & generator_properties::tracking ? true : false
+ , position_policy, no_position_policy
+ >::type tracking_type;
+
+ typedef typename mpl::if_c<
+ properties & generator_properties::buffering ? true : false
+ , buffering_policy<most_derived_type>, no_buffering_policy
+ >::type buffering_type;
+
+ typedef typename mpl::if_c<
+ properties & generator_properties::counting ? true : false
+ , counting_policy<most_derived_type>, no_counting_policy
+ >::type counting_type;
+
+ typedef output_iterator_base<
+ buffering_type, counting_type, tracking_type> type;
+ };
 
     ///////////////////////////////////////////////////////////////////////////
- // 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,76 +408,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>
- class output_iterator : boost::noncopyable
+ template <typename OutputIterator, typename Properties, typename Derived>
+ class output_iterator
+ : public make_output_iterator<OutputIterator, Properties, Derived>::type
+ , 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)
- {
- parent.output(value);
- return *this;
- }
+ // base iterator type
+ typedef typename make_output_iterator<
+ OutputIterator, Properties, Derived>::type base_iterator;
 
- private:
- output_iterator& parent;
-
- // suppress warning about assignment operator not being generated
- output_proxy& operator=(output_proxy const&);
- };
-
-#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> >;
-#else
-public:
-#endif
- // functions related to counting
- void enable_counting(std::size_t count = 0)
- {
- count_data.init(count);
- mode = output_mode(mode | count_characters);
- }
- 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_data.tidy();
- }
-
     public:
         typedef std::output_iterator_tag iterator_category;
         typedef void value_type;
@@ -252,85 +425,71 @@
         typedef void pointer;
         typedef void reference;
 
- output_iterator(OutputIterator& sink_)
- : sink(sink_), mode(output_characters)
+ explicit output_iterator(OutputIterator& sink_)
+ : sink(sink_)
+ {}
+ output_iterator(output_iterator const& rhs)
+ : base_iterator(rhs), sink(rhs.sink)
         {}
 
- output_proxy operator*() { return output_proxy(*this); }
- output_iterator& operator++() { ++sink; return *this; }
- output_iterator& operator++(int) { sink++; return *this; }
-
- template <typename T>
- void output(T const& value)
+ output_iterator& operator*() { return *this; }
+ output_iterator& operator++()
         {
- if (mode & count_characters) // count characters, if appropriate
- count_data.output();
-
- // always track position in the output (this is needed by different
- // generators, such as indent, pad, etc.)
- track_position_data.output(value);
+ if (!this->base_iterator::has_buffer())
+ ++sink; // increment only if not buffering
+ return *this;
+ }
+ output_iterator operator++(int)
+ {
+ if (!this->base_iterator::has_buffer()) {
+ output_iterator t(*this);
+ ++sink;
+ return t;
+ }
+ return *this;
+ }
 
- if (mode & buffer_characters) // buffer output, if appropriate
- buffer_data.output(value);
- else
+ template <typename T>
+ void operator=(T const& value)
+ {
+ if (this->base_iterator::output(value))
                 *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;
-
         // suppress warning about assignment operator not being generated
         output_iterator& operator=(output_iterator const&);
     };
 
     ///////////////////////////////////////////////////////////////////////////
- template <typename T, typename Elem, typename Traits>
- class output_iterator<ostream_iterator<T, Elem, Traits> >
- : public output_iterator<ostream_iterator<T, Elem, Traits>, int>
+ template <typename T, typename Elem, typename Traits, typename Properties>
+ class output_iterator<karma::ostream_iterator<T, Elem, Traits>, Properties>
+ : public output_iterator<karma::ostream_iterator<T, Elem, Traits>, Properties
+ , output_iterator<karma::ostream_iterator<T, Elem, Traits>, Properties> >
     {
     private:
- typedef
- output_iterator<ostream_iterator<T, Elem, Traits>, int>
- base_type;
- typedef ostream_iterator<T, Elem, Traits> base_iterator_type;
+ typedef output_iterator<karma::ostream_iterator<T, Elem, Traits>, Properties
+ , output_iterator<karma::ostream_iterator<T, Elem, Traits>, Properties>
+ > base_type;
+ typedef karma::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 +500,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
@@ -366,25 +529,68 @@
     template <typename OutputIterator>
     struct enable_buffering
     {
- enable_buffering(OutputIterator& sink_, std::size_t width = 0)
- : sink(sink_)
- {
- sink.enable_buffering(width);
+ enable_buffering(OutputIterator& sink_
+ , std::size_t width = std::size_t(-1))
+ : sink(sink_), prev_buffer(NULL), enabled(false)
+ {
+ 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;
     };
-
+
+ ///////////////////////////////////////////////////////////////////////////
+ template <typename Sink>
+ bool sink_is_good(Sink const& sink)
+ {
+ return true; // the general case is always good
+ }
+
+ template <typename OutputIterator, typename Derived>
+ bool sink_is_good(output_iterator<OutputIterator, Derived> const& sink)
+ {
+ return sink.good(); // our own output iterators are handled separately
+ }
+
 }}}}
 
 #endif

Modified: branches/release/boost/spirit/home/karma/detail/string_generate.hpp
==============================================================================
--- branches/release/boost/spirit/home/karma/detail/string_generate.hpp (original)
+++ branches/release/boost/spirit/home/karma/detail/string_generate.hpp 2009-09-14 12:50:29 EDT (Mon, 14 Sep 2009)
@@ -6,74 +6,122 @@
 #if !defined(BOOST_SPIRIT_KARMA_STRING_GENERATE_FEB_23_2007_1232PM)
 #define BOOST_SPIRIT_KARMA_STRING_GENERATE_FEB_23_2007_1232PM
 
-#if defined(_MSC_VER) && (_MSC_VER >= 1020)
-#pragma once // MS compatible compilers support #pragma once
+#if defined(_MSC_VER)
+#pragma once
 #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/range/iterator_range.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);
- return true;
+ {
+ *sink = ch;
+ ++sink;
+ }
+ return detail::sink_is_good(sink);
     }
 
     ///////////////////////////////////////////////////////////////////////////
     // 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)
- {
- 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)
+ template <typename OutputIterator, typename Char, typename Traits
+ , typename Allocator>
+ inline bool string_generate(OutputIterator& sink
+ , std::basic_string<Char, Traits, Allocator> const& str)
+ {
+ return string_generate(sink, str.c_str());
+ }
+
+ template <typename OutputIterator, typename Iterator>
+ inline bool string_generate(OutputIterator& sink
+ , boost::iterator_range<Iterator> const& r)
+ {
+ Iterator end = r.end();
+ for (Iterator it = r.begin(); it != end; ++it)
         {
- detail::generate_to(sink, *it);
+ *sink = *it;
+ ++sink;
         }
- return true;
+ return detail::sink_is_good(sink);
     }
 
     ///////////////////////////////////////////////////////////////////////////
     // 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);
- return true;
+ {
+ *sink = spirit::char_class::convert<CharEncoding>::to(Tag(), ch);
+ ++sink;
+ }
+ return detail::sink_is_good(sink);
+ }
+
+ template <typename OutputIterator, typename Char>
+ inline bool string_generate(OutputIterator& sink, Char const* str
+ , unused_type, unused_type)
+ {
+ return string_generate(sink, str);
     }
 
     ///////////////////////////////////////////////////////////////////////////
     // 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)
- {
- 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)
+ // 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)
+ {
+ return string_generate(sink, str.c_str(), ce, tag);
+ }
+
+ template <typename OutputIterator, typename Iterator, typename CharEncoding
+ , typename Tag>
+ inline bool string_generate(OutputIterator& sink
+ , boost::iterator_range<Iterator> const& r, CharEncoding ce, Tag tag)
+ {
+ Iterator end = r.end();
+ for (Iterator it = r.begin(); it != end; ++it)
+ {
+ *sink = spirit::char_class::convert<CharEncoding>::to(Tag(), *it);
+ ++sink;
+ }
+ return detail::sink_is_good(sink);
+ }
+
+ template <typename OutputIterator, typename Char, typename Traits
+ , typename Allocator>
+ inline bool string_generate(OutputIterator& sink
+ , std::basic_string<Char, Traits, Allocator> const& str
+ , unused_type, unused_type)
+ {
+ return string_generate(sink, str.c_str());
+ }
+
+ template <typename OutputIterator, typename Iterator>
+ inline bool string_generate(OutputIterator& sink
+ , boost::iterator_range<Iterator> const& r, unused_type, unused_type)
+ {
+ Iterator end = r.end();
+ for (Iterator it = r.begin(); it != end; ++it)
         {
- detail::generate_to(sink, *it, tag);
+ *sink = *it;
+ ++sink;
         }
- return true;
+ return detail::sink_is_good(sink);
     }
 
 }}}}

Modified: branches/release/boost/spirit/home/karma/directive.hpp
==============================================================================
--- branches/release/boost/spirit/home/karma/directive.hpp (original)
+++ branches/release/boost/spirit/home/karma/directive.hpp 2009-09-14 12:50:29 EDT (Mon, 14 Sep 2009)
@@ -6,8 +6,8 @@
 #if !defined(BOOST_SPIRIT_KARMA_DIRECTIVE_FEB_21_2007_0833PM)
 #define BOOST_SPIRIT_KARMA_DIRECTIVE_FEB_21_2007_0833PM
 
-#if defined(_MSC_VER) && (_MSC_VER >= 1020)
-#pragma once // MS compatible compilers support #pragma once
+#if defined(_MSC_VER)
+#pragma once
 #endif
 
 ///////////////////////////////////////////////////////////////////////////////
@@ -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,23 @@
 ///////////////////////////////////////////////////////////////////////////////
 #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>
+
+///////////////////////////////////////////////////////////////////////////////
+// repeat directives
+// repeat[...]
+///////////////////////////////////////////////////////////////////////////////
+#include <boost/spirit/home/karma/directive/repeat.hpp>
+
+///////////////////////////////////////////////////////////////////////////////
+// omit directive
+// omit[...]
+///////////////////////////////////////////////////////////////////////////////
+#include <boost/spirit/home/karma/directive/omit.hpp>
+
+///////////////////////////////////////////////////////////////////////////////
+// buffer directive
+// buffer[...]
+///////////////////////////////////////////////////////////////////////////////
+#include <boost/spirit/home/karma/directive/buffer.hpp>
 
 #endif

Deleted: branches/release/boost/spirit/home/karma/directive/alignment_meta_grammar.hpp
==============================================================================
--- branches/release/boost/spirit/home/karma/directive/alignment_meta_grammar.hpp 2009-09-14 12:50:29 EDT (Mon, 14 Sep 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: branches/release/boost/spirit/home/karma/directive/case_meta_grammar.hpp
==============================================================================
--- branches/release/boost/spirit/home/karma/directive/case_meta_grammar.hpp 2009-09-14 12:50:29 EDT (Mon, 14 Sep 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: branches/release/boost/spirit/home/karma/directive/center_alignment.hpp
==============================================================================
--- branches/release/boost/spirit/home/karma/directive/center_alignment.hpp (original)
+++ branches/release/boost/spirit/home/karma/directive/center_alignment.hpp 2009-09-14 12:50:29 EDT (Mon, 14 Sep 2009)
@@ -6,221 +6,289 @@
 #if !defined(BOOST_SPIRIT_KARMA_CENTER_ALIGNMENT_FEB_27_2007_1216PM)
 #define BOOST_SPIRIT_KARMA_CENTER_ALIGNMENT_FEB_27_2007_1216PM
 
-#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/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;
+
+ typedef mpl::int_<
+ generator_properties::countingbuffer | subject_type::properties::value
+ > properties;
+
+ template <typename Context, typename Iterator>
         struct attribute
- : traits::attribute_of<
- karma::domain,
- typename result_of::subject<Component>::type,
- Context
- >
- {
- };
+ : traits::attribute_of<subject_type, Context, Iterator>
+ {};
 
- 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;
+
+ typedef mpl::int_<
+ generator_properties::countingbuffer |
+ subject_type::properties::value | padding_type::properties::value
+ > properties;
+
+ template <typename Context, typename Iterator>
         struct attribute
- : traits::attribute_of<
- karma::domain,
- typename result_of::subject<Component>::type,
- Context
- >
- {
- };
+ : traits::attribute_of<Subject, Context, Iterator>::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<
+ mpl::and_<
+ spirit::traits::matches<karma::domain, Padding>,
+ mpl::not_<mpl::bool_<integer_traits<Padding>::is_integral> >
+ >
+ >::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
+ , Modifiers const& modifiers) 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), modifiers));
+ }
+ };
 
- 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
+ , Modifiers const& modifiers) const
+ {
+ return result_type(subject
+ , compile<karma::domain>(fusion::at_c<1>(term.args), modifiers)
+ , fusion::at_c<0>(term.args));
         }
     };
 

Modified: branches/release/boost/spirit/home/karma/directive/delimit.hpp
==============================================================================
--- branches/release/boost/spirit/home/karma/directive/delimit.hpp (original)
+++ branches/release/boost/spirit/home/karma/directive/delimit.hpp 2009-09-14 12:50:29 EDT (Mon, 14 Sep 2009)
@@ -6,118 +6,163 @@
 #if !defined(BOOST_SPIRIT_KARMA_DELIMIT_MAR_02_2007_0217PM)
 #define BOOST_SPIRIT_KARMA_DELIMIT_MAR_02_2007_0217PM
 
-#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/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;
+
+ typedef typename subject_type::properties properties;
+
+ template <typename Context, typename Iterator>
         struct attribute
- : traits::attribute_of<
- karma::domain,
- typename result_of::right<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)
- {
- // 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;
+ : traits::attribute_of<subject_type, Context, Iterator>
+ {};
 
- return director::generate(spirit::right(component),
- sink, ctx, spirit::as_component(karma::domain(), ' '), param);
+ redelimit_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 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;
+
+ typedef typename subject_type::properties properties;
+
+ template <typename Context, typename Iterator>
         struct attribute
- : traits::attribute_of<
- karma::domain,
- typename result_of::subject<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)
+ : traits::attribute_of<subject_type, Context, Iterator>
+ {};
+
+ 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: branches/release/boost/spirit/home/karma/directive/delimiter_meta_grammar.hpp
==============================================================================
--- branches/release/boost/spirit/home/karma/directive/delimiter_meta_grammar.hpp 2009-09-14 12:50:29 EDT (Mon, 14 Sep 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: branches/release/boost/spirit/home/karma/directive/left_alignment.hpp
==============================================================================
--- branches/release/boost/spirit/home/karma/directive/left_alignment.hpp (original)
+++ branches/release/boost/spirit/home/karma/directive/left_alignment.hpp 2009-09-14 12:50:29 EDT (Mon, 14 Sep 2009)
@@ -6,115 +6,142 @@
 #if !defined(BOOST_SPIRIT_KARMA_LEFT_ALIGNMENT_FEB_27_2007_1216PM)
 #define BOOST_SPIRIT_KARMA_LEFT_ALIGNMENT_FEB_27_2007_1216PM
 
-#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/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* left_align(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* left_align(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;
+
+ 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);
 
- result += director::what(spirit::argument1(component), ctx);
- result += "]";
- return result;
+ 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;
+
+ typedef mpl::int_<
+ generator_properties::counting | subject_type::properties::value
+ > properties;
+
+ template <typename Context, typename Iterator>
         struct attribute
- : traits::attribute_of<
- karma::domain,
- typename result_of::subject<Component>::type,
- Context
- >
- {
- };
+ : traits::attribute_of<subject_type, Context, Iterator>
+ {};
+
+ simple_left_alignment(Subject const& subject, Width width = Width())
+ : subject(subject), width(width) {}
 
- 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
         {
- 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 +150,128 @@
     // 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;
+
+ typedef mpl::int_<
+ generator_properties::counting |
+ subject_type::properties::value | padding_type::properties::value
+ > properties;
+
+ template <typename Context, typename Iterator>
         struct attribute
- : traits::attribute_of<
- karma::domain,
- typename result_of::subject<Component>::type,
- Context
- >
- {
- };
+ : traits::attribute_of<subject_type, Context, Iterator>
+ {};
 
- 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<
+ mpl::and_<
+ spirit::traits::matches<karma::domain, Padding>,
+ mpl::not_<mpl::bool_<integer_traits<Padding>::is_integral> >
+ >
+ >::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
+ , Modifiers const& modifiers) 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), modifiers));
+ }
+ };
 
- 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));
         }
     };
 

Modified: branches/release/boost/spirit/home/karma/directive/right_alignment.hpp
==============================================================================
--- branches/release/boost/spirit/home/karma/directive/right_alignment.hpp (original)
+++ branches/release/boost/spirit/home/karma/directive/right_alignment.hpp 2009-09-14 12:50:29 EDT (Mon, 14 Sep 2009)
@@ -6,221 +6,282 @@
 #if !defined(BOOST_SPIRIT_KARMA_RIGHT_ALIGNMENT_FEB_27_2007_1216PM)
 #define BOOST_SPIRIT_KARMA_RIGHT_ALIGNMENT_FEB_27_2007_1216PM
 
-#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/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;
+
+ typedef mpl::int_<
+ generator_properties::countingbuffer | subject_type::properties::value
+ > properties;
+
+ template <typename Context, typename Iterator>
         struct attribute
- : traits::attribute_of<
- karma::domain,
- typename result_of::subject<Component>::type,
- Context
- >
- {
- };
+ : traits::attribute_of<subject_type, Context, Iterator>
+ {};
 
- 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;
+
+ typedef mpl::int_<
+ generator_properties::countingbuffer |
+ subject_type::properties::value | padding_type::properties::value
+ > properties;
+
+ template <typename Context, typename Iterator>
         struct attribute
- : traits::attribute_of<
- karma::domain,
- typename result_of::subject<Component>::type,
- Context
- >
- {
- };
+ : traits::attribute_of<subject_type, Context, Iterator>
+ {};
 
- 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<
+ mpl::and_<
+ spirit::traits::matches<karma::domain, Padding>,
+ mpl::not_<mpl::bool_<integer_traits<Padding>::is_integral> >
+ >
+ >::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
+ , Modifiers const& modifiers) 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), modifiers));
+ }
+ };
 
- 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
+ , Modifiers const& modifiers) const
+ {
+ return result_type(subject
+ , compile<karma::domain>(fusion::at_c<1>(term.args), modifiers)
+ , fusion::at_c<0>(term.args));
         }
     };
 

Modified: branches/release/boost/spirit/home/karma/directive/verbatim.hpp
==============================================================================
--- branches/release/boost/spirit/home/karma/directive/verbatim.hpp (original)
+++ branches/release/boost/spirit/home/karma/directive/verbatim.hpp 2009-09-14 12:50:29 EDT (Mon, 14 Sep 2009)
@@ -6,67 +6,87 @@
 #if !defined(BOOST_SPIRIT_KARMA_VERBATIM_MAR_02_2007_0303PM)
 #define BOOST_SPIRIT_KARMA_VERBATIM_MAR_02_2007_0303PM
 
-#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/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;
+ typedef typename subject_type::properties properties;
+
+ template <typename Context, typename Iterator>
         struct attribute
- : traits::attribute_of<
- karma::domain,
- typename result_of::right<Component>::type,
- Context
- >
- {
- };
+ : traits::attribute_of<subject_type, Context, Iterator>
+ {};
 
- 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));
+ }
+
+ Subject subject;
+ };
 
- typedef typename
- spirit::result_of::right<Component>::type::director
- director;
-
- 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: branches/release/boost/spirit/home/karma/domain.hpp
==============================================================================
--- branches/release/boost/spirit/home/karma/domain.hpp (original)
+++ branches/release/boost/spirit/home/karma/domain.hpp 2009-09-14 12:50:29 EDT (Mon, 14 Sep 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,51 @@
 #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::_pass;
+ 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: branches/release/boost/spirit/home/karma/generate.hpp
==============================================================================
--- branches/release/boost/spirit/home/karma/generate.hpp (original)
+++ branches/release/boost/spirit/home/karma/generate.hpp 2009-09-14 12:50:29 EDT (Mon, 14 Sep 2009)
@@ -1,262 +1,227 @@
 // 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);
+
+ typedef traits::properties_of<
+ typename result_of::compile<karma::domain, Expr>::type
+ > properties;
 
         // 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);
+ detail::output_iterator<OutputIterator
+ , mpl::int_<properties::value> > sink(target_sink);
+ return compile<karma::domain>(expr).generate(sink, unused, unused, unused);
     }
 
- ///////////////////////////////////////////////////////////////////////////
- template <typename OutputIterator, typename Expr>
+ template <typename OutputIterator, typename Properties, typename Expr>
     inline bool
- generate(detail::output_iterator<OutputIterator>& sink, Expr const& xpr)
+ generate(
+ detail::output_iterator<OutputIterator, Properties>& 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.
+ // 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);
 
- // 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 traits::properties_of<
+ typename result_of::compile<karma::domain, Expr>::type
+ > properties;
 
         // 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);
+ detail::output_iterator<OutputIterator
+ , mpl::int_<properties::value> > sink(target_sink);
+ return compile<karma::domain>(expr).generate(sink, unused, unused, attr);
+ }
+
+ template <typename OutputIterator, typename Properties, typename Expr
+ , typename Attr>
+ inline bool
+ generate(
+ detail::output_iterator<OutputIterator, Properties>& sink
+ , Expr const& expr
+ , Attr 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);
+ return compile<karma::domain>(expr).generate(sink, unused, unused, attr);
     }
 
     ///////////////////////////////////////////////////////////////////////////
- template <typename OutputIterator, typename Expr, typename Parameter>
- inline bool
- generate(detail::output_iterator<OutputIterator>& sink, Expr const& xpr,
- Parameter const& param)
- {
- 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));
-
- typedef
- typename result_of::as_component<karma::domain, Expr>::type
- component;
- typedef typename component::director director;
+ template <typename OutputIterator, typename Properties, typename Expr
+ , typename Delimiter>
+ inline bool
+ generate_delimited(
+ detail::output_iterator<OutputIterator, Properties>& 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)
- {
- 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));
-
+ generate_delimited(
+ OutputIterator& target_sink
+ , Expr const& expr
+ , Delimiter const& delimiter
+ , BOOST_SCOPED_ENUM(delimit_flag) pre_delimit =
+ delimit_flag::dont_predelimit)
+ {
+ typedef traits::properties_of<
+ typename result_of::compile<karma::domain, Expr>::type
+ > properties;
+ typedef traits::properties_of<
+ typename result_of::compile<karma::domain, Delimiter>::type
+ > delimiter_properties;
+
         // 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);
+ detail::output_iterator<OutputIterator
+ , mpl::int_<properties::value | delimiter_properties::value>
+ > sink(target_sink);
+ return generate_delimited(sink, expr, delimiter, pre_delimit);
     }
 
     ///////////////////////////////////////////////////////////////////////////
- template <typename OutputIterator, typename Expr, typename Delimiter>
- inline bool
- generate_delimited(detail::output_iterator<OutputIterator>& sink,
- Expr const& xpr, Delimiter const& delimiter)
- {
- 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);
+ template <typename OutputIterator, typename Properties, typename Expr
+ , typename Delimiter, typename Attribute>
+ inline bool
+ generate_delimited(
+ detail::output_iterator<OutputIterator, Properties>& sink
+ , Expr const& expr
+ , Delimiter const& delimiter
+ , BOOST_SCOPED_ENUM(delimit_flag) pre_delimit
+ , Attribute 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;
+ }
+
+ return compile<karma::domain>(expr).
+ generate(sink, unused, delimiter_, attr);
     }
 
     ///////////////////////////////////////////////////////////////////////////
- template <typename OutputIterator, typename Expr, typename Parameter,
- typename Delimiter>
- inline bool
- generate_delimited(OutputIterator target_sink, Expr const& xpr,
- Parameter const& param, Delimiter const& delimiter)
- {
- 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);
- }
+ template <typename OutputIterator, typename Expr, typename Delimiter
+ , typename Attribute>
+ inline bool
+ generate_delimited(
+ OutputIterator& target_sink
+ , Expr const& expr
+ , Delimiter const& delimiter
+ , BOOST_SCOPED_ENUM(delimit_flag) pre_delimit
+ , Attribute const& attr)
+ {
+ typedef traits::properties_of<
+ typename result_of::compile<karma::domain, Expr>::type
+ > properties;
+ typedef traits::properties_of<
+ typename result_of::compile<karma::domain, Delimiter>::type
+ > delimiter_properties;
 
- ///////////////////////////////////////////////////////////////////////////
- template <typename OutputIterator, typename Expr, typename Parameter,
- typename Delimiter>
- inline bool
- generate_delimited(detail::output_iterator<OutputIterator>& sink,
- Expr const& xpr, Parameter const& param, Delimiter const& delimiter)
+ // wrap user supplied iterator into our own output iterator
+ detail::output_iterator<OutputIterator
+ , mpl::int_<properties::value | delimiter_properties::value>
+ > sink(target_sink);
+ return generate_delimited(sink, expr, delimiter, pre_delimit, attr);
+ }
+
+ template <typename OutputIterator, typename Expr, typename Attribute
+ , typename Delimiter>
+ inline bool
+ 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);
     }
 
 }}}

Deleted: branches/release/boost/spirit/home/karma/meta_grammar.hpp
==============================================================================
--- branches/release/boost/spirit/home/karma/meta_grammar.hpp 2009-09-14 12:50:29 EDT (Mon, 14 Sep 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: branches/release/boost/spirit/home/karma/nonterminal.hpp
==============================================================================
--- branches/release/boost/spirit/home/karma/nonterminal.hpp (original)
+++ branches/release/boost/spirit/home/karma/nonterminal.hpp 2009-09-14 12:50:29 EDT (Mon, 14 Sep 2009)
@@ -6,12 +6,11 @@
 #if !defined(BOOST_SPIRIT_KARMA_NONTERMINAL_MAR_05_2007_0539PM)
 #define BOOST_SPIRIT_KARMA_NONTERMINAL_MAR_05_2007_0539PM
 
-#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/nonterminal/rule.hpp>
 #include <boost/spirit/home/karma/nonterminal/grammar.hpp>
-#include <boost/spirit/home/karma/nonterminal/meta_grammar.hpp>
 
 #endif

Deleted: branches/release/boost/spirit/home/karma/nonterminal/detail/rule.hpp
==============================================================================
--- branches/release/boost/spirit/home/karma/nonterminal/detail/rule.hpp 2009-09-14 12:50:29 EDT (Mon, 14 Sep 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: branches/release/boost/spirit/home/karma/nonterminal/grammar.hpp
==============================================================================
--- branches/release/boost/spirit/home/karma/nonterminal/grammar.hpp (original)
+++ branches/release/boost/spirit/home/karma/nonterminal/grammar.hpp 2009-09-14 12:50:29 EDT (Mon, 14 Sep 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,55 @@
 #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::properties properties;
         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, properties>
+ 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 +63,32 @@
             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_parameterized_subject() const
+ { return this->proto_base().child0.ref.get(); }
+ typedef start_type parameterized_subject_type;
+ #include <boost/spirit/home/karma/nonterminal/detail/fcall.hpp>
+
+ std::string name_;
     };
 
 }}}

Deleted: branches/release/boost/spirit/home/karma/nonterminal/grammar_fwd.hpp
==============================================================================
--- branches/release/boost/spirit/home/karma/nonterminal/grammar_fwd.hpp 2009-09-14 12:50:29 EDT (Mon, 14 Sep 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: branches/release/boost/spirit/home/karma/nonterminal/meta_grammar.hpp
==============================================================================
--- branches/release/boost/spirit/home/karma/nonterminal/meta_grammar.hpp 2009-09-14 12:50:29 EDT (Mon, 14 Sep 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: branches/release/boost/spirit/home/karma/nonterminal/nonterminal.hpp
==============================================================================
--- branches/release/boost/spirit/home/karma/nonterminal/nonterminal.hpp 2009-09-14 12:50:29 EDT (Mon, 14 Sep 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: branches/release/boost/spirit/home/karma/nonterminal/nonterminal_director.hpp
==============================================================================
--- branches/release/boost/spirit/home/karma/nonterminal/nonterminal_director.hpp 2009-09-14 12:50:29 EDT (Mon, 14 Sep 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: branches/release/boost/spirit/home/karma/nonterminal/rule.hpp
==============================================================================
--- branches/release/boost/spirit/home/karma/nonterminal/rule.hpp (original)
+++ branches/release/boost/spirit/home/karma/nonterminal/rule.hpp 2009-09-14 12:50:29 EDT (Mon, 14 Sep 2009)
@@ -1,204 +1,301 @@
-// 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/assert.hpp>
+#include <boost/function.hpp>
+#include <boost/mpl/vector.hpp>
+#include <boost/type_traits/add_const.hpp>
+#include <boost/type_traits/add_reference.hpp>
+#include <boost/utility/enable_if.hpp>
+
+#include <boost/fusion/include/vector.hpp>
+#include <boost/fusion/include/size.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/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/extract_param.hpp>
+#include <boost/spirit/home/support/nonterminal/locals.hpp>
+#include <boost/spirit/home/karma/reference.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/karma/nonterminal/detail/generator_binder.hpp>
+#include <boost/spirit/home/karma/nonterminal/detail/parameterized.hpp>
 
 namespace boost { namespace spirit { namespace karma
 {
- template <typename OutputIterator, typename T0 = unused_type,
- typename T1 = unused_type, typename T2 = unused_type>
+ BOOST_PP_REPEAT(SPIRIT_ATTRIBUTES_LIMIT, SPIRIT_USING_ATTRIBUTE, _)
+
+ using spirit::_pass;
+ 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 OutputIterator
+ , typename T1 = unused_type
+ , typename T2 = unused_type
+ , typename T3 = unused_type
+ >
     struct rule
- : make_nonterminal<rule<OutputIterator, T0, T1, T2>, T0, T1, T2>::type
+ : 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
- 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;
-
- typedef intrusive_ptr<virtual_component> pointer_type;
+ typedef mpl::int_<generator_properties::all_properties> properties;
 
- rule() {}
- ~rule() {}
+ typedef OutputIterator iterator_type;
+ 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, properties>
+ output_iterator;
+
+ // locals_type is a sequence of types to be used as local variables
+ typedef typename
+ spirit::detail::extract_locals<template_params>::type
+ locals_type;
+
+ // The delimiter-generator type
+ typedef typename
+ spirit::detail::extract_component<
+ karma::domain, template_params>::type
+ delimiter_type;
+
+ typedef typename
+ spirit::detail::extract_sig<template_params>::type
+ sig_type;
+
+ // This is the rule's attribute type
+ typedef typename
+ spirit::detail::attr_from_sig<sig_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
+ spirit::detail::params_from_sig<sig_type>::type
+ parameter_types;
+
+ static size_t const params_size =
+ fusion::result_of::size<parameter_types>::type::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;
+
+ explicit rule(std::string const& name_ = "unnamed-rule")
+ : base_type(terminal::make(alias()))
+ , name_(name_)
+ {
+ }
 
         rule(rule const& rhs)
- : ptr(rhs.ptr)
+ : base_type(rhs)
+ , name_(rhs.name_)
+ , f(rhs.f)
         {
         }
 
+ template <typename Expr>
+ rule (Expr const& expr, std::string const& name_ = "unnamed-rule")
+ : base_type(terminal::make(alias()))
+ , name_(name_)
+ {
+ // 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::true_>(compile<karma::domain>(expr));
+ }
+
         rule& operator=(rule const& rhs)
         {
- ptr = rhs.ptr;
+ // The following assertion fires when you try to initialize a rule
+ // from an uninitialized one. Did you mean to refer to the right
+ // hand side rule instead of assigning from it? In this case you
+ // should write lhs = rhs.alias();
+ BOOST_ASSERT(rhs.f);
+
+ 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<karma::domain, Expr>
- is_component;
+ return name_;
+ }
 
- // report invalid expression error as early as possible
-// BOOST_MPL_ASSERT_MSG(
-// is_component::value,
-// xpr_is_not_convertible_to_a_generator, ());
+ void name(std::string const& str)
+ {
+ name_ = str;
+ }
 
- // temp workaround for mpl problem
- BOOST_STATIC_ASSERT(is_component::value);
+ 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);
 
- define(xpr, mpl::false_());
+ 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& xpr)
+ friend rule& operator%=(rule& r, 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, ());
+ // 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);
 
- // temp workaround for mpl problem
- BOOST_STATIC_ASSERT(is_component::value);
-
- r.define(xpr, mpl::true_());
+ r.f = detail::bind_generator<mpl::true_>(compile<karma::domain>(expr));
             return r;
         }
 
- self_type alias() const
+ // non-const version needed to suppress proto's %= kicking in
+ template <typename Expr>
+ friend rule& operator%=(rule& r, Expr& expr)
         {
- self_type result;
- result.define(*this, mpl::false_());
- return result;
+ return r %= static_cast<Expr const&>(expr);
         }
 
- typename
- make_nonterminal_holder<
- nonterminal_object<self_type>
- , self_type
- >::type
- copy() const
+ template <typename Context, typename Unused>
+ struct attribute
         {
- typename
- make_nonterminal_holder<
- nonterminal_object<self_type>
- , self_type
- >::type
- result = {{*this}};
- return result;
- }
+ typedef attr_type type;
+ };
 
- std::string name() const
+ template <typename Context, typename Delimiter, typename Attribute>
+ bool generate(output_iterator& sink, Context&, Delimiter const& delim
+ , Attribute const& attr) const
         {
- return name_;
+ if (f)
+ {
+ // Create an attribute if none is supplied.
+ typedef traits::make_attribute<attr_type, Attribute>
+ make_attribute;
+
+ // If you are seeing a compilation error here, you are probably
+ // trying to use a rule or a grammar which has inherited
+ // attributes, without passing values for them.
+ 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 true;
+ }
+ }
+ return false;
         }
 
- void name(std::string const& str)
+ 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
         {
- name_ = str;
+ if (f)
+ {
+ // Create an attribute if none is supplied.
+ typedef traits::make_attribute<attr_type, Attribute>
+ make_attribute;
+
+ // If you are seeing a compilation error here, you are probably
+ // trying to use a rule or a grammar which has inherited
+ // attributes, passing values of incompatible types for them.
+ 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;
         }
 
- private:
-
- template <typename Iterator_, typename T0_, typename T1_, typename T2_>
- friend struct grammar;
+ template <typename Context>
+ info what(Context& context) const
+ {
+ return info(name_);
+ }
 
- template <typename Expr, typename Auto>
- void define(Expr const& xpr, Auto)
+ reference_ alias() const
         {
- 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 reference_(*this);
         }
 
- std::string what() const
+ typename proto::terminal<this_type>::type copy() const
         {
- if (name_.empty())
- {
- if (ptr)
- {
- return "unnamed-rule";
- }
- else
- {
- return "empty-rule";
- }
- }
- else
- {
- return name_;
- }
+ typename proto::terminal<this_type>::type result = {*this};
+ return result;
         }
 
- friend struct nonterminal_director;
- pointer_type ptr;
+ // bring in the operator() overloads
+ rule const& get_parameterized_subject() const { return *this; }
+ typedef rule parameterized_subject_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: branches/release/boost/spirit/home/karma/numeric.hpp
==============================================================================
--- branches/release/boost/spirit/home/karma/numeric.hpp (original)
+++ branches/release/boost/spirit/home/karma/numeric.hpp 2009-09-14 12:50:29 EDT (Mon, 14 Sep 2009)
@@ -6,14 +6,12 @@
 #if !defined(BOOST_SPIRIT_KARMA_NUMERIC_FEB_23_2007_0507PM)
 #define BOOST_SPIRIT_KARMA_NUMERIC_FEB_23_2007_0507PM
 
-#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/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: branches/release/boost/spirit/home/karma/numeric/detail/numeric_utils.hpp
==============================================================================
--- branches/release/boost/spirit/home/karma/numeric/detail/numeric_utils.hpp (original)
+++ branches/release/boost/spirit/home/karma/numeric/detail/numeric_utils.hpp 2009-09-14 12:50:29 EDT (Mon, 14 Sep 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,22 +6,21 @@
 #if !defined(BOOST_SPIRIT_KARMA_NUMERIC_UTILS_FEB_23_2007_0841PM)
 #define BOOST_SPIRIT_KARMA_NUMERIC_UTILS_FEB_23_2007_0841PM
 
-#if defined(_MSC_VER) && (_MSC_VER >= 1020)
-#pragma once // MS compatible compilers support #pragma once
+#if defined(_MSC_VER)
+#pragma once
 #endif
 
+#include <boost/config.hpp>
 #include <boost/config/no_tr1/cmath.hpp>
 #include <limits>
 
 #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,11 +37,11 @@
 #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 {
-
+namespace boost { namespace spirit { namespace karma
+{
     namespace detail
     {
         ///////////////////////////////////////////////////////////////////////
@@ -51,97 +50,136 @@
         // underflow
         //
         ///////////////////////////////////////////////////////////////////////
- inline unsigned short absolute_value (short n)
- {
- return (n >= 0) ? n : (unsigned short)(-n);
- }
-
- inline unsigned int absolute_value (int n)
+ template <typename T>
+ struct absolute_value_helper
         {
- return (n >= 0) ? n : (unsigned int)(-n);
- }
+ typedef T result_type;
+ static T call (T n)
+ {
+ // allow for ADL to find the correct overloads for fabs
+ using namespace std;
+ return fabs(n);
+ }
+ };
 
- inline unsigned long absolute_value (long n)
- {
- return (n >= 0) ? n : (unsigned long)(-n);
- }
+#define BOOST_SPIRIT_ABSOLUTE_VALUE(type, unsignedtype) \
+ template <> \
+ struct absolute_value_helper<type> \
+ { \
+ typedef unsignedtype result_type; \
+ static result_type call(type n) \
+ { \
+ return (n >= 0) ? n : (unsignedtype)(-n); \
+ } \
+ } \
+ /**/
+#define BOOST_SPIRIT_ABSOLUTE_VALUE_UNSIGNED(type) \
+ template <> \
+ struct absolute_value_helper<type> \
+ { \
+ typedef type result_type; \
+ static result_type call(type n) \
+ { \
+ return n; \
+ } \
+ } \
+ /**/
 
+ BOOST_SPIRIT_ABSOLUTE_VALUE(short, unsigned short);
+ BOOST_SPIRIT_ABSOLUTE_VALUE(int, unsigned int);
+ BOOST_SPIRIT_ABSOLUTE_VALUE(long, unsigned long);
+ BOOST_SPIRIT_ABSOLUTE_VALUE_UNSIGNED(unsigned short);
+ BOOST_SPIRIT_ABSOLUTE_VALUE_UNSIGNED(unsigned int);
+ BOOST_SPIRIT_ABSOLUTE_VALUE_UNSIGNED(unsigned long);
 #ifdef BOOST_HAS_LONG_LONG
- inline boost::ulong_long_type absolute_value (boost::long_long_type n)
- {
- return (n >= 0) ? n : (boost::ulong_long_type)(-n);
- }
+ BOOST_SPIRIT_ABSOLUTE_VALUE(boost::long_long_type, boost::ulong_long_type);
+ BOOST_SPIRIT_ABSOLUTE_VALUE_UNSIGNED(boost::ulong_long_type);
 #endif
-
- inline float absolute_value (float n)
+
+#undef BOOST_SPIRIT_ABSOLUTE_VALUE
+#undef BOOST_SPIRIT_ABSOLUTE_VALUE_UNSIGNED
+
+ template <>
+ struct absolute_value_helper<float>
         {
- return boost::spirit::math::signbit(n) ?
- boost::spirit::math::changesign(n) : n;
- }
-
- inline double absolute_value (double n)
+ typedef long double result_type;
+ static result_type call(float n)
+ {
+ return (spirit::detail::signbit)(n) ? -n : n;
+ }
+ };
+
+ template <>
+ struct absolute_value_helper<double>
         {
- return boost::spirit::math::signbit(n) ?
- boost::spirit::math::changesign(n) : n;
- }
-
- inline long double absolute_value (long double n)
+ typedef long double result_type;
+ static result_type call(double n)
+ {
+ return (spirit::detail::signbit)(n) ? -n : n;
+ }
+ };
+
+ template <>
+ struct absolute_value_helper<long double>
         {
- return boost::spirit::math::signbit(n) ?
- boost::spirit::math::changesign(n) : n;
- }
-
+ typedef long double result_type;
+ static result_type call(long double n)
+ {
+ return (spirit::detail::signbit)(n) ? -n : n;
+ }
+ };
+
         template <typename T>
- inline T absolute_value (T n)
+ typename absolute_value_helper<T>::result_type
+ absolute_value(T n)
         {
- using namespace std;
- return fabs(n);
+ return absolute_value_helper<T>::call(n);
         }
 
         ///////////////////////////////////////////////////////////////////////
         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
         {
@@ -149,17 +187,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_)
             {
@@ -181,30 +219,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>
@@ -219,7 +261,7 @@
                 return call(n, mpl::bool_<is_integral<T>::value>());
             }
         };
-
+
         ///////////////////////////////////////////////////////////////////////
         //
         // Traits class for radix specific number conversion
@@ -230,12 +272,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)
             {
@@ -244,8 +286,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)
             {
@@ -254,8 +296,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)
             {
@@ -265,7 +307,7 @@
 
         // Hexadecimal, lower case
         template<>
- struct radix_traits<16, unused_type>
+ struct radix_traits<16, unused_type, unused_type>
         {
             static int digit(unsigned n)
             {
@@ -276,19 +318,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');
             }
         };
 
@@ -301,7 +340,7 @@
             {
                 return n / Radix;
             }
-
+
             template <typename T>
             static T call(T& n, mpl::false_)
             {
@@ -309,14 +348,51 @@
                 using namespace std;
                 return floor(n / Radix);
             }
-
+
+ template <typename T>
+ static T call(T& n, T const&, int)
+ {
+ return call(n, mpl::bool_<is_integral<T>::value>());
+ }
+
             template <typename T>
             static T call(T& n)
             {
                 return call(n, mpl::bool_<is_integral<T>::value>());
             }
         };
-
+
+ // 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, mpl::bool_<is_integral<T>::value>());
+ }
+ };
+
         ///////////////////////////////////////////////////////////////////////
         template <unsigned Radix>
         struct remainder
@@ -328,7 +404,7 @@
                 // than Radix
                 return static_cast<long>(n % Radix);
             }
-
+
             template <typename T>
             static long call(T n, mpl::false_)
             {
@@ -336,16 +412,16 @@
                 using namespace std;
                 return cast_to_long::call(fmod(n, T(Radix)));
             }
-
+
             template <typename T>
             static long call(T n)
             {
                 return call(n, mpl::bool_<is_integral<T>::value>());
             }
         };
-
+
     } // namespace detail
-
+
     ///////////////////////////////////////////////////////////////////////////
     //
     // The int_inserter template takes care of the integer to string
@@ -360,7 +436,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) \
@@ -369,28 +445,29 @@
         } \
     /**/
 
- 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,
@@ -400,6 +477,68 @@
             ++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);
+ }
+
+ private:
+ // helper function returning the biggest number representable either in
+ // a boost::long_long_type (if this does exist) or in a plain long
+ // otherwise
+#if defined(BOOST_HAS_LONG_LONG)
+ typedef boost::long_long_type biggest_long_type;
+#else
+ typedef long biggest_long_type;
+#endif
+
+ static biggest_long_type max_long()
+ {
+ return (std::numeric_limits<biggest_long_type>::max)();
+ }
+
+ public:
+ // Specialization for doubles and floats, falling back to long integers
+ // for representable values. These specializations speed up formatting
+ // of floating point numbers considerably as all the required
+ // arithmetics will be executed using integral data types.
+ template <typename OutputIterator>
+ static bool
+ call(OutputIterator& sink, long double n)
+ {
+ if (std::fabs(n) < max_long())
+ {
+ biggest_long_type l((biggest_long_type)n);
+ return call(sink, l, l, 0);
+ }
+ return call(sink, n, n, 0);
+ }
+ template <typename OutputIterator>
+ static bool
+ call(OutputIterator& sink, double n)
+ {
+ if (std::fabs(n) < max_long())
+ {
+ biggest_long_type l((biggest_long_type)n);
+ return call(sink, l, l, 0);
+ }
+ return call(sink, n, n, 0);
+ }
+ template <typename OutputIterator>
+ static bool
+ call(OutputIterator& sink, float n)
+ {
+ if (std::fabs(n) < max_long())
+ {
+ biggest_long_type l((biggest_long_type)n);
+ return call(sink, l, l, 0);
+ }
+ return call(sink, n, n, 0);
+ }
     };
 
 #undef BOOST_KARMA_NUMERICS_INNER_LOOP_PREFIX
@@ -409,16 +548,15 @@
     //
     // The sign_inserter template generates a sign for a given numeric value.
     //
- // The parameter ForceSign allows to generate a sign even for positive
+ // The parameter forcesign allows to generate a sign even for positive
     // numbers.
     //
     ///////////////////////////////////////////////////////////////////////////
- template <bool ForceSign>
     struct sign_inserter
     {
         template <typename OutputIterator>
         static bool
- call(OutputIterator& sink, bool /*is_zero*/, bool is_negative)
+ call_noforce(OutputIterator& sink, bool /*is_zero*/, bool is_negative)
         {
             // generate a sign for negative numbers only
             if (is_negative) {
@@ -427,210 +565,30 @@
             }
             return true;
         }
- };
-
- template <>
- struct sign_inserter<true>
- {
+
         template <typename OutputIterator>
         static bool
- call(OutputIterator& sink, bool is_zero, bool is_negative)
+ call_force(OutputIterator& sink, bool is_zero, bool is_negative)
         {
             // generate a sign for all numbers except zero
             if (!is_zero)
                 *sink = is_negative ? '-' : '+';
             else
                 *sink = ' ';
-
+
             ++sink;
             return true;
         }
- };
 
- ///////////////////////////////////////////////////////////////////////////
- // These are helper functions for the real policies allowing to generate
- // a single character and a string
- ///////////////////////////////////////////////////////////////////////////
- template <typename Tag = unused_type>
- struct char_inserter
- {
- template <typename OutputIterator, typename Char>
- static bool
- call(OutputIterator& sink, Char c)
- {
- return detail::generate_to(sink, c, Tag());
- }
- };
-
- template <typename Tag = unused_type>
- struct string_inserter
- {
- template <typename OutputIterator, typename String>
- static bool
- call(OutputIterator& sink, String str)
- {
- return detail::string_generate(sink, str, Tag());
- }
- };
-
- ///////////////////////////////////////////////////////////////////////////
- //
- // The real_inserter template takes care of the floating point number to
- // string conversion. The RealPolicies template parameter is used to allow
- // customization of the formatting process
- //
- ///////////////////////////////////////////////////////////////////////////
- template <typename T, typename RealPolicies, typename Tag = unused_type>
- struct real_inserter
- {
- enum { force_sign = RealPolicies::force_sign };
-
- template <typename OutputIterator>
- static bool
- call (OutputIterator& sink, float n, RealPolicies const& p)
- {
- int fpclass = boost::spirit::math::fpclassify(n);
- if (FP_NAN == fpclass)
- return RealPolicies::template nan<force_sign, Tag>(sink, n);
- else if (FP_INFINITE == fpclass)
- return RealPolicies::template inf<force_sign, 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, bool is_zero, bool is_negative
+ , bool forcesign)
         {
- int fpclass = boost::spirit::math::fpclassify(n);
- if (FP_NAN == fpclass)
- return RealPolicies::template nan<force_sign, Tag>(sink, n);
- else if (FP_INFINITE == fpclass)
- return RealPolicies::template inf<force_sign, Tag>(sink, n);
- return call_n(sink, n, p);
+ return forcesign ?
+ call_force(sink, is_zero, is_negative) :
+ call_noforce(sink, is_zero, is_negative);
         }
-
- template <typename OutputIterator>
- static bool
- call (OutputIterator& sink, long double n, RealPolicies const& p)
- {
- int fpclass = boost::spirit::math::fpclassify(n);
- if (FP_NAN == fpclass)
- return RealPolicies::template nan<force_sign, Tag>(sink, n);
- else if (FP_INFINITE == fpclass)
- return RealPolicies::template inf<force_sign, Tag>(sink, n);
- return call_n(sink, n, p);
- }
-
- template <typename OutputIterator, typename U>
- static bool
- call (OutputIterator& sink, U n, RealPolicies const& p)
- {
- // 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(disable: 4100) // 'p': unreferenced formal parameter
-# pragma warning(disable: 4127) // conditional expression is constant
-#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)
- {
- // prepare sign and get output format
- bool sign_val = false;
- int flags = p.floatfield(n);
- if (detail::is_negative(n))
- {
- n = -n;
- sign_val = true;
- }
-
- // The scientific representation requires the normalization of the
- // value to convert.
-
- // 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))
- {
- dim = log10(n);
- if (dim > 0)
- n /= pow(U(10.0), (int)detail::round_to_long::call(dim));
- else if (n < 1.)
- n *= pow(U(10.0), (int)detail::round_to_long::call(-dim));
- }
-
- // prepare numbers (sign, integer and fraction part)
- unsigned precision = p.precision(n);
- U integer_part;
- U precexp = std::pow(10.0, (int)precision);
- U fractional_part = modf(n, &integer_part);
-
- fractional_part = floor(fractional_part * precexp + 0.5);
- if (fractional_part >= precexp)
- {
- fractional_part -= precexp;
- integer_part += 1; // handle rounding overflow
- }
-
- // if trailing zeros are to be omitted, normalize the precision and
- // fractional part
- U long_int_part = floor(integer_part);
- U long_frac_part = floor(fractional_part);
- if (!p.trailing_zeros)
- {
- if (0 != long_frac_part) {
- // remove the trailing zeros
- while (0 != precision &&
- 0 == detail::remainder<10>::call(long_frac_part))
- {
- long_frac_part = detail::divide<10>::call(long_frac_part);
- --precision;
- }
- }
- else {
- // if the fractional part is zero, we don't need to output
- // any additional digits
- precision = 0;
- }
- }
-
- // 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);
-
- if (r && 0 == (p.fixed & flags)) {
- return p.template exponent<Tag>(sink,
- detail::round_to_long::call(dim));
- }
- return r;
- }
-
-#if BOOST_WORKAROUND(BOOST_MSVC, >= 1400)
-# pragma warning(pop)
-#endif
-
     };
 
 }}}

Modified: branches/release/boost/spirit/home/karma/numeric/int.hpp
==============================================================================
--- branches/release/boost/spirit/home/karma/numeric/int.hpp (original)
+++ branches/release/boost/spirit/home/karma/numeric/int.hpp 2009-09-14 12:50:29 EDT (Mon, 14 Sep 2009)
@@ -6,77 +6,221 @@
 #if !defined(BOOST_SPIRIT_KARMA_INT_FEB_23_2007_0840PM)
 #define BOOST_SPIRIT_KARMA_INT_FEB_23_2007_0840PM
 
-#if defined(_MSC_VER) && (_MSC_VER >= 1020)
-#pragma once // MS compatible compilers support #pragma once
+#if defined(_MSC_VER)
+#pragma once
 #endif
 
 #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 = int, 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 <>
+ struct use_terminal<karma::domain, short> // enables lit(short(0))
+ : mpl::true_ {};
+
+ template <>
+ struct use_terminal<karma::domain, int> // enables lit(0)
+ : mpl::true_ {};
+
+ template <>
+ struct use_terminal<karma::domain, long> // enables lit(0L)
+ : mpl::true_ {};
+
+#ifdef BOOST_HAS_LONG_LONG
+ template <>
+ struct use_terminal<karma::domain, boost::long_long_type> // enables lit(0LL)
+ : 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
+
+ using spirit::lit; // lit(1) is equivalent to 1
+
     ///////////////////////////////////////////////////////////////////////////
     // 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
- BOOST_MPL_ASSERT_MSG(
+ // check template Attribute 'Radix' for validity
+ BOOST_SPIRIT_ASSERT_MSG(
             Radix == 2 || Radix == 8 || Radix == 10 || Radix == 16,
             not_supported_radix, ());
 
- BOOST_MPL_ASSERT_MSG(std::numeric_limits<T>::is_signed,
+ BOOST_SPIRIT_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::call(sink, detail::is_zero(attr)
+ , detail::is_negative(attr), force_sign) &&
+ 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, ());
+ BOOST_SPIRIT_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,157 +228,219 @@
     // 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;
- };
+ : mpl::if_c<no_attribute, unused_type, T>
+ {};
+
+ literal_int_generator(typename add_const<T>::type n)
+ : n_(n) {}
 
- // check template parameter 'Radix' for validity
- BOOST_MPL_ASSERT_MSG(
+ // check template Attribute 'Radix' for validity
+ BOOST_SPIRIT_ASSERT_MSG(
             Radix == 2 || Radix == 8 || Radix == 10 || Radix == 16,
             not_supported_radix, ());
 
- BOOST_MPL_ASSERT_MSG(std::numeric_limits<T>::is_signed,
+ BOOST_SPIRIT_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;
+ // A int_(1) which additionally has an associated attribute emits
+ // its immediate literal only if it matches the attribute, otherwise
+ // it fails.
+ template <typename OutputIterator, typename Context, typename Delimiter
+ , typename Attribute>
+ bool generate(OutputIterator& sink, Context&, Delimiter const& d
+ , Attribute const& attr) const
+ {
+ if (n_ != attr)
+ return false;
+
+ return sign_inserter::call(sink, detail::is_zero(n_)
+ , detail::is_negative(n_), force_sign) &&
+ int_inserter<Radix, CharEncoding, Tag>::call(sink
+ , detail::absolute_value(n_)) &&
+ karma::delimit_out(sink, d); // always do post-delimiting
+ }
+
+ // A int_(1) without any associated attribute just emits its
+ // immediate literal
+ template <typename OutputIterator, typename Context, typename Delimiter>
+ bool generate(OutputIterator& sink, Context&, Delimiter const& d
+ , unused_type) const
+ {
+ return sign_inserter::call(sink, detail::is_zero(n_)
+ , detail::is_negative(n_), force_sign) &&
+ 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;
+
+ 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, false
+ > 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;
+ ///////////////////////////////////////////////////////////////////////////
+ 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
 
- typedef karma::int_generator<true, T, Radix, ForceSign, key_tag> int_type;
- typedef component<karma::domain, int_type, vector_type> type;
+ 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> {};
 
- static type
- call(Elements const& elements)
+ ///////////////////////////////////////////////////////////////////////////
+ namespace detail
+ {
+ template <typename T, typename Modifiers>
+ struct basic_int_literal
         {
- return type(elements);
- }
- };
+ 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 literal_int_generator<
+ T
+ , typename spirit::detail::get_encoding<
+ Modifiers, unused_type, lower || upper>::type
+ , typename detail::get_casetag<Modifiers, lower || upper>::type
+ , 10, false, true
+ > result_type;
+
+ template <typename T_>
+ result_type operator()(T_ i, unused_type) const
+ {
+ return result_type(i);
+ }
+ };
+ }
 
-}}} // namespace boost::spirit::traits
+ template <typename Modifiers>
+ struct make_primitive<short, Modifiers>
+ : detail::basic_int_literal<int, Modifiers> {};
+
+ template <typename Modifiers>
+ struct make_primitive<int, Modifiers>
+ : detail::basic_int_literal<int, Modifiers> {};
+
+ template <typename Modifiers>
+ struct make_primitive<long, Modifiers>
+ : detail::basic_int_literal<long, Modifiers> {};
+
+#ifdef BOOST_HAS_LONG_LONG
+ template <typename Modifiers>
+ struct make_primitive<boost::long_long_type, Modifiers>
+ : detail::basic_int_literal<boost::long_long_type, Modifiers> {};
+#endif
+
+}}}
 
 #endif

Deleted: branches/release/boost/spirit/home/karma/numeric/meta_grammar.hpp
==============================================================================
--- branches/release/boost/spirit/home/karma/numeric/meta_grammar.hpp 2009-09-14 12:50:29 EDT (Mon, 14 Sep 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: branches/release/boost/spirit/home/karma/numeric/numeric_fwd.hpp
==============================================================================
--- branches/release/boost/spirit/home/karma/numeric/numeric_fwd.hpp 2009-09-14 12:50:29 EDT (Mon, 14 Sep 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: branches/release/boost/spirit/home/karma/numeric/real.hpp
==============================================================================
--- branches/release/boost/spirit/home/karma/numeric/real.hpp (original)
+++ branches/release/boost/spirit/home/karma/numeric/real.hpp 2009-09-14 12:50:29 EDT (Mon, 14 Sep 2009)
@@ -6,242 +6,403 @@
 #if !defined(BOOST_SPIRIT_KARMA_REAL_FEB_26_2007_0512PM)
 #define BOOST_SPIRIT_KARMA_REAL_FEB_26_2007_0512PM
 
-#if defined(_MSC_VER) && (_MSC_VER >= 1020)
-#pragma once // MS compatible compilers support #pragma once
+#if defined(_MSC_VER)
+#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/spirit/home/karma/numeric/detail/real_utils.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 = double, 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 <>
+ struct use_terminal<karma::domain, float> // enables lit(1.of)
+ : mpl::true_ {};
+
+ template <>
+ struct use_terminal<karma::domain, double> // enables lit(1.0)
+ : mpl::true_ {};
+
+ template <>
+ struct use_terminal<karma::domain, long double> // enables lit(1.0l)
+ : 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>
+ typedef typename Policies::properties properties;
+
+ 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_SPIRIT_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>
+ typedef typename Policies::properties properties;
+
+ template <typename Context, typename Unused>
         struct attribute
- {
- typedef unused_type type;
- };
+ : mpl::if_c<no_attribute, unused_type, T>
+ {};
 
- 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);
+ literal_real_generator(typename add_const<T>::type n
+ , Policies const& policies = Policies())
+ : n_(n), p_(policies) {}
+
+ // A double_(1.0) which additionally has an associated attribute emits
+ // its immediate literal only if it matches the attribute, otherwise
+ // it fails.
+ template <typename OutputIterator, typename Context, typename Delimiter
+ , typename Attribute>
+ bool generate(OutputIterator& sink, Context&, Delimiter const& d
+ , Attribute const& attr) const
+ {
+ if (n_ != attr)
+ return false;
+
+ 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
+ }
 
- karma::delimit(sink, d); // always do post-delimiting
- return result;
+ // A double_(1.0) without any associated attribute just emits its
+ // immediate literal
+ template <typename OutputIterator, typename Context, typename Delimiter>
+ bool generate(OutputIterator& sink, Context&, Delimiter const& d
+ , unused_type) 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;
+
+ 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
+ , false
+ > 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;
+ ///////////////////////////////////////////////////////////////////////////
+ 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> {};
 
- static type
- call(Elements const& elements)
+ ///////////////////////////////////////////////////////////////////////////
+ namespace detail
+ {
+ template <typename T, typename Modifiers>
+ struct basic_real_literal
         {
- return type(elements);
- }
- };
+ 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 literal_real_generator<
+ T, real_policies<T>
+ , typename spirit::detail::get_encoding<
+ Modifiers, unused_type, lower || upper>::type
+ , typename detail::get_casetag<Modifiers, lower || upper>::type
+ , true
+ > result_type;
+
+ template <typename T_>
+ result_type operator()(T_ i, unused_type) const
+ {
+ return result_type(i);
+ }
+ };
+ }
+
+ template <typename Modifiers>
+ struct make_primitive<float, Modifiers>
+ : detail::basic_real_literal<float, Modifiers> {};
+
+ template <typename Modifiers>
+ struct make_primitive<double, Modifiers>
+ : detail::basic_real_literal<double, Modifiers> {};
+
+ template <typename Modifiers>
+ struct make_primitive<long double, Modifiers>
+ : detail::basic_real_literal<long double, Modifiers> {};
 
-}}} // namespace boost::spirit::traits
+}}}
 
 #endif // defined(BOOST_SPIRIT_KARMA_REAL_FEB_26_2007_0512PM)

Modified: branches/release/boost/spirit/home/karma/numeric/real_policies.hpp
==============================================================================
--- branches/release/boost/spirit/home/karma/numeric/real_policies.hpp (original)
+++ branches/release/boost/spirit/home/karma/numeric/real_policies.hpp 2009-09-14 12:50:29 EDT (Mon, 14 Sep 2009)
@@ -6,67 +6,123 @@
 #if !defined(BOOST_SPIRIT_KARMA_REAL_POLICIES_MAR_02_2007_0936AM)
 #define BOOST_SPIRIT_KARMA_REAL_POLICIES_MAR_02_2007_0936AM
 
-#if defined(_MSC_VER) && (_MSC_VER >= 1020)
-#pragma once // MS compatible compilers support #pragma once
+#if defined(_MSC_VER)
+#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/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>
+#include <boost/spirit/home/karma/numeric/detail/real_utils.hpp>
+
+#include <boost/mpl/bool.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;
+
+ ///////////////////////////////////////////////////////////////////////
+ // By default the policy doesn't require any special iterator
+ // functionality. The floating point generator exposes its properties
+ // from here, so this needs to be updated in case other properties
+ // need to be implemented.
+ ///////////////////////////////////////////////////////////////////////
+ typedef mpl::int_<generator_properties::no_properties> properties;
+
+ ///////////////////////////////////////////////////////////////////////
         // Specifies, which representation type to use during output
         // generation.
         ///////////////////////////////////////////////////////////////////////
- enum fmtflags
+ struct 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).
+ enum {
+ 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).
+ };
         };
-
+
+ ///////////////////////////////////////////////////////////////////////
+ // This is the main function used to generate the output for a
+ // floating point number. It is called by the real generator in order
+ // to perform the conversion. In theory all of the work can be
+ // implemented here, but it is the easiest to use existing
+ // functionality provided by the type specified by the template
+ // parameter `Inserter`.
+ //
+ // sink: the output iterator to use for generation
+ // n: the floating point number to convert
+ // p: the instance of the policy type used to instantiate this
+ // floating point generator.
+ ///////////////////////////////////////////////////////////////////////
+ template <typename Inserter, typename OutputIterator, typename Policies>
+ static bool
+ call (OutputIterator& sink, T n, Policies const& p)
+ {
+ return Inserter::call_n(sink, n, p);
+ }
+
         ///////////////////////////////////////////////////////////////////////
         // The default behavior is to not to require generating a sign. If
- // 'force_sign' is specified as true, then all generated numbers will
+ // 'force_sign()' returns true, then all generated numbers will
         // have a sign ('+' or '-', zeros will have a space instead of a sign)
+ //
+ // 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 force_sign = false;
-
+ static bool const force_sign(T)
+ {
+ return 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,39 +130,25 @@
         // 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
- // 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.
+ // The function trailing_zeros() 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.
         //
         // n The floating point number to output. This can be used to
         // 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,30 +164,32 @@
         // 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;
         }
 
         ///////////////////////////////////////////////////////////////////////
         // Generate the integer part of the number.
         //
- // sink The output iterator to use for generation
- // n The absolute value of the integer part of the floating
- // point number to convert (always non-negative).
- // sign The sign of the overall floating point number to convert.
+ // sink The output iterator to use for generation
+ // n The absolute value of the integer part of the floating
+ // point number to convert (always non-negative).
+ // sign The sign of the overall floating point number to
+ // convert.
+ // force_sign Whether a sign has to be generated even for
+ // non-negative numbers
         ///////////////////////////////////////////////////////////////////////
- template <bool ForceSign, typename OutputIterator>
- static bool
- integer_part (OutputIterator& sink, T n, bool sign)
+ template <typename OutputIterator>
+ static bool integer_part (OutputIterator& sink, T n, bool sign
+ , bool force_sign)
         {
- return sign_inserter<ForceSign>::call(
- sink, detail::is_zero(n), sign) &&
+ return sign_inserter::call(
+ sink, detail::is_zero(n), sign, force_sign) &&
                    int_inserter<10>::call(sink, n);
         }
-
+
         ///////////////////////////////////////////////////////////////////////
         // Generate the decimal point.
         //
@@ -156,6 +200,8 @@
         // to the value returned from the precision() function
         // earlier. I.e. a fractional part of 0.01234 is
         // represented as 1234 when the 'Precision' is 5.
+ // precision The number of digits to emit as returned by the
+ // function 'precision()' above
         //
         // This is given to allow to decide, whether a decimal point
         // has to be generated at all.
@@ -165,12 +211,11 @@
         // function below.
         ///////////////////////////////////////////////////////////////////////
         template <typename OutputIterator>
- static bool
- dot (OutputIterator& sink, T)
+ static bool dot (OutputIterator& sink, T /*n*/, unsigned /*precision*/)
         {
             return char_inserter<>::call(sink, '.'); // generate the dot by default
         }
-
+
         ///////////////////////////////////////////////////////////////////////
         // Generate the fractional part of the number.
         //
@@ -180,14 +225,17 @@
         // the number of units which correspond to the 'Precision'.
         // I.e. a fractional part of 0.01234 is represented as 1234
         // when the 'precision_' parameter is 5.
- //
- // Note: If the trailing_zeros flag is not returned from the
- // floatfield() function, the 'precision_' parameter will have
- // been corrected from the value the precision() function
- // returned earlier (defining the maximal number of fractional
- // digits) in the sense, that it takes into account trailing
- // zeros. I.e. a floating point number 0.0123 and a value of 5
- // returned from precision() will result in:
+ // precision_ The corrected number of digits to emit (see note
+ // below)
+ // precision The number of digits to emit as returned by the
+ // function 'precision()' above
+ //
+ // Note: If trailing_zeros() does not return true the 'precision_'
+ // parameter will have been corrected from the value the
+ // precision() function returned earlier (defining the maximal
+ // number of fractional digits) in the sense, that it takes into
+ // account trailing zeros. I.e. a floating point number 0.0123
+ // and a value of 5 returned from precision() will result in:
         //
         // trailing_zeros is not specified:
         // n 123
@@ -199,8 +247,8 @@
         //
         ///////////////////////////////////////////////////////////////////////
         template <typename OutputIterator>
- static bool
- fraction_part (OutputIterator& sink, T n, unsigned precision_)
+ static bool fraction_part (OutputIterator& sink, T n
+ , unsigned precision_, unsigned precision)
         {
             // allow for ADL to find the correct overload for floor and log10
             using namespace std;
@@ -208,12 +256,14 @@
             // 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)
                 r = char_inserter<>::call(sink, '0');
- return r && int_inserter<10>::call(sink, n);
+ if (precision && r)
+ r = int_inserter<10>::call(sink, n);
+ return r;
         }
 
         ///////////////////////////////////////////////////////////////////////
@@ -229,18 +279,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') &&
- sign_inserter<false>::call(
- sink, detail::is_zero(n), detail::is_negative(n));
+ long abs_n = detail::absolute_value(n);
+ bool r = char_inserter<CharEncoding, Tag>::call(sink, 'e') &&
+ sign_inserter::call(sink, detail::is_zero(n)
+ , detail::is_negative(n), false);
 
             // 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);
         }
 
@@ -248,9 +297,11 @@
         // Print the textual representations for non-normal floats (NaN and
         // Inf)
         //
- // sink The output iterator to use for generation
- // n The (signed) floating point number to convert.
- //
+ // sink The output iterator to use for generation
+ // n The (signed) floating point number to convert.
+ // force_sign Whether a sign has to be generated even for
+ // non-negative numbers
+ //
         // The Tag template parameter is either of the type unused_type or
         // describes the character class and conversion to be applied to any
         // output possibly influenced by either the lower[...] or upper[...]
@@ -259,25 +310,23 @@
         // 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)
- {
- return sign_inserter<ForceSign>::call(
- sink, false, detail::is_negative(n)) &&
- string_inserter<Tag>::call(sink, "nan");
- }
-
- template <bool ForceSign, 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");
+ template <typename CharEncoding, typename Tag, typename OutputIterator>
+ static bool nan (OutputIterator& sink, T n, bool force_sign)
+ {
+ return sign_inserter::call(
+ sink, false, detail::is_negative(n), force_sign) &&
+ string_inserter<CharEncoding, Tag>::call(sink, "nan");
+ }
+
+ template <typename CharEncoding, typename Tag, typename OutputIterator>
+ static bool inf (OutputIterator& sink, T n, bool force_sign)
+ {
+ return sign_inserter::call(
+ sink, false, detail::is_negative(n), force_sign) &&
+ string_inserter<CharEncoding, Tag>::call(sink, "inf");
         }
     };
-
+
 }}}
 
 #endif // defined(BOOST_SPIRIT_KARMA_REAL_POLICIES_MAR_02_2007_0936AM)

Modified: branches/release/boost/spirit/home/karma/numeric/uint.hpp
==============================================================================
--- branches/release/boost/spirit/home/karma/numeric/uint.hpp (original)
+++ branches/release/boost/spirit/home/karma/numeric/uint.hpp 2009-09-14 12:50:29 EDT (Mon, 14 Sep 2009)
@@ -6,219 +6,494 @@
 #if !defined(BOOST_SPIRIT_KARMA_UINT_FEB_23_2007_0840PM)
 #define BOOST_SPIRIT_KARMA_UINT_FEB_23_2007_0840PM
 
-#if defined(_MSC_VER) && (_MSC_VER >= 1020)
-#pragma once // MS compatible compilers support #pragma once
+#if defined(_MSC_VER)
+#pragma once
 #endif
 
 #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 int, 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 <> // enables lit(unsigned short(0))
+ struct use_terminal<karma::domain, unsigned short>
+ : mpl::true_ {};
+
+ template <> // enables lit(0U)
+ struct use_terminal<karma::domain, unsigned int>
+ : mpl::true_ {};
+
+ template <> // enables lit(0UL)
+ struct use_terminal<karma::domain, unsigned long>
+ : mpl::true_ {};
+
+#ifdef BOOST_HAS_LONG_LONG
+ template <> // enables lit(0ULL)
+ struct use_terminal<karma::domain, boost::ulong_long_type>
+ : 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;
+
+ using spirit::lit; // lit(1U) is equivalent to 1U
+
+ ///////////////////////////////////////////////////////////////////////////
+ // 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
- BOOST_MPL_ASSERT_MSG(
+ // check template Attribute 'Radix' for validity
+ BOOST_SPIRIT_ASSERT_MSG(
             Radix == 2 || Radix == 8 || Radix == 10 || Radix == 16,
             not_supported_radix, ());
 
- BOOST_MPL_ASSERT_MSG(!std::numeric_limits<T>::is_signed,
+ BOOST_SPIRIT_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_SPIRIT_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;
- };
+ : mpl::if_c<no_attribute, unused_type, T>
+ {};
 
- // check template parameter 'Radix' for validity
- BOOST_MPL_ASSERT_MSG(
+ literal_uint_generator(typename add_const<T>::type n)
+ : n_(n) {}
+
+ // check template Attribute 'Radix' for validity
+ BOOST_SPIRIT_ASSERT_MSG(
             Radix == 2 || Radix == 8 || Radix == 10 || Radix == 16,
             not_supported_radix, ());
 
- BOOST_MPL_ASSERT_MSG(!std::numeric_limits<T>::is_signed,
+ BOOST_SPIRIT_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*/)
+ // A uint(1U) which additionally has an associated attribute emits
+ // its immediate literal only if it matches the attribute, otherwise
+ // it fails.
+ template <typename OutputIterator, typename Context, typename Delimiter
+ , typename Attribute>
+ bool generate(OutputIterator& sink, Context&, Delimiter const& d
+ , Attribute const& attr) const
         {
- 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;
+ if (n_ != attr)
+ return false;
+
+ 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)
+ // A uint(1U) without any associated attribute just emits its
+ // immediate literal
+ template <typename OutputIterator, typename Context, typename Delimiter>
+ bool generate(OutputIterator& sink, Context&, Delimiter const& d
+ , unused_type) const
         {
- return "unsigned integer";
+ return int_inserter<Radix, CharEncoding, Tag>::call(sink, n_) &&
+ karma::delimit_out(sink, d); // always do post-delimiting
         }
- };
 
-}}}
-
-namespace boost { namespace spirit { namespace traits
-{
- ///////////////////////////////////////////////////////////////////////////
- // lower_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::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;
-
- static type
- call(Elements const&)
+ template <typename Context>
+ static info what(Context const& ctx)
         {
- return type(fusion::nil());
+ return info("unsigned-integer");
         }
- };
 
- 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;
+ T n_;
+ };
 
- typedef karma::uint_generator<true, T, Radix, ForceSign, key_tag> int_type;
- typedef component<karma::domain, int_type, vector_type> type;
+ ///////////////////////////////////////////////////////////////////////////
+ // Generator generators: make_xxx function (objects)
+ ///////////////////////////////////////////////////////////////////////////
+ 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& elements)
+ result_type operator()(unused_type, unused_type) const
         {
- return type(elements);
+ return result_type();
         }
     };
 
     ///////////////////////////////////////////////////////////////////////////
- // 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;
+ 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
 
- typedef karma::uint_generator<false, T, Radix, ForceSign, key_tag> int_type;
- typedef component<karma::domain, int_type, fusion::nil> type;
+ template <typename T, unsigned Radix, typename Modifiers>
+ struct make_primitive<tag::uint_tag<T, Radix>, Modifiers>
+ : make_uint<T, Modifiers, Radix> {};
 
- static type
- call(Elements const&)
+ ///////////////////////////////////////////////////////////////////////////
+ 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;
+
+ 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, 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));
         }
     };
 
- 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;
+ 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
 
- typedef karma::uint_generator<true, T, Radix, ForceSign, key_tag> int_type;
- typedef component<karma::domain, int_type, vector_type> type;
+ 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> {};
 
- static type
- call(Elements const& elements)
+ namespace detail
+ {
+ template <typename T, typename Modifiers>
+ struct basic_uint_literal
         {
- return type(elements);
- }
- };
+ 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 literal_uint_generator<
+ T
+ , typename spirit::detail::get_encoding<
+ Modifiers, unused_type, lower || upper>::type
+ , typename detail::get_casetag<Modifiers, lower || upper>::type
+ , 10, true
+ > result_type;
+
+ template <typename T_>
+ result_type operator()(T_ i, unused_type) const
+ {
+ return result_type(i);
+ }
+ };
+ }
 
-}}} // namespace boost::spirit::traits
+ template <typename Modifiers>
+ struct make_primitive<unsigned short, Modifiers>
+ : detail::basic_uint_literal<unsigned short, Modifiers> {};
+
+ template <typename Modifiers>
+ struct make_primitive<unsigned int, Modifiers>
+ : detail::basic_uint_literal<unsigned int, Modifiers> {};
+
+ template <typename Modifiers>
+ struct make_primitive<unsigned long, Modifiers>
+ : detail::basic_uint_literal<unsigned long, Modifiers> {};
+
+#ifdef BOOST_HAS_LONG_LONG
+ template <typename Modifiers>
+ struct make_primitive<boost::ulong_long_type, Modifiers>
+ : detail::basic_uint_literal<boost::ulong_long_type, Modifiers> {};
+#endif
+
+}}}
 
 #endif

Modified: branches/release/boost/spirit/home/karma/operator.hpp
==============================================================================
--- branches/release/boost/spirit/home/karma/operator.hpp (original)
+++ branches/release/boost/spirit/home/karma/operator.hpp 2009-09-14 12:50:29 EDT (Mon, 14 Sep 2009)
@@ -6,16 +6,17 @@
 #if !defined(BOOST_SPIRIT_KARMA_OPERATOR_FEB_28_2007_0351PM)
 #define BOOST_SPIRIT_KARMA_OPERATOR_FEB_28_2007_0351PM
 
-#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/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: branches/release/boost/spirit/home/karma/operator/alternative.hpp
==============================================================================
--- branches/release/boost/spirit/home/karma/operator/alternative.hpp (original)
+++ branches/release/boost/spirit/home/karma/operator/alternative.hpp 2009-09-14 12:50:29 EDT (Mon, 14 Sep 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)
@@ -7,74 +7,134 @@
 #if !defined(SPIRIT_KARMA_ALTERNATIVE_MAR_01_2007_1117AM)
 #define SPIRIT_KARMA_ALTERNATIVE_MAR_01_2007_1117AM
 
-#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/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>
+#include <boost/mpl/accumulate.hpp>
+#include <boost/mpl/bitor.hpp>
 
-namespace boost { namespace spirit { namespace karma
+namespace boost { namespace spirit
 {
- struct alternative
- {
- template <typename T>
- struct transform_child : mpl::identity<T> {};
+ ///////////////////////////////////////////////////////////////////////////
+ // 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_ {};
 
- template <typename All, typename Filtered>
- struct build_container
+}}
+
+///////////////////////////////////////////////////////////////////////////////
+namespace boost { namespace spirit { namespace traits
+{
+ // specialization for sequences
+ template <typename Elements>
+ struct alternative_properties
+ {
+ struct element_properties
         {
- // 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;
+ template <typename T>
+ struct result;
+
+ template <typename F, typename Element>
+ struct result<F(Element)>
+ {
+ typedef properties_of<Element> type;
+ };
+
+ // never called, but needed for decltype-based result_of (C++0x)
+ template <typename Element>
+ typename result<element_properties(Element)>::type
+ operator()(Element&) const;
         };
 
- template <typename Component, typename Context, typename Iterator>
- struct attribute :
- build_fusion_sequence<alternative, Component, Iterator, Context>
+ typedef typename mpl::accumulate<
+ typename fusion::result_of::transform<
+ Elements, element_properties>::type
+ , mpl::int_<karma::generator_properties::countingbuffer>
+ , mpl::bitor_<mpl::_2, mpl::_1>
+ >::type type;
+ };
+
+}}}
+
+namespace boost { namespace spirit { namespace karma
+{
+ template <typename Elements>
+ struct alternative : nary_generator<alternative<Elements> >
+ {
+ typedef typename traits::alternative_properties<Elements>::type
+ properties;
+
+ template <typename Context, typename Iterator = unused_type>
+ struct attribute
         {
+ // 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 traits::build_variant<all_attributes>::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)
+ alternative(Elements const& elements)
+ : elements(elements) {}
+
+ 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

Deleted: branches/release/boost/spirit/home/karma/operator/karma-alt.zip
==============================================================================
Binary file. No diff available.

Modified: branches/release/boost/spirit/home/karma/operator/kleene.hpp
==============================================================================
--- branches/release/boost/spirit/home/karma/operator/kleene.hpp (original)
+++ branches/release/boost/spirit/home/karma/operator/kleene.hpp 2009-09-14 12:50:29 EDT (Mon, 14 Sep 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,86 +7,93 @@
 #if !defined(BOOST_SPIRIT_KARMA_KLEENE_MAR_03_2007_0337AM)
 #define BOOST_SPIRIT_KARMA_KLEENE_MAR_03_2007_0337AM
 
-#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/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/karma/detail/output_iterator.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 <boost/spirit/home/support/attributes.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;
- };
-
- template <typename Component, typename Context, typename Iterator>
- struct attribute :
- build_container<kleene, Component, Iterator, Context>
- {
- };
+ typedef Subject subject_type;
+ typedef typename subject_type::properties properties;
 
- 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)
+ // 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.
+ template <typename Context, typename Iterator>
+ struct attribute
+ : traits::build_std_vector<
+ typename traits::attribute_of<Subject, Context, Iterator>::type
+ >
+ {};
+
+ 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
+ // kleene fails only if the underlying output 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;
+ return detail::sink_is_good(sink);
         }
 
- // 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: branches/release/boost/spirit/home/karma/operator/list.hpp
==============================================================================
--- branches/release/boost/spirit/home/karma/operator/list.hpp (original)
+++ branches/release/boost/spirit/home/karma/operator/list.hpp 2009-09-14 12:50:29 EDT (Mon, 14 Sep 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,90 +7,101 @@
 #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>
+#if defined(_MSC_VER)
+#pragma once
+#endif
+
+#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 <boost/spirit/home/support/attributes.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>
+ typedef mpl::int_<
+ left_type::properties::value | right_type::properties::value
+ > properties;
+
+ // 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.
+ template <typename Context, typename Iterator>
+ struct attribute
+ : traits::build_std_vector<
+ typename traits::attribute_of<Left, Context, Iterator>::type
+ >
+ {};
+
+ list(Left const& left, Right const& right)
+ : left(left), right(right) {}
+
+ 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;
 
- 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
- spirit::result_of::left<Component>::type::director
- ldirector;
-
- typedef typename
- spirit::result_of::right<Component>::type::director
- rdirector;
-
- typedef typename
- container::result_of::iterator<Parameter const>::type
- iterator_type;
-
- iterator_type it = container::begin(param);
- iterator_type end = container::end(param);
-
- bool result = !container::compare(it, end);
- if (result && ldirector::generate(
- spirit::left(component), sink, ctx, d, container::deref(it)))
+ iterator_type it = traits::begin(attr);
+ iterator_type end = traits::end(attr);
+
+ 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: branches/release/boost/spirit/home/karma/operator/meta_grammar.hpp
==============================================================================
--- branches/release/boost/spirit/home/karma/operator/meta_grammar.hpp 2009-09-14 12:50:29 EDT (Mon, 14 Sep 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

Modified: branches/release/boost/spirit/home/karma/operator/optional.hpp
==============================================================================
--- branches/release/boost/spirit/home/karma/operator/optional.hpp (original)
+++ branches/release/boost/spirit/home/karma/operator/optional.hpp 2009-09-14 12:50:29 EDT (Mon, 14 Sep 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,30 +7,47 @@
 #if !defined(SPIRIT_KARMA_OPTIONAL_MARCH_31_2007_0852AM)
 #define SPIRIT_KARMA_OPTIONAL_MARCH_31_2007_0852AM
 
-#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/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/spirit/home/support/unused.hpp>
+#include <boost/spirit/home/support/attributes.hpp>
 #include <boost/mpl/assert.hpp>
 #include <boost/optional.hpp>
+#include <boost/type_traits/is_convertible.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 +58,17 @@
             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 +80,53 @@
         }
     }
 
- 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;
+ typedef typename subject_type::properties properties;
 
- template <typename Component, typename Context, typename Iterator>
- struct attribute :
- build_container<optional, 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)
- {
- typedef typename
- result_of::subject<Component>::type::director
- director;
-
- if (detail::optional_is_valid(param))
- {
- director::generate(subject(component), sink, ctx, d,
- detail::optional_get(param));
- }
- return true;
- }
+ // 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.
+ template <typename Context, typename Iterator = unused_type>
+ struct attribute
+ : traits::build_optional<
+ typename traits::attribute_of<Subject, Context, Iterator>::type
+ >
+ {};
 
- template <typename Component, typename Context>
- static std::string what(Component const& component, Context const& ctx)
+ optional(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
         {
- std::string result = "optional[";
+ if (detail::optional_is_valid(attr))
+ subject.generate(sink, ctx, d, detail::optional_get(attr));
+ return sink_is_good(sink);
+ }
 
- typedef typename
- spirit::result_of::subject<Component>::type::director
- director;
-
- result += director::what(spirit::subject(component), ctx);
- result += "]";
- return result;
+ template <typename Context>
+ info what(Context& context) const
+ {
+ 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: branches/release/boost/spirit/home/karma/operator/plus.hpp
==============================================================================
--- branches/release/boost/spirit/home/karma/operator/plus.hpp (original)
+++ branches/release/boost/spirit/home/karma/operator/plus.hpp 2009-09-14 12:50:29 EDT (Mon, 14 Sep 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,89 +7,98 @@
 #if !defined(BOOST_SPIRIT_KARMA_POSITIVE_MAR_03_2007_0945PM)
 #define BOOST_SPIRIT_KARMA_POSITIVE_MAR_03_2007_0945PM
 
-#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/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/karma/detail/output_iterator.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/spirit/home/support/attributes.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;
- };
-
- template <typename Component, typename Context, typename Iterator>
- struct attribute :
- build_container<plus, Component, Iterator, Context>
- {
- };
+ typedef Subject subject_type;
+ typedef typename subject_type::properties properties;
 
- 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)
+ // Build a std::vector from the subjects attribute. Note
+ // that build_std_vector may return unused_type if the
+ // subject's attribute is an unused_type.
+ template <typename Context, typename Iterator>
+ struct attribute
+ : traits::build_std_vector<
+ typename traits::attribute_of<subject_type, Context, Iterator>::type
+ >
+ {};
+
+ 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;
 
+ // from now on plus fails only if the underlying output 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(spirit::subject(component), sink,
- ctx, d, container::deref(it));
+ result = subject.generate(sink, ctx, d, traits::deref(it));
             }
- return result;
+ return detail::sink_is_good(sink);
         }
 
- // 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: branches/release/boost/spirit/home/karma/operator/sequence.hpp
==============================================================================
--- branches/release/boost/spirit/home/karma/operator/sequence.hpp (original)
+++ branches/release/boost/spirit/home/karma/operator/sequence.hpp 2009-09-14 12:50:29 EDT (Mon, 14 Sep 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)
@@ -7,83 +7,188 @@
 #if !defined(SPIRIT_KARMA_SEQUENCE_FEB_28_2007_0247PM)
 #define SPIRIT_KARMA_SEQUENCE_FEB_28_2007_0247PM
 
-#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/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>
+#include <boost/mpl/bitor.hpp>
+#include <boost/mpl/int.hpp>
+#include <boost/fusion/include/transform.hpp>
+#include <boost/mpl/accumulate.hpp>
 
-namespace boost { namespace spirit { namespace karma
+///////////////////////////////////////////////////////////////////////////////
+namespace boost { namespace spirit
 {
- struct sequence
- {
- template <typename T>
- struct transform_child : mpl::identity<T> {};
+ ///////////////////////////////////////////////////////////////////////////
+ // 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_ {};
 
- template <typename All, typename Filtered>
- struct build_container
+}}
+
+///////////////////////////////////////////////////////////////////////////////
+namespace boost { namespace spirit { namespace traits
+{
+ // specialization for sequences
+ template <typename Elements>
+ struct sequence_properties
+ {
+ struct element_properties
         {
- typedef
- typename fusion::result_of::as_vector<Filtered>::type
- type;
+ template <typename T>
+ struct result;
+
+ template <typename F, typename Element>
+ struct result<F(Element)>
+ {
+ typedef properties_of<Element> type;
+ };
+
+ // never called, but needed for decltype-based result_of (C++0x)
+ template <typename Element>
+ typename result<element_properties(Element)>::type
+ operator()(Element&) const;
         };
 
- template <typename Component, typename Context, typename Iterator>
- struct attribute :
- build_fusion_sequence<
- sequence, Component, Iterator, Context, mpl::true_
- >
+ typedef typename mpl::accumulate<
+ typename fusion::result_of::transform<
+ Elements, element_properties>::type
+ , mpl::int_<karma::generator_properties::no_properties>
+ , mpl::bitor_<mpl::_2, mpl::_1>
+ >::type type;
+ };
+
+}}}
+
+///////////////////////////////////////////////////////////////////////////////
+namespace boost { namespace spirit { namespace karma
+{
+ template <typename Elements>
+ struct sequence : nary_generator<sequence<Elements> >
+ {
+ typedef typename traits::sequence_properties<Elements>::type properties;
+
+ sequence(Elements const& elements)
+ : elements(elements) {}
+
+ typedef Elements elements_type;
+ struct sequence_base_id;
+
+ template <typename Context, typename Iterator = unused_type>
+ struct attribute
         {
+ // 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 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 or if the
+ // attribute of this sequence is a single element tuple
+ typedef typename attribute<Context>::type_ attr_type_;
+ typename traits::wrap_if_not_tuple<Attribute
+ , typename traits::one_element_sequence<attr_type_>::type
+ >::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

Modified: branches/release/boost/spirit/home/karma/stream.hpp
==============================================================================
--- branches/release/boost/spirit/home/karma/stream.hpp (original)
+++ branches/release/boost/spirit/home/karma/stream.hpp 2009-09-14 12:50:29 EDT (Mon, 14 Sep 2009)
@@ -6,12 +6,13 @@
 #if !defined(BOOST_SPIRIT_KARMA_STREAM_MAY_01_2007_1254AM)
 #define BOOST_SPIRIT_KARMA_STREAM_MAY_01_2007_1254AM
 
-#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/stream/format_manip.hpp>
+#include <boost/spirit/home/karma/stream/format_manip_attr.hpp>
+#include <boost/spirit/home/karma/stream/ostream_iterator.hpp>
 #include <boost/spirit/home/karma/stream/stream.hpp>
-#include <boost/spirit/home/karma/stream/meta_grammar.hpp>
 
 #endif

Modified: branches/release/boost/spirit/home/karma/stream/detail/format_manip.hpp
==============================================================================
--- branches/release/boost/spirit/home/karma/stream/detail/format_manip.hpp (original)
+++ branches/release/boost/spirit/home/karma/stream/detail/format_manip.hpp 2009-09-14 12:50:29 EDT (Mon, 14 Sep 2009)
@@ -6,89 +6,111 @@
 #if !defined(BOOST_SPIRIT_KARMA_FORMAT_MANIP_MAY_03_2007_1424PM)
 #define BOOST_SPIRIT_KARMA_FORMAT_MANIP_MAY_03_2007_1424PM
 
+#if defined(_MSC_VER)
+#pragma once
+#endif
+
 #include <iterator>
 #include <string>
-#include <boost/spirit/home/karma/detail/ostream_iterator.hpp>
+#include <boost/spirit/home/karma/generate.hpp>
+#include <boost/spirit/home/karma/stream/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);
+ karma::ostream_iterator<Char, Char, Traits> sink(os);
         if (!karma::generate (sink, fm.expr))
         {
             os.setstate(std::ios_base::failbit);
         }
         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))
+ karma::ostream_iterator<Char, Char, Traits> sink(os);
+ 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))
+ karma::ostream_iterator<Char, Char, Traits> sink(os);
+ 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))
+ karma::ostream_iterator<Char, Char, Traits> sink(os);
+ if (!karma::generate_delimited(sink, fm.expr, fm.delim, fm.pre, fm.attr))
         {
             os.setstate(std::ios_base::failbit);
         }
         return os;
     }
-
+
 }}}}
 
 #endif

Deleted: branches/release/boost/spirit/home/karma/stream/detail/iterator_ostream.hpp
==============================================================================
--- branches/release/boost/spirit/home/karma/stream/detail/iterator_ostream.hpp 2009-09-14 12:50:29 EDT (Mon, 14 Sep 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

Modified: branches/release/boost/spirit/home/karma/stream/format_manip.hpp
==============================================================================
--- branches/release/boost/spirit/home/karma/stream/format_manip.hpp (original)
+++ branches/release/boost/spirit/home/karma/stream/format_manip.hpp 2009-09-14 12:50:29 EDT (Mon, 14 Sep 2009)
@@ -6,13 +6,15 @@
 #if !defined(BOOST_SPIRIT_KARMA_FORMAT_MANIP_MAY_01_2007_1211PM)
 #define BOOST_SPIRIT_KARMA_FORMAT_MANIP_MAY_01_2007_1211PM
 
+#if defined(_MSC_VER)
+#pragma once
+#endif
+
 #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 +23,95 @@
     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;
+ using karma::detail::format_manip;
 
- // report invalid expression error as early as possible
- BOOST_MPL_ASSERT_MSG(is_component::value,
- xpr_is_not_convertible_to_a_generator, (Expr, Parameter));
-
- 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)
+ {
+ 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>(
+ 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)
     {
- 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, 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))
+ typedef traits::properties_of<
+ typename result_of::compile<karma::domain, Derived>::type
+ > properties;
+ typedef karma::ostream_iterator<Char, Char, Traits> outiter_type;
+
+ outiter_type target_sink(os);
+ karma::detail::output_iterator<outiter_type, properties> sink(target_sink);
+
+ if (!g.derived().generate(sink, unused, unused, unused))
         {
             os.setstate(std::ios_base::failbit);
         }
         return os;
     }
-
+
 }}}
 
 #endif

Deleted: branches/release/boost/spirit/home/karma/stream/meta_grammar.hpp
==============================================================================
--- branches/release/boost/spirit/home/karma/stream/meta_grammar.hpp 2009-09-14 12:50:29 EDT (Mon, 14 Sep 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: branches/release/boost/spirit/home/karma/stream/stream.hpp
==============================================================================
--- branches/release/boost/spirit/home/karma/stream/stream.hpp (original)
+++ branches/release/boost/spirit/home/karma/stream/stream.hpp 2009-09-14 12:50:29 EDT (Mon, 14 Sep 2009)
@@ -6,185 +6,338 @@
 #if !defined(BOOST_SPIRIT_KARMA_STREAM_MAY_01_2007_0310PM)
 #define BOOST_SPIRIT_KARMA_STREAM_MAY_01_2007_0310PM
 
-#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/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/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)
+ namespace tag
+ {
+ template <typename Char = char>
+ struct stream_tag {};
+ }
+
+ namespace karma
     {
- return os;
+ ///////////////////////////////////////////////////////////////////////
+ // This one is the class that the user can instantiate directly in
+ // order to create a customized int generator
+ template <typename Char = char>
+ struct stream_generator
+ : spirit::terminal<tag::stream_tag<Char> >
+ {};
     }
 
+ ///////////////////////////////////////////////////////////////////////////
+ // 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_ {};
+
+ // enables stream_generator<char_type>
+ template <typename Char>
+ struct use_terminal<karma::domain, tag::stream_tag<Char> >
+ : mpl::true_ {};
+
+ template <typename Char, typename A0>
+ struct use_terminal<karma::domain
+ , terminal_ex<tag::stream_tag<Char>, fusion::vector1<A0> >
+ > : mpl::true_ {};
+
+ template <typename Char>
+ struct use_lazy_terminal<
+ karma::domain, tag::stream_tag<Char>, 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 any_stream_generator
+ : primitive_generator<any_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)
+ // any_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 Properties, 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)
+ karma::ostream_iterator<T, Char, Traits>, Properties
+ >& sink, Context&, Delimiter const& d, Attribute const& attr)
         {
             typedef karma::detail::output_iterator<
- karma::detail::ostream_iterator<T, Char, Traits>
+ karma::ostream_iterator<T, Char, Traits>, Properties
> 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));
+ BOOST_SPIRIT_ASSERT_MSG(false, stream_not_usable_without_attribute,
+ (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 lit_stream_generator
+ : primitive_generator<lit_stream_generator<T, Char, CharEncoding, Tag> >
     {
- template <typename Component, typename Context, typename Unused>
- struct attribute
+ template <typename Context, typename Unused>
+ struct attribute
         {
             typedef unused_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&)
+ lit_stream_generator(typename add_reference<T>::type t)
+ : t_(t)
+ {}
+
+ // lit_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 Properties
+ , 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::ostream_iterator<T1, Char, Traits>, Properties
+ >& sink, Context&, Delimiter const& d, Attribute const&)
         {
             typedef karma::detail::output_iterator<
- karma::detail::ostream_iterator<T, Char, Traits>
+ karma::ostream_iterator<T1, Char, Traits>, Properties
> 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 "stream";
+ 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 any_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> {};
+
+ // any_stream_generator<char_type>
+ template <typename Char, typename Modifiers>
+ struct make_primitive<tag::stream_tag<Char>, Modifiers>
+ : make_stream<Char, 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 lit_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 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> {};
+
+ // any_stream_generator<char_type>(...)
+ template <typename Char, typename Modifiers, typename A0>
+ struct make_primitive<
+ terminal_ex<tag::stream_tag<Char>, fusion::vector1<A0> >
+ , Modifiers>
+ : make_any_stream<Char, A0, Modifiers> {};
+
 }}}
 
 #endif

Modified: branches/release/boost/spirit/home/karma/string.hpp
==============================================================================
--- branches/release/boost/spirit/home/karma/string.hpp (original)
+++ branches/release/boost/spirit/home/karma/string.hpp 2009-09-14 12:50:29 EDT (Mon, 14 Sep 2009)
@@ -6,11 +6,10 @@
 #if !defined(BOOST_SPIRIT_KARMA_STRING_FEB_23_2007_0156PM)
 #define BOOST_SPIRIT_KARMA_STRING_FEB_23_2007_0156PM
 
-#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/string/lit.hpp>
-#include <boost/spirit/home/karma/string/meta_grammar.hpp>
 
 #endif

Modified: branches/release/boost/spirit/home/karma/string/lit.hpp
==============================================================================
--- branches/release/boost/spirit/home/karma/string/lit.hpp (original)
+++ branches/release/boost/spirit/home/karma/string/lit.hpp 2009-09-14 12:50:29 EDT (Mon, 14 Sep 2009)
@@ -6,305 +6,317 @@
 #if !defined(BOOST_SPIRIT_KARMA_LIT_FEB_22_2007_0534PM)
 #define BOOST_SPIRIT_KARMA_LIT_FEB_22_2007_0534PM
 
-#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/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/spirit/home/karma/detail/string_compare.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 string 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_SPIRIT_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>
- struct attribute
- {
- typedef unused_type type;
- };
+ 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 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));
+ template <typename Context, typename Unused>
+ struct attribute
+ : mpl::if_c<no_attribute, unused_type, string_type>
+ {};
 
- karma::delimit(sink, d); // always do post-delimiting
- return result;
+ literal_string(typename add_reference<String>::type str)
+ : str_(str)
+ {}
+
+ // A string("...") which additionally has an associated attribute emits
+ // its immediate literal only if it matches the attribute, otherwise
+ // it fails.
+ template <
+ typename OutputIterator, typename Context, typename Delimiter
+ , typename Attribute>
+ bool generate(OutputIterator& sink, Context&, Delimiter const& d
+ , Attribute const& attr) const
+ {
+ // fail if attribute isn't matched my immediate literal
+ using spirit::traits::get_c_string;
+ if (!detail::string_compare(get_c_string(attr), get_c_string(str_)
+ , char_encoding(), Tag()))
+ {
+ return false;
+ }
+ return detail::string_generate(sink, str_, char_encoding(), Tag()) &&
+ karma::delimit_out(sink, d); // always do post-delimiting
         }
 
- template <typename Component, typename Context>
- static std::string what(Component const& component, Context const& ctx)
+ // A string("...") without any associated attribute just emits its
+ // immediate literal
+ template <typename OutputIterator, typename Context, typename Delimiter>
+ bool generate(OutputIterator& sink, Context&, Delimiter const& d
+ , unused_type) 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)
+ literal_string(typename add_reference<String>::type str)
+ : str_(str) {}
+
+ // A string("...") which additionally has an associated attribute emits
+ // its immediate literal only if it matches the attribute, otherwise
+ // it fails.
+ template <
+ typename OutputIterator, typename Context, typename Delimiter
+ , typename Attribute>
+ bool generate(OutputIterator& sink, Context&, Delimiter const& d
+ , Attribute const& attr) const
         {
- bool result = detail::string_generate(sink, param, Tag());
- karma::delimit(sink, d); // always do post-delimiting
- return result;
+ // fail if attribute isn't matched my immediate literal
+ using spirit::traits::get_c_string;
+ if (!detail::string_compare(get_c_string(attr), get_c_string(str_)))
+ return false;
+
+ return detail::string_generate(sink, str_) &&
+ karma::delimit_out(sink, d); // always do post-delimiting
         }
 
- // 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)
+ // A string("...") without any associated attribute just emits its
+ // immediate literal
+ template <typename OutputIterator, typename Context, typename Delimiter>
+ bool generate(OutputIterator& sink, Context&, Delimiter const& d
+ , unused_type) 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;
-
- 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 lower =
+ has_modifier<Modifiers, tag::char_code_base<tag::lower> >::value;
 
- return type(vector_type(val));
- }
- };
+ static bool const upper =
+ has_modifier<Modifiers, tag::char_code_base<tag::upper> >::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
+ , true
+ > 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;
+
+ 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
+ , false
+ > 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: branches/release/boost/spirit/home/karma/string/meta_grammar.hpp
==============================================================================
--- branches/release/boost/spirit/home/karma/string/meta_grammar.hpp 2009-09-14 12:50:29 EDT (Mon, 14 Sep 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: branches/release/boost/spirit/home/karma/what.hpp
==============================================================================
--- branches/release/boost/spirit/home/karma/what.hpp (original)
+++ branches/release/boost/spirit/home/karma/what.hpp 2009-09-14 12:50:29 EDT (Mon, 14 Sep 2009)
@@ -6,30 +6,27 @@
 #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>
+#if defined(_MSC_VER)
+#pragma once
+#endif
+
 #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: branches/release/boost/spirit/home/lex.hpp
==============================================================================
--- branches/release/boost/spirit/home/lex.hpp (original)
+++ branches/release/boost/spirit/home/lex.hpp 2009-09-14 12:50:29 EDT (Mon, 14 Sep 2009)
@@ -6,13 +6,13 @@
 #if !defined(BOOST_SPIRIT_LEXER_MARCH_22_2007_0929PM)
 #define BOOST_SPIRIT_LEXER_MARCH_22_2007_0929PM
 
-#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/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>
+#include <boost/spirit/home/lex/tokenize_and_parse_attr.hpp>
 
 #endif

Modified: branches/release/boost/spirit/home/lex/domain.hpp
==============================================================================
--- branches/release/boost/spirit/home/lex/domain.hpp (original)
+++ branches/release/boost/spirit/home/lex/domain.hpp 2009-09-14 12:50:29 EDT (Mon, 14 Sep 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,15 +7,25 @@
 #if !defined(BOOST_SPIRIT_LEX_DOMAIN_MAR_13_2007_0140PM)
 #define BOOST_SPIRIT_LEX_DOMAIN_MAR_13_2007_0140PM
 
-#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>
+
 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: branches/release/boost/spirit/home/lex/lexer.hpp
==============================================================================
--- branches/release/boost/spirit/home/lex/lexer.hpp (original)
+++ branches/release/boost/spirit/home/lex/lexer.hpp 2009-09-14 12:50:29 EDT (Mon, 14 Sep 2009)
@@ -6,25 +6,16 @@
 #if !defined(BOOST_SPIRIT_LEXER_MAR_22_2007_1008PM)
 #define BOOST_SPIRIT_LEXER_MAR_22_2007_1008PM
 
-#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/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: branches/release/boost/spirit/home/lex/lexer/action.hpp
==============================================================================
--- branches/release/boost/spirit/home/lex/lexer/action.hpp (original)
+++ branches/release/boost/spirit/home/lex/lexer/action.hpp 2009-09-14 12:50:29 EDT (Mon, 14 Sep 2009)
@@ -6,90 +6,87 @@
 #if !defined(SPIRIT_LEX_ACTION_NOV_18_2007_0743PM)
 #define SPIRIT_LEX_ACTION_NOV_18_2007_0743PM
 
-#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/lex/set_state.hpp>
+#include <boost/spirit/home/lex/meta_compiler.hpp>
+#include <boost/spirit/home/lex/lexer_type.hpp>
+#include <boost/spirit/home/lex/argument.hpp>
+#include <boost/spirit/home/lex/lexer/support_functions.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)
+ template <typename LexerDef, typename String>
+ void collect(LexerDef& lexdef, String const& state) const
         {
- return set_state_functor<Char>(new_state.c_str());
+ // collect the token definition information for the token_def
+ // this action is attached to
+ subject.collect(lexdef, state);
         }
 
- ///////////////////////////////////////////////////////////////////////
- template <typename LexerDef, typename F>
- inline void add_action_helper(LexerDef& lexdef, std::size_t id, F act)
+ template <typename LexerDef>
+ void add_actions(LexerDef& lexdef) const
         {
- 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)
- {
- lexdef.add_action(id, make_set_state(t.name));
+ // call to add all actions attached further down the hierarchy
+ subject.add_actions(lexdef);
+
+ // retrieve the id of the associated token_def and register the
+ // given semantic action with the lexer instance
+ lexdef.add_action(subject.unique_id(), subject.state(), 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: branches/release/boost/spirit/home/lex/lexer/char_token_def.hpp
==============================================================================
--- branches/release/boost/spirit/home/lex/lexer/char_token_def.hpp (original)
+++ branches/release/boost/spirit/home/lex/lexer/char_token_def.hpp 2009-09-14 12:50:29 EDT (Mon, 14 Sep 2009)
@@ -6,35 +6,161 @@
 #if !defined(BOOST_SPIRIT_LEX_CHAR_TOKEN_DEF_MAR_28_2007_0626PM)
 #define BOOST_SPIRIT_LEX_CHAR_TOKEN_DEF_MAR_28_2007_0626PM
 
-#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/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
 {
+ using spirit::lit; // lit('x') is equivalent to 'x'
+
     ///////////////////////////////////////////////////////////////////////////
     //
     // char_token_def
     // represents a single character token definition
     //
     ///////////////////////////////////////////////////////////////////////////
+ template <typename CharEncoding>
     struct char_token_def
+ : primitive_lexer<char_token_def<CharEncoding> >
+ {
+ typedef typename CharEncoding::char_type char_type;
+
+ char_token_def(char_type ch)
+ : ch(ch), unique_id_(std::size_t(~0)) {}
+
+ template <typename LexerDef, typename String>
+ void collect(LexerDef& lexdef, String const& state) const
+ {
+ unique_id_ = lexdef.add_token (state.c_str(), ch
+ , static_cast<std::size_t>(ch));
+ }
+
+ template <typename LexerDef>
+ void add_actions(LexerDef& lexdef) const {}
+
+ std::size_t id() const { return static_cast<std::size_t>(ch); }
+ std::size_t unique_id() const { return unique_id_; }
+
+ char_type ch;
+ mutable std::size_t unique_id_;
+ };
+
+ ///////////////////////////////////////////////////////////////////////////
+ // Lexer generators: make_xxx function (objects)
+ ///////////////////////////////////////////////////////////////////////////
+ namespace detail
     {
- template <typename Component, typename LexerDef, typename String>
- static void
- collect(Component const& component, LexerDef& lexdef,
- String const& state)
+ template <typename CharEncoding>
+ struct basic_literal
         {
- 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));
+ 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: branches/release/boost/spirit/home/lex/lexer/lexer.hpp
==============================================================================
--- branches/release/boost/spirit/home/lex/lexer/lexer.hpp (original)
+++ branches/release/boost/spirit/home/lex/lexer/lexer.hpp 2009-09-14 12:50:29 EDT (Mon, 14 Sep 2009)
@@ -6,79 +6,81 @@
 #if !defined(BOOST_SPIRIT_LEX_LEXER_MAR_13_2007_0145PM)
 #define BOOST_SPIRIT_LEX_LEXER_MAR_13_2007_0145PM
 
-#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/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/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
@@ -86,7 +88,7 @@
                     token_type;
 
                     token_type &t = *first;
- if (token_is_valid(t)) {
+ if (token_is_valid(t) && t.state() == first.get_state()) {
                     // any of the token definitions matched
                         qi::detail::assign_to(t, attr);
                         ++first;
@@ -95,47 +97,58 @@
                 }
                 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)
- token_id = next_id<id_type>::get();
+ if (id_type() == token_id)
+ token_id = def.def.get_next_id();
                     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()) {
- token_id = next_id<id_type>::get();
+ if (id_type() == token_id) {
+ if (id_type() == tokdef.id()) {
+ token_id = def.def.get_next_id();
                             tokdef.id(token_id);
                         }
                         else {
@@ -143,37 +156,30 @@
                         }
                     }
                     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
- {
- def.define(tokset);
- return *this;
- }
 
                 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 +188,29 @@
                 lexer_def_& def;
             };
             friend struct pattern_adder;
-
+
+ private:
+ // Helper function to invoke the necessary 2 step compilation
+ // process on token definition expressions
+ template <typename TokenExpr>
+ void compile2pass(TokenExpr const& expr)
+ {
+ expr.collect(def, state);
+ expr.add_actions(def);
+ }
+
         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);
+ compile2pass(compile<lex::domain>(expr));
             }
 
             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 +221,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 +239,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 +276,73 @@
     }
 
     ///////////////////////////////////////////////////////////////////////////
- // 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
+ struct match_flags
+ {
+ enum enum_type
+ {
+ 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
+ };
+ };
+
+ ///////////////////////////////////////////////////////////////////////////
+ // This represents a lexer object
     ///////////////////////////////////////////////////////////////////////////
+
+ ///////////////////////////////////////////////////////////////////////////
+ // This is the first token id automatically assigned by the library
+ // if needed
+ enum tokenids
+ {
+ min_token_id = 0x10000
+ };
+
     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; }
+
+ typename Lexer::id_type next_token_id;
 
- 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())
- {
- }
-
- 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 Lexer::iterator_type iterator_type;
+ typedef lexer base_type;
 
- 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
+ , id_type first_id = min_token_id)
+ : lexer_type(flags)
+ , next_token_id(first_id)
+ , 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(); }
-
+ iterator_type begin(Iterator& first, Iterator const& last
+ , char_type const* initial_state = 0) const
+ { return this->lexer_type::begin(first, last, initial_state); }
+ 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;
+ // create a unique token id
+ id_type get_next_id() { return next_token_id++; }
+
+ 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: branches/release/boost/spirit/home/lex/lexer/lexer_actions.hpp
==============================================================================
--- branches/release/boost/spirit/home/lex/lexer/lexer_actions.hpp 2009-09-14 12:50:29 EDT (Mon, 14 Sep 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: branches/release/boost/spirit/home/lex/lexer/lexer_fwd.hpp
==============================================================================
--- branches/release/boost/spirit/home/lex/lexer/lexer_fwd.hpp 2009-09-14 12:50:29 EDT (Mon, 14 Sep 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

Modified: branches/release/boost/spirit/home/lex/lexer/lexertl/iterator_tokenizer.hpp
==============================================================================
--- branches/release/boost/spirit/home/lex/lexer/lexertl/iterator_tokenizer.hpp (original)
+++ branches/release/boost/spirit/home/lex/lexer/lexertl/iterator_tokenizer.hpp 2009-09-14 12:50:29 EDT (Mon, 14 Sep 2009)
@@ -6,6 +6,10 @@
 #if !defined(BOOST_SPIRIT_LEXERTL_ITERATOR_TOKENISER_MARCH_22_2007_0859AM)
 #define BOOST_SPIRIT_LEXERTL_ITERATOR_TOKENISER_MARCH_22_2007_0859AM
 
+#if defined(_MSC_VER)
+#pragma once
+#endif
+
 #include <boost/detail/iterator.hpp>
 #include <boost/spirit/home/support/detail/lexer/state_machine.hpp>
 #include <boost/spirit/home/support/detail/lexer/consts.hpp>
@@ -13,105 +17,35 @@
 #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;
-
-// static std::size_t next (const std::size_t * const lookup_,
-// std::size_t const dfa_alphabet_, const std::size_t * const dfa_,
-// Iterator const& start_, Iterator &start_token_,
-// Iterator const& end_)
-// {
-// if (start_token_ == end_) return 0;
-//
-// const std::size_t *ptr_ = dfa_ + dfa_alphabet_;
-// Iterator curr_ = start_token_;
-// bool end_state_ = *ptr_ != 0;
-// std::size_t id_ = *(ptr_ + lexer::id_index);
-// Iterator end_token_ = start_token_;
-//
-// while (curr_ != end_)
-// {
-// std::size_t const BOL_state_ = ptr_[lexer::bol_index];
-// std::size_t const EOL_state_ = ptr_[lexer::eol_index];
-//
-// if (BOL_state_ && (start_token_ == start_ ||
-// *(start_token_ - 1) == '\n'))
-// {
-// ptr_ = &dfa_[BOL_state_ * dfa_alphabet_];
-// }
-// else if (EOL_state_ && *curr_ == '\n')
-// {
-// ptr_ = &dfa_[EOL_state_ * dfa_alphabet_];
-// }
-// else
-// {
-// std::size_t const state_ = ptr_[lookup_[*curr_++]];
-//
-// if (state_ == 0)
-// {
-// break;
-// }
-//
-// ptr_ = &dfa_[state_ * dfa_alphabet_];
-// }
-//
-// if (*ptr_)
-// {
-// end_state_ = true;
-// id_ = *(ptr_ + lexer::id_index);
-// end_token_ = curr_;
-// }
-// }
-//
-// const std::size_t EOL_state_ = ptr_[lexer::eol_index];
-//
-// if (EOL_state_ && curr_ == end_)
-// {
-// ptr_ = &dfa_[EOL_state_ * dfa_alphabet_];
-//
-// if (*ptr_)
-// {
-// end_state_ = true;
-// id_ = *(ptr_ + lexer::id_index);
-// end_token_ = curr_;
-// }
-// }
-//
-// if (end_state_) {
-// // return longest match
-// start_token_ = end_token_;
-// }
-// else {
-// id_ = lexer::npos;
-// }
-//
-// return id_;
-// }
+ typedef typename boost::detail::iterator_traits<Iterator>::value_type
+ char_type;
 
         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_
+ , std::size_t& unique_id_)
         {
             if (start_token_ == end_) return 0;
 
         again:
- std::size_t const* lookup_ = &state_machine_._lookup[dfa_state_]->
+ std::size_t const* lookup_ = &state_machine_.data()._lookup[dfa_state_]->
                 front ();
- std::size_t dfa_alphabet_ = state_machine_._dfa_alphabet[dfa_state_];
- std::size_t const* dfa_ = &state_machine_._dfa[dfa_state_]->front ();
+ std::size_t dfa_alphabet_ = state_machine_.data()._dfa_alphabet[dfa_state_];
+ std::size_t const* dfa_ = &state_machine_.data()._dfa[dfa_state_]->front ();
             std::size_t const* ptr_ = dfa_ + dfa_alphabet_;
             Iterator curr_ = start_token_;
             bool end_state_ = *ptr_ != 0;
             std::size_t id_ = *(ptr_ + boost::lexer::id_index);
+ std::size_t uid_ = *(ptr_ + boost::lexer::unique_id_index);
             Iterator end_token_ = start_token_;
 
             while (curr_ != end_)
@@ -136,7 +70,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_[
@@ -154,6 +88,7 @@
                 {
                     end_state_ = true;
                     id_ = *(ptr_ + boost::lexer::id_index);
+ uid_ = *(ptr_ + boost::lexer::unique_id_index);
                     dfa_state_ = *(ptr_ + boost::lexer::state_index);
                     end_token_ = curr_;
                 }
@@ -169,6 +104,7 @@
                 {
                     end_state_ = true;
                     id_ = *(ptr_ + boost::lexer::id_index);
+ uid_ = *(ptr_ + boost::lexer::unique_id_index);
                     dfa_state_ = *(ptr_ + boost::lexer::state_index);
                     end_token_ = curr_;
                 }
@@ -183,26 +119,29 @@
             }
             else {
                 id_ = boost::lexer::npos;
+ uid_ = boost::lexer::npos;
             }
-
+
+ unique_id_ = uid_;
             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_
+ , std::size_t& unique_id_)
         {
             if (start_token_ == end_) return 0;
 
- std::size_t const* lookup_ = &state_machine_._lookup[0]->front();
- std::size_t dfa_alphabet_ = state_machine_._dfa_alphabet[0];
- std::size_t const* dfa_ = &state_machine_._dfa[0]->front ();
+ std::size_t const* lookup_ = &state_machine_.data()._lookup[0]->front();
+ std::size_t dfa_alphabet_ = state_machine_.data()._dfa_alphabet[0];
+ std::size_t const* dfa_ = &state_machine_.data()._dfa[0]->front ();
             std::size_t const* ptr_ = dfa_ + dfa_alphabet_;
             Iterator curr_ = start_token_;
             bool end_state_ = *ptr_ != 0;
             std::size_t id_ = *(ptr_ + boost::lexer::id_index);
+ std::size_t uid_ = *(ptr_ + boost::lexer::unique_id_index);
             Iterator end_token_ = start_token_;
 
             while (curr_ != end_)
@@ -245,6 +184,7 @@
                 {
                     end_state_ = true;
                     id_ = *(ptr_ + boost::lexer::id_index);
+ uid_ = *(ptr_ + boost::lexer::unique_id_index);
                     end_token_ = curr_;
                 }
             }
@@ -259,6 +199,7 @@
                 {
                     end_state_ = true;
                     id_ = *(ptr_ + boost::lexer::id_index);
+ uid_ = *(ptr_ + boost::lexer::unique_id_index);
                     end_token_ = curr_;
                 }
             }
@@ -269,8 +210,10 @@
             }
             else {
                 id_ = boost::lexer::npos;
+ uid_ = boost::lexer::npos;
             }
-
+
+ unique_id_ = uid_;
             return id_;
         }
     };
@@ -279,6 +222,6 @@
     typedef basic_iterator_tokeniser<char const *> tokeniser;
     typedef basic_iterator_tokeniser<wchar_t const *> wtokeniser;
 
-}}}
+}}}}
 
 #endif

Deleted: branches/release/boost/spirit/home/lex/lexer/lexertl/lexertl_functor.hpp
==============================================================================
--- branches/release/boost/spirit/home/lex/lexer/lexertl/lexertl_functor.hpp 2009-09-14 12:50:29 EDT (Mon, 14 Sep 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: branches/release/boost/spirit/home/lex/lexer/lexertl/lexertl_generate_static.hpp
==============================================================================
--- branches/release/boost/spirit/home/lex/lexer/lexertl/lexertl_generate_static.hpp 2009-09-14 12:50:29 EDT (Mon, 14 Sep 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_._lookup->empty())
- return false;
-
- std::size_t const dfas_ = sm_._dfa->size();
- std::size_t const lookups_ = sm_._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_._seen_BOL_assertion || !optimize_parameters)
- {
- os_ << "Iterator const& start_, ";
- }
-
- if (dfas_ > 1 || sm_._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_._lookup[state_]->front ();
- std::size_t const* dfa_ = &sm_._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_._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_._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_._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_._dfa_alphabet.front ();
-
- for (i_ = 1; i_ < count_; ++i_)
- {
- os_ << ", " << sm_._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_._lookup[0]->front();
- std::size_t const* dfa_ = &sm_._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_._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_._dfa_alphabet.front () << ";\n";
- os_ << " static const std::size_t dfa_[" <<
- sm_._dfa[0]->size () << "] = {";
- count_ = sm_._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_._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_._seen_BOL_assertion)
- {
- os_ << " std::size_t const BOL_state_ = ptr_[bol_index];\n";
- }
-
- if (sm_._seen_EOL_assertion)
- {
- os_ << " std::size_t const EOL_state_ = ptr_[eol_index];\n";
- }
-
- if (sm_._seen_BOL_assertion || sm_._seen_EOL_assertion)
- {
- os_ << '\n';
- }
-
- if (sm_._seen_BOL_assertion && sm_._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_._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_._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_._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: branches/release/boost/spirit/home/lex/lexer/lexertl/lexertl_iterator.hpp
==============================================================================
--- branches/release/boost/spirit/home/lex/lexer/lexertl/lexertl_iterator.hpp 2009-09-14 12:50:29 EDT (Mon, 14 Sep 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: branches/release/boost/spirit/home/lex/lexer/lexertl/lexertl_lexer.hpp
==============================================================================
--- branches/release/boost/spirit/home/lex/lexer/lexertl/lexertl_lexer.hpp 2009-09-14 12:50:29 EDT (Mon, 14 Sep 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: branches/release/boost/spirit/home/lex/lexer/lexertl/lexertl_static_functor.hpp
==============================================================================
--- branches/release/boost/spirit/home/lex/lexer/lexertl/lexertl_static_functor.hpp 2009-09-14 12:50:29 EDT (Mon, 14 Sep 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: branches/release/boost/spirit/home/lex/lexer/lexertl/lexertl_static_lexer.hpp
==============================================================================
--- branches/release/boost/spirit/home/lex/lexer/lexertl/lexertl_static_lexer.hpp 2009-09-14 12:50:29 EDT (Mon, 14 Sep 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 &current_, 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: branches/release/boost/spirit/home/lex/lexer/lexertl/lexertl_token.hpp
==============================================================================
--- branches/release/boost/spirit/home/lex/lexer/lexertl/lexertl_token.hpp 2009-09-14 12:50:29 EDT (Mon, 14 Sep 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

Modified: branches/release/boost/spirit/home/lex/lexer/lexertl/wrap_action.hpp
==============================================================================
--- branches/release/boost/spirit/home/lex/lexer/lexertl/wrap_action.hpp (original)
+++ branches/release/boost/spirit/home/lex/lexer/lexertl/wrap_action.hpp 2009-09-14 12:50:29 EDT (Mon, 14 Sep 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,205 @@
 #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>
+#if defined(_MSC_VER)
+#pragma once
+#endif
+
 #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>
+#include <boost/spirit/home/support/attributes.hpp>
+#include <boost/spirit/home/lex/lexer/pass_flags.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)
- {
- return f;
- }
+ template <typename FunctionType, typename Iterator, typename Context
+ , typename IdType>
+ struct wrap_action
+ {
+ // plain functions with 5 arguments and function objects are not
+ // touched at all
+ template <typename F>
+ static FunctionType call(F const& f)
+ {
+ return f;
+ }
+
+ // wrap phoenix actor
+ struct phoenix_action
+ {
+ template <typename F, typename T1, typename T2, typename T3
+ , typename T4, typename T5>
+ struct result { typedef void type; };
+
+ template <typename Eval>
+ void operator()(phoenix::actor<Eval> const& f, Iterator& start
+ , Iterator& end, BOOST_SCOPED_ENUM(pass_flags)& pass
+ , IdType& id, Context& ctx) const
+ {
+ f (start, end, pass, id, 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;
+ using phoenix::arg_names::_5;
+ return phoenix::bind(phoenix_action(), phoenix::lambda[f],
+ _1, _2, _3, _4, _5);
             }
- };
 
- 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 4 arguments
+ template <typename F>
+ static void arg4_action(F* f, Iterator& start, Iterator& end
+ , BOOST_SCOPED_ENUM(pass_flags)& pass, IdType& id
+ , Context const&)
+ {
+ f(start, end, pass, id);
+ }
 
- 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 F>
+ static void arg4_action_bool(F* f, Iterator& start, Iterator& end
+ , BOOST_SCOPED_ENUM(pass_flags)& pass, IdType& id, Context const&)
+ {
+ bool pass_bool = true;
+ f (start, end, pass_bool, id);
+ pass = pass_bool ? pass_flags::pass_normal : pass_flags::pass_fail;
+ }
 
- 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);
- }
+ template <typename A0, typename A1, typename A2, typename A3>
+ static FunctionType call(void(*f)(A0, A1, A2, A3))
+ {
+ void (*pf)(void(*)(A0, A1, A2, A3)
+ , Iterator&, Iterator&, BOOST_SCOPED_ENUM(pass_flags)&
+ , IdType&, Context const&) = &wrap_action::arg4_action;
+
+ using phoenix::arg_names::_1;
+ using phoenix::arg_names::_2;
+ using phoenix::arg_names::_3;
+ using phoenix::arg_names::_4;
+ return phoenix::bind(pf, f, _1, _2, _3, _4);
+ }
 
- 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, typename A1, typename A3>
+ static FunctionType call(void(*f)(A0, A1, bool&, A3))
+ {
+ void (*pf)(void(*)(A0, A1, bool&, A3), Iterator&, Iterator&
+ , BOOST_SCOPED_ENUM(pass_flags)&, IdType&, Context const&)
+ = &wrap_action::arg4_action_bool;
+
+ using phoenix::arg_names::_1;
+ using phoenix::arg_names::_2;
+ using phoenix::arg_names::_3;
+ using phoenix::arg_names::_4;
+ return phoenix::bind(pf, f, _1, _2, _3, _4);
+ }
 
- 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);
- }
+ // semantic actions with 3 arguments
+ template <typename F>
+ static void arg3_action(F* f, Iterator& start, Iterator& end
+ , BOOST_SCOPED_ENUM(pass_flags)& pass, IdType
+ , Context const&)
+ {
+ f(start, end, pass);
+ }
 
- template <typename A0>
- static FunctionType call(void(*f)(A0))
- {
- void (*pf)(void(*)(A0), Attribute const&, std::size_t,
- bool&, Context&) = &arg1_action;
+ template <typename F>
+ static void arg3_action_bool(F* f, Iterator& start, Iterator& end
+ , BOOST_SCOPED_ENUM(pass_flags)& pass, IdType, Context const&)
+ {
+ bool pass_bool = true;
+ f (start, end, pass_bool);
+ pass = pass_bool ? pass_flags::pass_normal : pass_flags::pass_fail;
+ }
 
- 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();
- }
+ template <typename A0, typename A1, typename A2>
+ static FunctionType call(void(*f)(A0, A1, A2))
+ {
+ void (*pf)(void(*)(A0, A1, A2), Iterator&, Iterator&
+ , BOOST_SCOPED_ENUM(pass_flags)&, IdType
+ , Context const&) = &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);
+ }
 
- static FunctionType call(void(*f)())
- {
- void (*pf)(void(*)(), Attribute const&, std::size_t,
- bool&, Context&) = &arg0_action;
+ template <typename A0, typename A1>
+ static FunctionType call(void(*f)(A0, A1, bool&))
+ {
+ void (*pf)(void(*)(A0, A1, bool&), Iterator&, Iterator&
+ , BOOST_SCOPED_ENUM(pass_flags)&, IdType, Context const&)
+ = &wrap_action::arg3_action_bool;
+
+ using phoenix::arg_names::_1;
+ using phoenix::arg_names::_2;
+ using phoenix::arg_names::_3;
+ return phoenix::bind(pf, f, _1, _2, _3);
+ }
 
- 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;
- }
- };
+ // semantic actions with 2 arguments
+ template <typename F>
+ static void arg2_action(F* f, Iterator& start, Iterator& end
+ , bool, IdType, Context const&)
+ {
+ f(start, end);
+ }
+
+ template <typename A0, typename A1>
+ static FunctionType call(void(*f)(A0, A1))
+ {
+ void (*pf)(void(*)(A0, A1), Iterator&, Iterator&, bool
+ , IdType, Context const&) = &wrap_action::arg2_action;
+
+ using phoenix::arg_names::_1;
+ using phoenix::arg_names::_2;
+ return phoenix::bind(pf, f, _1, _2);
+ }
+
+ // we assume that either both iterators are to be passed to the
+ // semantic action or none iterator at all (i.e. it's not possible
+ // to have a lexer semantic action function taking one arguments).
+
+ // semantic actions with 0 argument
+ template <typename F>
+ static void arg0_action(F* f, Iterator&, Iterator&
+ , bool, IdType, Context const&)
+ {
+ f();
+ }
+
+ static FunctionType call(void(*f)())
+ {
+ void (*pf)(void(*)(), Iterator&, Iterator&, bool
+ , IdType, Context const&) = &arg0_action;
+
+ return phoenix::bind(pf, f);
+ }
+ };
+
+ // specialization allowing to skip wrapping for lexer types not
+ // supporting semantic actions
+ template <typename Iterator, typename Context, typename Idtype>
+ struct wrap_action<unused_type, Iterator, Context, Idtype>
+ {
+ // plain functors are not touched at all
+ template <typename F>
+ static F const& call(F const& f)
+ {
+ return f;
+ }
+ };
+ }
 
 }}}}
 

Deleted: branches/release/boost/spirit/home/lex/lexer/meta_grammar.hpp
==============================================================================
--- branches/release/boost/spirit/home/lex/lexer/meta_grammar.hpp 2009-09-14 12:50:29 EDT (Mon, 14 Sep 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: branches/release/boost/spirit/home/lex/lexer/sequence.hpp
==============================================================================
--- branches/release/boost/spirit/home/lex/lexer/sequence.hpp (original)
+++ branches/release/boost/spirit/home/lex/lexer/sequence.hpp 2009-09-14 12:50:29 EDT (Mon, 14 Sep 2009)
@@ -6,27 +6,64 @@
 #if !defined(SPIRIT_LEX_SEQUENCE_MAR_28_2007_0610PM)
 #define SPIRIT_LEX_SEQUENCE_MAR_28_2007_0610PM
 
-#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/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) const
         {
- detail::sequence_collect<LexerDef, String> f (lexdef, state);
- fusion::any(component.elements, f);
+ detail::sequence_collect_function<LexerDef, String> f (lexdef, state);
+ fusion::any(elements, f);
         }
+
+ template <typename LexerDef>
+ void add_actions(LexerDef& lexdef) const
+ {
+ detail::sequence_add_actions_function<LexerDef> f (lexdef);
+ 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: branches/release/boost/spirit/home/lex/lexer/string_token_def.hpp
==============================================================================
--- branches/release/boost/spirit/home/lex/lexer/string_token_def.hpp (original)
+++ branches/release/boost/spirit/home/lex/lexer/string_token_def.hpp 2009-09-14 12:50:29 EDT (Mon, 14 Sep 2009)
@@ -6,11 +6,39 @@
 #if !defined(BOOST_SPIRIT_LEX_STRING_TOKEN_DEF_MAR_28_2007_0722PM)
 #define BOOST_SPIRIT_LEX_STRING_TOKEN_DEF_MAR_28_2007_0722PM
 
-#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/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,72 @@
     // 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), id_(std::size_t(~0)) {}
+
+ 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());
+ if (std::size_t(~0) == id_)
+ id_ = lexdef.get_next_id();
+ unique_id_ = lexdef.add_token (state.c_str(), str_, id_);
         }
+
+ template <typename LexerDef>
+ void add_actions(LexerDef& lexdef) const {}
+
+ std::size_t id() const { return id_; }
+ std::size_t unique_id() const { return unique_id_; }
+
+ string_type str_;
+ mutable std::size_t id_;
+ mutable std::size_t unique_id_;
     };
-
+
+ ///////////////////////////////////////////////////////////////////////////
+ // 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));
+ }
+ };
+
 }}} // namespace boost::spirit::lex
 
 #endif

Deleted: branches/release/boost/spirit/home/lex/lexer/terminal_director.hpp
==============================================================================
--- branches/release/boost/spirit/home/lex/lexer/terminal_director.hpp 2009-09-14 12:50:29 EDT (Mon, 14 Sep 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: branches/release/boost/spirit/home/lex/lexer/terminal_holder.hpp
==============================================================================
--- branches/release/boost/spirit/home/lex/lexer/terminal_holder.hpp 2009-09-14 12:50:29 EDT (Mon, 14 Sep 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

Modified: branches/release/boost/spirit/home/lex/lexer/token_def.hpp
==============================================================================
--- branches/release/boost/spirit/home/lex/lexer/token_def.hpp (original)
+++ branches/release/boost/spirit/home/lex/lexer/token_def.hpp 2009-09-14 12:50:29 EDT (Mon, 14 Sep 2009)
@@ -6,110 +6,86 @@
 #if !defined(BOOST_SPIRIT_LEX_TOKEN_DEF_MAR_13_2007_0145PM)
 #define BOOST_SPIRIT_LEX_TOKEN_DEF_MAR_13_2007_0145PM
 
-#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/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>
 
 namespace boost { namespace spirit { namespace lex
 {
     ///////////////////////////////////////////////////////////////////////////
- // create a unique token id, note this is not thread safe
- ///////////////////////////////////////////////////////////////////////////
- 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
- // '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.
- template <>
- struct next_id<std::size_t>
- {
- static std::size_t get()
- {
- static std::size_t next_token_id = min_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
             // attribute type, or the pair of iterators from the match of the
             // corresponding token (if no attribute type has been specified),
- // or unused_type (if omitted has been specified).
+ // or unused_type (if omit 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, lex::omit>, 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
@@ -118,10 +94,10 @@
 
                 // If the following assertion fires you probably forgot to
                 // associate this token definition with a lexer instance.
- BOOST_ASSERT((std::size_t)(~0) != token_state);
+ BOOST_ASSERT(std::size_t(~0) != token_state_);
 
                 token_type &t = *first;
- if (token_id == t.id() && token_state == t.state()) {
+ if (token_id_ == t.id() && token_state_ == t.state()) {
                     qi::detail::assign_to(t, attr);
                     ++first;
                     return true;
@@ -129,69 +105,101 @@
             }
             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);
+ std::size_t state_id = lexdef.add_state(state.c_str());
+
+ // If the following assertion fires you are probably trying to use
+ // a single token_def instance in more than one lexer state. This
+ // is not possible. Please create a separate token_def instance
+ // from the same regular expression for each lexer state it needs
+ // to be associated with.
+ BOOST_ASSERT(std::size_t(~0) == token_state_ || state_id == token_state_);
+
+ token_state_ = state_id;
+ if (0 == token_id_)
+ token_id_ = lexdef.get_next_id();
+
+ if (0 == def_.which()) {
+ unique_id_ = lexdef.add_token(state.c_str()
+ , get<string_type>(def_), token_id_);
+ }
+ else {
+ unique_id_ = lexdef.add_token(state.c_str()
+ , get<char_type>(def_), token_id_);
+ }
         }
-
+
+ template <typename LexerDef>
+ void add_actions(LexerDef& lexdef) const {}
+
     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_()
+ , unique_id_(std::size_t(~0)), 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_)
+ , unique_id_(~0), token_state_(std::size_t(~0)) {}
+
+ explicit token_def(string_type const& def_, Idtype id_ = Idtype())
+ : proto_base_type(terminal_type::make(alias()))
+ , def_(def_), token_id_(id_)
+ , unique_id_(std::size_t(~0)), token_state_(std::size_t(~0)) {}
+
         template <typename String>
         token_def& operator= (String const& definition)
         {
- def = definition;
- token_id = 0;
+ def_ = definition;
+ token_id_ = Idtype();
+ unique_id_ = std::size_t(~0);
+ token_state_ = std::size_t(~0);
             return *this;
         }
         token_def& operator= (token_def const& rhs)
         {
- def = rhs.def;
- token_id = rhs.token_id;
+ def_ = rhs.def_;
+ token_id_ = rhs.token_id_;
+ unique_id_ = rhs.unique_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; }
- std::size_t state() const { return token_state; }
-
+ Idtype const& id() const { return token_id_; }
+ void id(Idtype const& id) { token_id_ = id; }
+ std::size_t unique_id() const { return unique_id_; }
+
+ 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 unique_id_;
+ mutable std::size_t token_state_;
     };
 
 }}}

Deleted: branches/release/boost/spirit/home/lex/lexer/token_set.hpp
==============================================================================
--- branches/release/boost/spirit/home/lex/lexer/token_set.hpp 2009-09-14 12:50:29 EDT (Mon, 14 Sep 2009)
+++ (empty file)
@@ -1,281 +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_TOKEN_SET_MAR_13_2007_0145PM)
-#define BOOST_SPIRIT_LEX_TOKEN_SET_MAR_13_2007_0145PM
-
-#if defined(_MSC_VER) && (_MSC_VER >= 1020)
-#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/lex/lexer/token_def.hpp>
-#include <boost/detail/iterator.hpp>
-#include <boost/fusion/include/vector.hpp>
-#include <boost/mpl/assert.hpp>
-#include <boost/range/iterator_range.hpp>
-#include <cstdlib>
-
-namespace boost { namespace spirit { namespace lex
-{
- ///////////////////////////////////////////////////////////////////////////
- // 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>
- >
- {
- protected:
- typedef typename TokenSet::char_type char_type;
- typedef typename TokenSet::string_type string_type;
-
- private:
- // 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;
-
- tag make_tag()
- {
- tag xpr = {{ this }};
- return xpr;
- }
-
- public:
- typedef typename TokenSet::id_type id_type;
-
- // Qi interface: metafunction calculating parser return type
- template <typename Component, 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;
- };
-
- 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
- {
- qi::skip(first, last, skipper); // always do a pre-skip
-
- if (first != last) {
- typedef typename
- boost::detail::iterator_traits<Iterator>::value_type
- token_type;
-
- // If the following assertion fires you probably forgot to
- // associate this token set definition with a lexer instance.
- BOOST_ASSERT(~0 != token_state);
-
- token_type &t = *first;
- if (token_is_valid(t) && token_state == t.state()) {
- // any of the token definitions matched
- qi::detail::assign_to(t, attr);
- ++first;
- return true;
- }
- }
- return false;
- }
- friend struct terminal_director;
-
- static std::string what()
- {
- return "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)
- {
- token_state = lexdef.add_state(state.c_str());
- lexdef.add_token (state.c_str(), *this);
- }
-
- // allow to use the tokset.add("regex1", id1)("regex2", id2);
- // syntax
- struct adder
- {
- adder(token_set& def_)
- : def(def_)
- {}
-
- adder const&
- operator()(char_type c, id_type token_id = id_type()) const
- {
- if (0 == token_id)
- token_id = static_cast<std::size_t>(c);
- def.add_token (def.initial_state().c_str(),
- lex::detail::escape(c), token_id);
- return *this;
- }
- adder const&
- operator()(string_type const& s, id_type token_id = id_type()) const
- {
- if (0 == 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
- {
- // make sure we have a token id
- if (0 == token_id) {
- if (0 == tokdef.id()) {
- token_id = next_id<id_type>::get();
- tokdef.id(token_id);
- }
- else {
- token_id = tokdef.id();
- }
- }
- else {
- // 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());
- tokdef.id(token_id);
- }
-
- def.add_token (def.initial_state().c_str(), tokdef.definition(),
- token_id);
- return *this;
- }
- template <typename TokenSet_>
- adder const&
- operator()(token_set<TokenSet_> const& tokset) const
- {
- def.add_token (def.initial_state().c_str(), tokset);
- return *this;
- }
-
- token_set& def;
- };
- friend struct adder;
-
- // allow to use lexer.self.add_pattern("pattern1", "regex1")(...);
- // syntax
- struct pattern_adder
- {
- pattern_adder(token_set& def_)
- : def(def_)
- {}
-
- pattern_adder const&
- operator()(string_type const& p, string_type const& s) const
- {
- def.add_pattern (def.state.c_str(), p, s);
- return *this;
- }
-
- token_set& def;
- };
- friend struct pattern_adder;
-
- public:
- ///////////////////////////////////////////////////////////////////
- template <typename Expr>
- void define(Expr const& xpr)
- {
- 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());
- }
-
- token_set()
- : base_type(make_tag()), 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, ());
-
- this->clear();
- define(xpr);
- return *this;
- }
-
- adder add;
- pattern_adder add_pattern;
-
- private:
- std::size_t token_state;
- };
-
- // allow to assign a token definition expression
- template <typename TokenSet, typename Expr>
- 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, ());
-
- 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, ());
-
- tokset.define(xpr);
- return tokset;
- }
-
-}}}
-
-#endif

Modified: branches/release/boost/spirit/home/lex/lexer_lexertl.hpp
==============================================================================
--- branches/release/boost/spirit/home/lex/lexer_lexertl.hpp (original)
+++ branches/release/boost/spirit/home/lex/lexer_lexertl.hpp 2009-09-14 12:50:29 EDT (Mon, 14 Sep 2009)
@@ -6,13 +6,13 @@
 #if !defined(BOOST_SPIRIT_LEX_LEXERTL_MAR_17_2007_1008PM)
 #define BOOST_SPIRIT_LEX_LEXERTL_MAR_17_2007_1008PM
 
-#if defined(_MSC_VER) && (_MSC_VER >= 1020)
-#pragma once // MS compatible compilers support #pragma once
+#if defined(_MSC_VER)
+#pragma once
 #endif
 
 // 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: branches/release/boost/spirit/home/lex/lexer_static_lexertl.hpp
==============================================================================
--- branches/release/boost/spirit/home/lex/lexer_static_lexertl.hpp (original)
+++ branches/release/boost/spirit/home/lex/lexer_static_lexertl.hpp 2009-09-14 12:50:29 EDT (Mon, 14 Sep 2009)
@@ -6,13 +6,13 @@
 #if !defined(BOOST_SPIRIT_LEX_STATIC_LEXERTL_FEB_11_2008_1045AM)
 #define BOOST_SPIRIT_LEX_STATIC_LEXERTL_FEB_11_2008_1045AM
 
-#if defined(_MSC_VER) && (_MSC_VER >= 1020)
-#pragma once // MS compatible compilers support #pragma once
+#if defined(_MSC_VER)
+#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

Deleted: branches/release/boost/spirit/home/lex/meta_grammar.hpp
==============================================================================
--- branches/release/boost/spirit/home/lex/meta_grammar.hpp 2009-09-14 12:50:29 EDT (Mon, 14 Sep 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

Deleted: branches/release/boost/spirit/home/lex/qi/meta_grammar.hpp
==============================================================================
--- branches/release/boost/spirit/home/lex/qi/meta_grammar.hpp 2009-09-14 12:50:29 EDT (Mon, 14 Sep 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

Deleted: branches/release/boost/spirit/home/lex/set_state.hpp
==============================================================================
--- branches/release/boost/spirit/home/lex/set_state.hpp 2009-09-14 12:50:29 EDT (Mon, 14 Sep 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: branches/release/boost/spirit/home/lex/tokenize_and_parse.hpp
==============================================================================
--- branches/release/boost/spirit/home/lex/tokenize_and_parse.hpp (original)
+++ branches/release/boost/spirit/home/lex/tokenize_and_parse.hpp 2009-09-14 12:50:29 EDT (Mon, 14 Sep 2009)
@@ -1,14 +1,17 @@
-/*=============================================================================
- 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>
+#if defined(_MSC_VER)
+#pragma once
+#endif
+
+#include <boost/spirit/home/qi/skip_over.hpp>
+#include <boost/spirit/home/qi/parse.hpp>
 #include <boost/spirit/home/qi/nonterminal/grammar.hpp>
 #include <boost/spirit/home/support/unused.hpp>
 #include <boost/spirit/home/lex/lexer.hpp>
@@ -17,6 +20,10 @@
 namespace boost { namespace spirit { namespace lex
 {
     ///////////////////////////////////////////////////////////////////////////
+ // Import skip_flag enumerator type from Qi namespace
+ using qi::skip_flag;
+
+ ///////////////////////////////////////////////////////////////////////////
     //
     // The tokenize_and_parse() function is one of the main Spirit API
     // functions. It simplifies using a lexer as the underlying token source
@@ -57,54 +64,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);
     }
 
     ///////////////////////////////////////////////////////////////////////////
@@ -144,110 +131,95 @@
     // object instance. The ParserExpr type must conform to
     // the grammar interface described in the corresponding
     // section of the documentation.
+ // skipper: The skip parser to be used while parsing the given
+ // input sequence. Note, the skip parser will have to
+ // act on the same token sequence as the main parser
+ // 'xpr'.
+ // post_skip: The post_skip flag controls whether the funciton will
+ // invoke an additional post skip after the main parser
+ // returned.
     // attr: The top level attribute passed to the parser. It will
     // be populated during the parsing of the input sequence.
     // On exit it will hold the 'parser result' corresponding
     // to the matched input sequence.
- // skipper_: The skip parser to be used while parsing the given
- // input sequence. Note, the skip parser will have to
- // act on the same token sequence as the main parser
- // '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
+ , BOOST_SCOPED_ENUM(skip_flag) post_skip = skip_flag::postskip)
     {
- 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);
+ if (post_skip == skip_flag::postskip)
+ 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
+ , BOOST_SCOPED_ENUM(skip_flag) post_skip, 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);
+ if (post_skip == skip_flag::postskip)
+ qi::skip_over(iter, lex.end(), skipper_);
         return true;
     }
 
     ///////////////////////////////////////////////////////////////////////////
+ template <typename Iterator, typename Lexer, typename ParserExpr
+ , typename Skipper, typename Attribute>
+ inline bool
+ tokenize_and_phrase_parse(Iterator& first, Iterator last
+ , Lexer const& lex, ParserExpr const& xpr, Skipper const& skipper
+ , Attribute& attr)
+ {
+ return tokenize_and_phrase_parse(first, last, lex, xpr, skipper
+ , skip_flag::postskip, attr);
+ }
+
+ ///////////////////////////////////////////////////////////////////////////
     //
     // The tokenize() function is one of the main Spirit API functions. It
     // simplifies using a lexer to tokenize a given input sequence. It's main
     // 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
@@ -276,36 +248,71 @@
     // f: A functor (callable object) taking a single argument of
     // the token type and returning a bool, indicating whether
     // the tokenization should be canceled.
+ // initial_state: The name of the state the lexer should start matching.
+ // The default value is zero, causing the lexer to start
+ // in its 'INITIAL' state.
     //
     ///////////////////////////////////////////////////////////////////////////
- template <typename Iterator, typename LexerExpr, typename F>
+ namespace detail
+ {
+ template <typename Token, typename F>
+ bool tokenize_callback(Token const& t, F f)
+ {
+ return f(t);
+ }
+
+ template <typename Token, typename Eval>
+ bool tokenize_callback(Token const& t, phoenix::actor<Eval> const& f)
+ {
+ f(t);
+ return true;
+ }
+
+ template <typename Token>
+ bool tokenize_callback(Token const& t, void (*f)(Token const&))
+ {
+ f(t);
+ return true;
+ }
+
+ template <typename Token>
+ bool tokenize_callback(Token const& t, bool (*f)(Token const&))
+ {
+ return f(t);
+ }
+ }
+
+ 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
+ , typename Lexer::char_type const* initial_state = 0)
     {
- typedef typename LexerExpr::iterator_type iterator_type;
+ typedef typename Lexer::iterator_type iterator_type;
 
+ iterator_type iter = lex.begin(first, last, initial_state);
         iterator_type end = lex.end();
- for (iterator_type iter = lex.begin(first, last); iter != end; ++iter)
+ for (/**/; iter != end && token_is_valid(*iter); ++iter)
         {
- if (!f(*iter))
+ if (!detail::tokenize_callback(*iter, f))
                 return false;
         }
- return true;
+ return (iter == end) ? true : false;
     }
 
     ///////////////////////////////////////////////////////////////////////////
- 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
+ , typename Lexer::char_type const* initial_state = 0)
     {
- typedef typename LexerExpr::iterator_type iterator_type;
+ typedef typename Lexer::iterator_type iterator_type;
 
- iterator_type iter = lex.begin(first, last);
+ iterator_type iter = lex.begin(first, last, initial_state);
         iterator_type end = lex.end();
 
         while (iter != end && token_is_valid(*iter))
             ++iter;
-
+
         return (iter == end) ? true : false;
     }
 

Modified: branches/release/boost/spirit/home/phoenix/core/actor.hpp
==============================================================================
--- branches/release/boost/spirit/home/phoenix/core/actor.hpp (original)
+++ branches/release/boost/spirit/home/phoenix/core/actor.hpp 2009-09-14 12:50:29 EDT (Mon, 14 Sep 2009)
@@ -7,15 +7,14 @@
 #ifndef PHOENIX_CORE_ACTOR_HPP
 #define PHOENIX_CORE_ACTOR_HPP
 
+#include <boost/spirit/home/phoenix/core/limits.hpp>
+
 #if !defined(BOOST_RESULT_OF_NUM_ARGS)
 # define BOOST_RESULT_OF_NUM_ARGS PHOENIX_ACTOR_LIMIT
-#else
-# if (BOOST_RESULT_OF_NUM_ARGS < PHOENIX_ACTOR_LIMIT)
-# error "BOOST_RESULT_OF_NUM_ARGS < PHOENIX_ACTOR_LIMIT"
-# endif
+#elif (BOOST_RESULT_OF_NUM_ARGS < PHOENIX_ACTOR_LIMIT)
+# error "BOOST_RESULT_OF_NUM_ARGS < PHOENIX_ACTOR_LIMIT"
 #endif
 
-#include <boost/spirit/home/phoenix/core/limits.hpp>
 #include <boost/spirit/home/phoenix/core/basic_environment.hpp>
 #include <boost/mpl/min.hpp>
 #include <boost/mpl/identity.hpp>

Modified: branches/release/boost/spirit/home/phoenix/core/argument.hpp
==============================================================================
--- branches/release/boost/spirit/home/phoenix/core/argument.hpp (original)
+++ branches/release/boost/spirit/home/phoenix/core/argument.hpp 2009-09-14 12:50:29 EDT (Mon, 14 Sep 2009)
@@ -8,7 +8,7 @@
 #define PHOENIX_CORE_ARGUMENT_HPP
 
 #include <boost/preprocessor/repetition/repeat_from_to.hpp>
-#include <boost/preprocessor/arithmetic/inc.hpp>
+#include <boost/preprocessor/inc.hpp>
 #include <boost/spirit/home/phoenix/core/actor.hpp>
 #include <boost/fusion/include/at.hpp>
 #include <boost/mpl/if.hpp>
@@ -21,10 +21,6 @@
 #include <boost/mpl/size.hpp>
 #include <boost/type_traits/add_reference.hpp>
 
-#if !defined(PHOENIX_ARG_LIMIT)
-# define PHOENIX_ARG_LIMIT PHOENIX_LIMIT
-#endif
-
 #define PHOENIX_DECLARE_ARG(z, n, data) \
     actor<argument<n> > const \
         BOOST_PP_CAT(arg, BOOST_PP_INC(n)) = argument<n>(); \

Modified: branches/release/boost/spirit/home/phoenix/core/basic_environment.hpp
==============================================================================
--- branches/release/boost/spirit/home/phoenix/core/basic_environment.hpp (original)
+++ branches/release/boost/spirit/home/phoenix/core/basic_environment.hpp 2009-09-14 12:50:29 EDT (Mon, 14 Sep 2009)
@@ -8,11 +8,6 @@
 #define PHOENIX_CORE_BASIC_ENVIRONMENT_HPP
 
 #include <boost/spirit/home/phoenix/core/limits.hpp>
-
-#if !defined(PHOENIX_ARG_LIMIT)
-# define PHOENIX_ARG_LIMIT PHOENIX_LIMIT
-#endif
-
 #include <boost/mpl/remove.hpp>
 #include <boost/mpl/transform.hpp>
 #include <boost/preprocessor/cat.hpp>

Modified: branches/release/boost/spirit/home/phoenix/core/composite.hpp
==============================================================================
--- branches/release/boost/spirit/home/phoenix/core/composite.hpp (original)
+++ branches/release/boost/spirit/home/phoenix/core/composite.hpp 2009-09-14 12:50:29 EDT (Mon, 14 Sep 2009)
@@ -17,10 +17,6 @@
 #include <boost/mpl/bool.hpp>
 #include <boost/mpl/or.hpp>
 
-#if !defined(PHOENIX_COMPOSITE_LIMIT)
-# define PHOENIX_COMPOSITE_LIMIT PHOENIX_LIMIT
-#endif
-
 namespace boost { namespace phoenix
 {
     namespace detail

Modified: branches/release/boost/spirit/home/phoenix/core/limits.hpp
==============================================================================
--- branches/release/boost/spirit/home/phoenix/core/limits.hpp (original)
+++ branches/release/boost/spirit/home/phoenix/core/limits.hpp 2009-09-14 12:50:29 EDT (Mon, 14 Sep 2009)
@@ -7,24 +7,69 @@
 #ifndef PHOENIX_CORE_LIMITS_HPP
 #define PHOENIX_CORE_LIMITS_HPP
 
+#include <boost/preprocessor/dec.hpp>
+
 #if !defined(PHOENIX_LIMIT)
 # define PHOENIX_LIMIT 10
+#elif (PHOENIX_LIMIT < 5)
+# error "PHOENIX_LIMIT is set too low"
+#endif
+
+#if !defined(PHOENIX_ARG_LIMIT)
+# define PHOENIX_ARG_LIMIT PHOENIX_LIMIT
+#elif (PHOENIX_ARG_LIMIT < 5)
+# error "PHOENIX_ARG_LIMIT is set too low"
 #endif
 
 #if !defined(PHOENIX_ACTOR_LIMIT)
 # define PHOENIX_ACTOR_LIMIT PHOENIX_LIMIT
-#elif (PHOENIX_ACTOR_LIMIT > PHOENIX_LIMIT)
-# error "PHOENIX_ACTOR_LIMIT is set too high"
+#elif (PHOENIX_ACTOR_LIMIT > PHOENIX_ARG_LIMIT)
+# error "PHOENIX_ACTOR_LIMIT > PHOENIX_ARG_LIMIT"
+#elif (PHOENIX_ACTOR_LIMIT < 3)
+# error "PHOENIX_ACTOR_LIMIT is set too low"
+#endif
+
+#if !defined(PHOENIX_COMPOSITE_LIMIT)
+# define PHOENIX_COMPOSITE_LIMIT PHOENIX_LIMIT
+#elif (PHOENIX_COMPOSITE_LIMIT < 5)
+# error "PHOENIX_COMPOSITE_LIMIT is set too low"
+#endif
+
+#if !defined(PHOENIX_MEMBER_LIMIT)
+# define PHOENIX_MEMBER_LIMIT BOOST_PP_DEC(BOOST_PP_DEC(PHOENIX_COMPOSITE_LIMIT))
+#elif (PHOENIX_MEMBER_LIMIT > PHOENIX_COMPOSITE_LIMIT)
+# error "PHOENIX_MEMBER_LIMIT > PHOENIX_COMPOSITE_LIMIT"
+#elif (PHOENIX_MEMBER_LIMIT < 3)
+# error "PHOENIX_MEMBER_LIMIT is set too low"
 #endif
 
-#if !defined(FUSION_MAX_TUPLE_SIZE)
-# define FUSION_MAX_TUPLE_SIZE PHOENIX_LIMIT
-#elif (FUSION_MAX_TUPLE_SIZE < PHOENIX_LIMIT)
-# error "FUSION_MAX_TUPLE_SIZE is set too low"
+#if !defined(PHOENIX_CATCH_LIMIT)
+# define PHOENIX_CATCH_LIMIT BOOST_PP_DEC(PHOENIX_COMPOSITE_LIMIT)
+#elif (PHOENIX_CATCH_LIMIT < 1)
+# error "PHOENIX_CATCH_LIMIT is set too low"
+#endif
+
+#if !defined(PHOENIX_DYNAMIC_LIMIT)
+# define PHOENIX_DYNAMIC_LIMIT PHOENIX_LIMIT
+#elif (PHOENIX_DYNAMIC_LIMIT < 1)
+# error "PHOENIX_DYNAMIC_LIMIT is set too low"
+#endif
+
+#if !defined(PHOENIX_LOCAL_LIMIT)
+# define PHOENIX_LOCAL_LIMIT PHOENIX_LIMIT
+#elif (PHOENIX_LOCAL_LIMIT < 3)
+# error "PHOENIX_LOCAL_LIMIT is set too low"
+#endif
+
+
+#if !defined(FUSION_MAX_VECTOR_SIZE)
+# define FUSION_MAX_VECTOR_SIZE PHOENIX_LIMIT
+#elif (FUSION_MAX_VECTOR_SIZE < PHOENIX_LIMIT)
+# error "FUSION_MAX_VECTOR_SIZE < PHOENIX_LIMIT"
 #endif
 
 // this include will bring in mpl::vectorN and
-// fusion::tupleN where N is PHOENIX_ACTOR_LIMIT
+// fusion::vectorN where N is PHOENIX_LIMIT
 #include <boost/fusion/include/vector.hpp>
 
 // for some reason, this must be included now to make

Modified: branches/release/boost/spirit/home/phoenix/operator/detail/mem_fun_ptr_eval.hpp
==============================================================================
--- branches/release/boost/spirit/home/phoenix/operator/detail/mem_fun_ptr_eval.hpp (original)
+++ branches/release/boost/spirit/home/phoenix/operator/detail/mem_fun_ptr_eval.hpp 2009-09-14 12:50:29 EDT (Mon, 14 Sep 2009)
@@ -17,6 +17,7 @@
 #include <boost/preprocessor/repetition/enum_binary_params.hpp>
 #include <boost/preprocessor/iteration/iterate.hpp>
 #include <boost/preprocessor/arithmetic/sub.hpp>
+#include <boost/preprocessor/arithmetic/dec.hpp>
 
 #include <boost/mpl/void.hpp>
 
@@ -44,7 +45,7 @@
         }
 
 #define BOOST_PP_ITERATION_PARAMS_1 \
- (3, (1, BOOST_PP_SUB(PHOENIX_MEMBER_LIMIT, 2), "boost/spirit/home/phoenix/operator/detail/mem_fun_ptr_eval.hpp"))
+ (3, (1, BOOST_PP_DEC(BOOST_PP_DEC(PHOENIX_MEMBER_LIMIT)), "boost/spirit/home/phoenix/operator/detail/mem_fun_ptr_eval.hpp"))
 
 #include BOOST_PP_ITERATE()
 

Modified: branches/release/boost/spirit/home/phoenix/operator/detail/mem_fun_ptr_gen.hpp
==============================================================================
--- branches/release/boost/spirit/home/phoenix/operator/detail/mem_fun_ptr_gen.hpp (original)
+++ branches/release/boost/spirit/home/phoenix/operator/detail/mem_fun_ptr_gen.hpp 2009-09-14 12:50:29 EDT (Mon, 14 Sep 2009)
@@ -18,7 +18,7 @@
 #include <boost/preprocessor/repetition/enum_params.hpp>
 #include <boost/preprocessor/repetition/enum_binary_params.hpp>
 #include <boost/preprocessor/iteration/iterate.hpp>
-#include <boost/preprocessor/arithmetic/sub.hpp>
+#include <boost/preprocessor/arithmetic/dec.hpp>
 
 #include <boost/spirit/home/phoenix/operator/detail/mem_fun_ptr_eval.hpp>
 
@@ -38,7 +38,7 @@
         }
 
 #define BOOST_PP_ITERATION_PARAMS_1 \
- (3, (1, BOOST_PP_SUB(PHOENIX_MEMBER_LIMIT, 2), "boost/spirit/home/phoenix/operator/detail/mem_fun_ptr_gen.hpp"))
+ (3, (1, BOOST_PP_DEC(BOOST_PP_DEC(PHOENIX_MEMBER_LIMIT)), "boost/spirit/home/phoenix/operator/detail/mem_fun_ptr_gen.hpp"))
 
 #include BOOST_PP_ITERATE()
 

Modified: branches/release/boost/spirit/home/phoenix/operator/member.hpp
==============================================================================
--- branches/release/boost/spirit/home/phoenix/operator/member.hpp (original)
+++ branches/release/boost/spirit/home/phoenix/operator/member.hpp 2009-09-14 12:50:29 EDT (Mon, 14 Sep 2009)
@@ -29,12 +29,6 @@
 
 #include <boost/get_pointer.hpp>
 
-#include <boost/preprocessor/arithmetic/sub.hpp>
-
-#if !defined(PHOENIX_MEMBER_LIMIT)
-#define PHOENIX_MEMBER_LIMIT BOOST_PP_SUB(PHOENIX_COMPOSITE_LIMIT, 2)
-#endif
-
 #include <boost/spirit/home/phoenix/operator/detail/mem_fun_ptr_gen.hpp>
 
 #include <memory>

Modified: branches/release/boost/spirit/home/phoenix/scope/dynamic.hpp
==============================================================================
--- branches/release/boost/spirit/home/phoenix/scope/dynamic.hpp (original)
+++ branches/release/boost/spirit/home/phoenix/scope/dynamic.hpp 2009-09-14 12:50:29 EDT (Mon, 14 Sep 2009)
@@ -8,10 +8,6 @@
 #ifndef PHOENIX_SCOPE_DYNAMIC_HPP
 #define PHOENIX_SCOPE_DYNAMIC_HPP
 
-#if !defined(PHOENIX_DYNAMIC_LIMIT)
-# define PHOENIX_DYNAMIC_LIMIT PHOENIX_LIMIT
-#endif
-
 #include <boost/spirit/home/phoenix/core/limits.hpp>
 #include <boost/fusion/include/at.hpp>
 #include <boost/fusion/include/vector.hpp>
@@ -102,17 +98,17 @@
         DynamicScope const& scope;
     };
 
- template <BOOST_PP_ENUM_PARAMS_WITH_A_DEFAULT(PHOENIX_LIMIT, typename T, void_)>
+ template <BOOST_PP_ENUM_PARAMS_WITH_A_DEFAULT(PHOENIX_DYNAMIC_LIMIT, typename T, void_)>
     struct dynamic : noncopyable
     {
- typedef fusion::vector<BOOST_PP_ENUM_PARAMS(PHOENIX_LIMIT, T)> tuple_type;
- typedef dynamic<BOOST_PP_ENUM_PARAMS(PHOENIX_LIMIT, T)> self_type;
+ typedef fusion::vector<BOOST_PP_ENUM_PARAMS(PHOENIX_DYNAMIC_LIMIT, T)> tuple_type;
+ typedef dynamic<BOOST_PP_ENUM_PARAMS(PHOENIX_DYNAMIC_LIMIT, T)> self_type;
         typedef dynamic_frame<self_type> dynamic_frame_type;
 
         dynamic()
             : frame(0) {}
 
- BOOST_PP_REPEAT(PHOENIX_LIMIT, PHOENIX_DYNAMIC_MEMBER, _)
+ BOOST_PP_REPEAT(PHOENIX_DYNAMIC_LIMIT, PHOENIX_DYNAMIC_MEMBER, _)
 
     private:
 

Modified: branches/release/boost/spirit/home/phoenix/scope/lambda.hpp
==============================================================================
--- branches/release/boost/spirit/home/phoenix/scope/lambda.hpp (original)
+++ branches/release/boost/spirit/home/phoenix/scope/lambda.hpp 2009-09-14 12:50:29 EDT (Mon, 14 Sep 2009)
@@ -8,10 +8,6 @@
 #ifndef PHOENIX_SCOPE_LAMBDA_HPP
 #define PHOENIX_SCOPE_LAMBDA_HPP
 
-#if !defined(PHOENIX_LOCAL_LIMIT)
-# define PHOENIX_LOCAL_LIMIT PHOENIX_LIMIT
-#endif
-
 #include <boost/spirit/home/phoenix/core/limits.hpp>
 #include <boost/spirit/home/phoenix/core/composite.hpp>
 #include <boost/spirit/home/phoenix/scope/scoped_environment.hpp>

Modified: branches/release/boost/spirit/home/phoenix/scope/let.hpp
==============================================================================
--- branches/release/boost/spirit/home/phoenix/scope/let.hpp (original)
+++ branches/release/boost/spirit/home/phoenix/scope/let.hpp 2009-09-14 12:50:29 EDT (Mon, 14 Sep 2009)
@@ -8,10 +8,6 @@
 #ifndef PHOENIX_SCOPE_LET_HPP
 #define PHOENIX_SCOPE_LET_HPP
 
-#if !defined(PHOENIX_LOCAL_LIMIT)
-# define PHOENIX_LOCAL_LIMIT PHOENIX_LIMIT
-#endif
-
 #include <boost/spirit/home/phoenix/core/limits.hpp>
 #include <boost/spirit/home/phoenix/core/composite.hpp>
 #include <boost/spirit/home/phoenix/scope/scoped_environment.hpp>

Modified: branches/release/boost/spirit/home/phoenix/scope/local_variable.hpp
==============================================================================
--- branches/release/boost/spirit/home/phoenix/scope/local_variable.hpp (original)
+++ branches/release/boost/spirit/home/phoenix/scope/local_variable.hpp 2009-09-14 12:50:29 EDT (Mon, 14 Sep 2009)
@@ -8,10 +8,6 @@
 #ifndef PHOENIX_SCOPE_LOCAL_VARIABLE_HPP
 #define PHOENIX_SCOPE_LOCAL_VARIABLE_HPP
 
-#if !defined(PHOENIX_LOCAL_LIMIT)
-# define PHOENIX_LOCAL_LIMIT PHOENIX_LIMIT
-#endif
-
 #include <boost/spirit/home/phoenix/core/limits.hpp>
 #include <boost/spirit/home/phoenix/detail/local_reference.hpp>
 #include <boost/spirit/home/phoenix/scope/detail/local_variable.hpp>

Modified: branches/release/boost/spirit/home/phoenix/statement/detail/catch_all_eval.hpp
==============================================================================
--- branches/release/boost/spirit/home/phoenix/statement/detail/catch_all_eval.hpp (original)
+++ branches/release/boost/spirit/home/phoenix/statement/detail/catch_all_eval.hpp 2009-09-14 12:50:29 EDT (Mon, 14 Sep 2009)
@@ -16,7 +16,7 @@
 #include <boost/preprocessor/repetition/enum_params.hpp>
 #include <boost/preprocessor/repetition/enum_binary_params.hpp>
 #include <boost/preprocessor/repetition/repeat.hpp>
-#include <boost/preprocessor/arithmetic/sub.hpp>
+#include <boost/preprocessor/dec.hpp>
 #include <boost/preprocessor/cat.hpp>
 #include <boost/mpl/void.hpp>
 
@@ -75,7 +75,7 @@
             }
 
 #define BOOST_PP_ITERATION_PARAMS_2 \
- (3, (0, BOOST_PP_SUB(PHOENIX_ITERATION, 1), "boost/spirit/home/phoenix/statement/detail/catch_all_eval.hpp"))
+ (3, (0, BOOST_PP_DEC(PHOENIX_ITERATION), "boost/spirit/home/phoenix/statement/detail/catch_all_eval.hpp"))
 
 #include BOOST_PP_ITERATE()
 

Modified: branches/release/boost/spirit/home/phoenix/statement/detail/catch_eval.hpp
==============================================================================
--- branches/release/boost/spirit/home/phoenix/statement/detail/catch_eval.hpp (original)
+++ branches/release/boost/spirit/home/phoenix/statement/detail/catch_eval.hpp 2009-09-14 12:50:29 EDT (Mon, 14 Sep 2009)
@@ -16,7 +16,7 @@
 #include <boost/preprocessor/repetition/enum_params.hpp>
 #include <boost/preprocessor/repetition/enum_binary_params.hpp>
 #include <boost/preprocessor/repetition/repeat.hpp>
-#include <boost/preprocessor/arithmetic/sub.hpp>
+#include <boost/preprocessor/dec.hpp>
 #include <boost/preprocessor/cat.hpp>
 #include <boost/mpl/void.hpp>
 
@@ -57,7 +57,7 @@
             }
 
 #define BOOST_PP_ITERATION_PARAMS_2 \
- (3, (0, BOOST_PP_SUB(PHOENIX_ITERATION, 1), "boost/spirit/home/phoenix/statement/detail/catch_eval.hpp"))
+ (3, (0, BOOST_PP_DEC(PHOENIX_ITERATION), "boost/spirit/home/phoenix/statement/detail/catch_eval.hpp"))
 
 #include BOOST_PP_ITERATE()
 

Modified: branches/release/boost/spirit/home/phoenix/statement/try_catch.hpp
==============================================================================
--- branches/release/boost/spirit/home/phoenix/statement/try_catch.hpp (original)
+++ branches/release/boost/spirit/home/phoenix/statement/try_catch.hpp 2009-09-14 12:50:29 EDT (Mon, 14 Sep 2009)
@@ -15,12 +15,6 @@
 #include <boost/fusion/include/push_back.hpp>
 #include <boost/fusion/include/as_vector.hpp>
 
-#include <boost/preprocessor/arithmetic/sub.hpp>
-
-#if !defined(PHOENIX_CATCH_LIMIT)
-#define PHOENIX_CATCH_LIMIT BOOST_PP_SUB(PHOENIX_COMPOSITE_LIMIT, 1)
-#endif
-
 #include <boost/spirit/home/phoenix/statement/detail/catch_composite.hpp>
 #include <boost/spirit/home/phoenix/statement/detail/catch_eval.hpp>
 #include <boost/spirit/home/phoenix/statement/detail/catch_all_eval.hpp>

Modified: branches/release/boost/spirit/home/phoenix/stl/algorithm/detail/is_std_hash_map.hpp
==============================================================================
--- branches/release/boost/spirit/home/phoenix/stl/algorithm/detail/is_std_hash_map.hpp (original)
+++ branches/release/boost/spirit/home/phoenix/stl/algorithm/detail/is_std_hash_map.hpp 2009-09-14 12:50:29 EDT (Mon, 14 Sep 2009)
@@ -29,28 +29,59 @@
         : boost::mpl::false_
     {};
 
+ template<class T>
+ struct is_std_hash_multimap
+ : boost::mpl::false_
+ {};
+
+#ifdef BOOST_HAS_HASH
+
     template<
         class Kty
- , class Tr
+ , class Ty
+ , class Hash
+ , class Cmp
       , class Alloc
>
- struct is_std_hash_map< ::stdext::hash_map<Kty,Tr,Alloc> >
+ struct is_std_hash_map< ::BOOST_STD_EXTENSION_NAMESPACE::hash_map<Kty,Ty,Hash,Cmp,Alloc> >
         : boost::mpl::true_
     {};
 
- template<class T>
- struct is_std_hash_multimap
- : boost::mpl::false_
+ template<
+ class Kty
+ , class Ty
+ , class Hash
+ , class Cmp
+ , class Alloc
+ >
+ struct is_std_hash_multimap< ::BOOST_STD_EXTENSION_NAMESPACE::hash_multimap<Kty,Ty,Hash,Cmp,Alloc> >
+ : boost::mpl::true_
     {};
 
+#elif defined(BOOST_DINKUMWARE_STDLIB)
+
     template<
         class Kty
+ , class Ty
       , class Tr
       , class Alloc
>
- struct is_std_hash_multimap< ::stdext::hash_multimap<Kty,Tr,Alloc> >
+ struct is_std_hash_map< ::BOOST_STD_EXTENSION_NAMESPACE::hash_map<Kty,Ty,Tr,Alloc> >
         : boost::mpl::true_
     {};
+
+ template<
+ class Kty
+ , class Ty
+ , class Tr
+ , class Alloc
+ >
+ struct is_std_hash_multimap< ::BOOST_STD_EXTENSION_NAMESPACE::hash_multimap<Kty,Ty,Tr,Alloc> >
+ : boost::mpl::true_
+ {};
+
+#endif
+
 }
 
 #endif

Modified: branches/release/boost/spirit/home/phoenix/stl/algorithm/detail/is_std_hash_set.hpp
==============================================================================
--- branches/release/boost/spirit/home/phoenix/stl/algorithm/detail/is_std_hash_set.hpp (original)
+++ branches/release/boost/spirit/home/phoenix/stl/algorithm/detail/is_std_hash_set.hpp 2009-09-14 12:50:29 EDT (Mon, 14 Sep 2009)
@@ -29,28 +29,55 @@
         : boost::mpl::false_
     {};
 
+ template<class T>
+ struct is_std_hash_multiset
+ : boost::mpl::false_
+ {};
+
+#if defined(BOOST_HAS_HASH)
+
     template<
         class Kty
- , class Tr
+ , class Hash
+ , class Cmp
       , class Alloc
>
- struct is_std_hash_set< ::stdext::hash_set<Kty,Tr,Alloc> >
+ struct is_std_hash_set< ::BOOST_STD_EXTENSION_NAMESPACE::hash_set<Kty,Hash,Cmp,Alloc> >
         : boost::mpl::true_
     {};
 
- template<class T>
- struct is_std_hash_multiset
- : boost::mpl::false_
+ template<
+ class Kty
+ , class Hash
+ , class Cmp
+ , class Alloc
+ >
+ struct is_std_hash_multiset< ::BOOST_STD_EXTENSION_NAMESPACE::hash_multiset<Kty,Hash,Cmp,Alloc> >
+ : boost::mpl::true_
     {};
 
+#elif defined(BOOST_DINKUMWARE_STDLIB)
+
     template<
         class Kty
       , class Tr
       , class Alloc
>
- struct is_std_hash_multiset< ::stdext::hash_multiset<Kty,Tr,Alloc> >
+ struct is_std_hash_set< ::BOOST_STD_EXTENSION_NAMESPACE::hash_set<Kty,Tr,Alloc> >
         : boost::mpl::true_
     {};
+
+ template<
+ class Kty
+ , class Tr
+ , class Alloc
+ >
+ struct is_std_hash_multiset< ::BOOST_STD_EXTENSION_NAMESPACE::hash_multiset<Kty,Tr,Alloc> >
+ : boost::mpl::true_
+ {};
+
+#endif
+
 }
 
 #endif

Modified: branches/release/boost/spirit/home/phoenix/stl/algorithm/detail/is_std_list.hpp
==============================================================================
--- branches/release/boost/spirit/home/phoenix/stl/algorithm/detail/is_std_list.hpp (original)
+++ branches/release/boost/spirit/home/phoenix/stl/algorithm/detail/is_std_list.hpp 2009-09-14 12:50:29 EDT (Mon, 14 Sep 2009)
@@ -20,7 +20,7 @@
 #define IS_STD_LIST_EN_16_12_2004
 
 #include <boost/mpl/bool.hpp>
-#include "./std_list_fwd.hpp"
+#include <boost/detail/container_fwd.hpp>
 
 namespace boost
 {

Modified: branches/release/boost/spirit/home/phoenix/stl/algorithm/detail/is_std_map.hpp
==============================================================================
--- branches/release/boost/spirit/home/phoenix/stl/algorithm/detail/is_std_map.hpp (original)
+++ branches/release/boost/spirit/home/phoenix/stl/algorithm/detail/is_std_map.hpp 2009-09-14 12:50:29 EDT (Mon, 14 Sep 2009)
@@ -20,7 +20,7 @@
 #define IS_STD_MAP_EN_16_12_2004
 
 #include <boost/mpl/bool.hpp>
-#include "./std_map_fwd.hpp"
+#include <boost/detail/container_fwd.hpp>
 
 namespace boost
 {

Modified: branches/release/boost/spirit/home/phoenix/stl/algorithm/detail/is_std_set.hpp
==============================================================================
--- branches/release/boost/spirit/home/phoenix/stl/algorithm/detail/is_std_set.hpp (original)
+++ branches/release/boost/spirit/home/phoenix/stl/algorithm/detail/is_std_set.hpp 2009-09-14 12:50:29 EDT (Mon, 14 Sep 2009)
@@ -20,7 +20,7 @@
 #define IS_STD_SET_EN_16_12_2004
 
 #include <boost/mpl/bool.hpp>
-#include "./std_set_fwd.hpp"
+#include <boost/detail/container_fwd.hpp>
 
 namespace boost
 {

Modified: branches/release/boost/spirit/home/phoenix/stl/algorithm/detail/std_hash_map_fwd.hpp
==============================================================================
--- branches/release/boost/spirit/home/phoenix/stl/algorithm/detail/std_hash_map_fwd.hpp (original)
+++ branches/release/boost/spirit/home/phoenix/stl/algorithm/detail/std_hash_map_fwd.hpp 2009-09-14 12:50:29 EDT (Mon, 14 Sep 2009)
@@ -19,10 +19,38 @@
 #ifndef STD_HASH_MAP_FWD_EN_16_12_2004
 #define STD_HASH_MAP_FWD_EN_16_12_2004
 
-namespace stdext
+#include <boost/config.hpp>
+
+#if defined(BOOST_HAS_HASH)
+
+namespace BOOST_STD_EXTENSION_NAMESPACE
 {
     template<
         class Kty
+ , class Ty
+ , class Hash
+ , class Cmp
+ , class Alloc
+ >
+ class hash_map;
+
+ template<
+ class Kty
+ , class Ty
+ , class Hash
+ , class Cmp
+ , class Alloc
+ >
+ class hash_multimap;
+}
+
+#elif defined(BOOST_DINKUMWARE_STDLIB)
+
+namespace BOOST_STD_EXTENSION_NAMESPACE
+{
+ template<
+ class Kty
+ , class Ty
       , class Tr
       , class Alloc
>
@@ -30,6 +58,7 @@
 
     template<
         class Kty
+ , class Ty
       , class Tr
       , class Alloc
>
@@ -37,3 +66,5 @@
 }
 
 #endif
+
+#endif

Modified: branches/release/boost/spirit/home/phoenix/stl/algorithm/detail/std_hash_set_fwd.hpp
==============================================================================
--- branches/release/boost/spirit/home/phoenix/stl/algorithm/detail/std_hash_set_fwd.hpp (original)
+++ branches/release/boost/spirit/home/phoenix/stl/algorithm/detail/std_hash_set_fwd.hpp 2009-09-14 12:50:29 EDT (Mon, 14 Sep 2009)
@@ -19,7 +19,32 @@
 #ifndef STD_HASH_SET_FWD_EN_16_12_2004
 #define STD_HASH_SET_FWD_EN_16_12_2004
 
-namespace stdext
+#include <boost/config.hpp>
+
+#if defined(BOOST_HAS_HASH)
+
+namespace BOOST_STD_EXTENSION_NAMESPACE
+{
+ template<
+ class Kty
+ , class Hash
+ , class Cmp
+ , class Alloc
+ >
+ class hash_set;
+
+ template<
+ class Kty
+ , class Hash
+ , class Cmp
+ , class Alloc
+ >
+ class hash_multiset;
+}
+
+#elif defined(BOOST_DINKUMWARE_STDLIB)
+
+namespace BOOST_STD_EXTENSION_NAMESPACE
 {
     template<
         class Kty
@@ -37,3 +62,5 @@
 }
 
 #endif
+
+#endif

Deleted: branches/release/boost/spirit/home/phoenix/stl/algorithm/detail/std_list_fwd.hpp
==============================================================================
--- branches/release/boost/spirit/home/phoenix/stl/algorithm/detail/std_list_fwd.hpp 2009-09-14 12:50:29 EDT (Mon, 14 Sep 2009)
+++ (empty file)
@@ -1,31 +0,0 @@
-// Copyright 2005 Daniel Wallin.
-// Copyright 2005 Joel de Guzman.
-//
-// Use, modification and distribution is subject to the Boost Software
-// License, Version 1.0. (See accompanying file LICENSE_1_0.txt or copy at
-// http://www.boost.org/LICENSE_1_0.txt)
-//
-// Modeled after range_ex, Copyright 2004 Eric Niebler
-///////////////////////////////////////////////////////////////////////////////
-//
-// std_list_fwd.hpp
-//
-/////////////////////////////////////////////////////////////////////////////
-
-#if defined(_MSC_VER) && _MSC_VER >= 1000
-# pragma once
-#endif
-
-#ifndef STD_LIST_FWD_EN_16_12_2004
-#define STD_LIST_FWD_EN_16_12_2004
-
-namespace std
-{
- template<
- class Ty
- , class Alloc
- >
- class list;
-}
-
-#endif

Deleted: branches/release/boost/spirit/home/phoenix/stl/algorithm/detail/std_map_fwd.hpp
==============================================================================
--- branches/release/boost/spirit/home/phoenix/stl/algorithm/detail/std_map_fwd.hpp 2009-09-14 12:50:29 EDT (Mon, 14 Sep 2009)
+++ (empty file)
@@ -1,41 +0,0 @@
-// Copyright 2005 Daniel Wallin.
-// Copyright 2005 Joel de Guzman.
-//
-// Use, modification and distribution is subject to the Boost Software
-// License, Version 1.0. (See accompanying file LICENSE_1_0.txt or copy at
-// http://www.boost.org/LICENSE_1_0.txt)
-//
-// Modeled after range_ex, Copyright 2004 Eric Niebler
-///////////////////////////////////////////////////////////////////////////////
-//
-// std_map_fwd.hpp
-//
-/////////////////////////////////////////////////////////////////////////////
-
-#if defined(_MSC_VER) && _MSC_VER >= 1000
-# pragma once
-#endif
-
-#ifndef STD_MAP_FWD_EN_16_12_2004
-#define STD_MAP_FWD_EN_16_12_2004
-
-namespace std
-{
- template<
- class Kty
- , class Ty
- , class Pr
- , class Alloc
- >
- class map;
-
- template<
- class Kty
- , class Ty
- , class Pr
- , class Alloc
- >
- class multimap;
-}
-
-#endif

Deleted: branches/release/boost/spirit/home/phoenix/stl/algorithm/detail/std_set_fwd.hpp
==============================================================================
--- branches/release/boost/spirit/home/phoenix/stl/algorithm/detail/std_set_fwd.hpp 2009-09-14 12:50:29 EDT (Mon, 14 Sep 2009)
+++ (empty file)
@@ -1,39 +0,0 @@
-// Copyright 2005 Daniel Wallin.
-// Copyright 2005 Joel de Guzman.
-//
-// Use, modification and distribution is subject to the Boost Software
-// License, Version 1.0. (See accompanying file LICENSE_1_0.txt or copy at
-// http://www.boost.org/LICENSE_1_0.txt)
-//
-// Modeled after range_ex, Copyright 2004 Eric Niebler
-///////////////////////////////////////////////////////////////////////////////
-//
-// std_set_fwd.hpp
-//
-/////////////////////////////////////////////////////////////////////////////
-
-#if defined(_MSC_VER) && _MSC_VER >= 1000
-# pragma once
-#endif
-
-#ifndef STD_SET_FWD_EN_16_12_2004
-#define STD_SET_FWD_EN_16_12_2004
-
-namespace std
-{
- template<
- class Kty
- , class Pr
- , class Alloc
- >
- class set;
-
- template<
- class Kty
- , class Pr
- , class Alloc
- >
- class multiset;
-}
-
-#endif

Modified: branches/release/boost/spirit/home/phoenix/stl/container/container.hpp
==============================================================================
--- branches/release/boost/spirit/home/phoenix/stl/container/container.hpp (original)
+++ branches/release/boost/spirit/home/phoenix/stl/container/container.hpp 2009-09-14 12:50:29 EDT (Mon, 14 Sep 2009)
@@ -8,12 +8,6 @@
 #ifndef PHOENIX_STL_CONTAINER_CONTAINER_HPP
 #define PHOENIX_STL_CONTAINER_CONTAINER_HPP
 
-#include <boost/spirit/home/phoenix/core/limits.hpp>
-
-#if (PHOENIX_LIMIT < 5)
-# error "PHOENIX_LIMIT is set too low"
-#endif
-
 #include <boost/spirit/home/phoenix/stl/container/detail/container.hpp>
 #include <boost/spirit/home/phoenix/function/function.hpp>
 #include <boost/mpl/and.hpp>

Modified: branches/release/boost/spirit/home/qi.hpp
==============================================================================
--- branches/release/boost/spirit/home/qi.hpp (original)
+++ branches/release/boost/spirit/home/qi.hpp 2009-09-14 12:50:29 EDT (Mon, 14 Sep 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: branches/release/boost/spirit/home/qi/action.hpp
==============================================================================
--- branches/release/boost/spirit/home/qi/action.hpp (original)
+++ branches/release/boost/spirit/home/qi/action.hpp 2009-09-14 12:50:29 EDT (Mon, 14 Sep 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: branches/release/boost/spirit/home/qi/action/action.hpp
==============================================================================
--- branches/release/boost/spirit/home/qi/action/action.hpp (original)
+++ branches/release/boost/spirit/home/qi/action/action.hpp 2009-09-14 12:50:29 EDT (Mon, 14 Sep 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: branches/release/boost/spirit/home/qi/action/meta_grammar.hpp
==============================================================================
--- branches/release/boost/spirit/home/qi/action/meta_grammar.hpp 2009-09-14 12:50:29 EDT (Mon, 14 Sep 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: branches/release/boost/spirit/home/qi/auxiliary.hpp
==============================================================================
--- branches/release/boost/spirit/home/qi/auxiliary.hpp (original)
+++ branches/release/boost/spirit/home/qi/auxiliary.hpp 2009-09-14 12:50:29 EDT (Mon, 14 Sep 2009)
@@ -1,20 +1,21 @@
 /*=============================================================================
- 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>
+#include <boost/spirit/home/qi/auxiliary/attr.hpp>
 
 #endif

Deleted: branches/release/boost/spirit/home/qi/auxiliary/confix.hpp
==============================================================================
--- branches/release/boost/spirit/home/qi/auxiliary/confix.hpp 2009-09-14 12:50:29 EDT (Mon, 14 Sep 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

Modified: branches/release/boost/spirit/home/qi/auxiliary/eps.hpp
==============================================================================
--- branches/release/boost/spirit/home/qi/auxiliary/eps.hpp (original)
+++ branches/release/boost/spirit/home/qi/auxiliary/eps.hpp 2009-09-14 12:50:29 EDT (Mon, 14 Sep 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,68 +7,122 @@
 #if !defined(BOOST_SPIRIT_EPS_MARCH_23_2007_0454PM)
 #define BOOST_SPIRIT_EPS_MARCH_23_2007_0454PM
 
+#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/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: branches/release/boost/spirit/home/qi/auxiliary/functor.hpp
==============================================================================
--- branches/release/boost/spirit/home/qi/auxiliary/functor.hpp 2009-09-14 12:50:29 EDT (Mon, 14 Sep 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: branches/release/boost/spirit/home/qi/auxiliary/functor_director.hpp
==============================================================================
--- branches/release/boost/spirit/home/qi/auxiliary/functor_director.hpp 2009-09-14 12:50:29 EDT (Mon, 14 Sep 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: branches/release/boost/spirit/home/qi/auxiliary/lazy.hpp
==============================================================================
--- branches/release/boost/spirit/home/qi/auxiliary/lazy.hpp (original)
+++ branches/release/boost/spirit/home/qi/auxiliary/lazy.hpp 2009-09-14 12:50:29 EDT (Mon, 14 Sep 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,215 @@
 #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;
+ typedef modify<qi::domain> qi_modify;
+
+ template <typename Function, typename Modifiers>
+ struct lazy_parser : parser<lazy_parser<Function, Modifiers> >
     {
- template <typename Component, typename Context, typename Iterator>
+ template <typename Context, typename Iterator>
         struct attribute
         {
             typedef typename
- result_of::subject<Component>::type
- subject_type;
+ boost::result_of<qi_modify(tag::lazy_eval, Modifiers)>::type
+ modifier;
 
             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, modifier>::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, Modifiers const& modifiers)
+ : function(function), modifiers(modifiers) {}
+
+ 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
+ {
+ return compile<qi::domain>(function(unused, context)
+ , qi_modify()(tag::lazy_eval(), modifiers))
+ .parse(first, last, context, skipper, attr);
+ }
+
+ template <typename Context>
+ info what(Context& context) const
+ {
+ return info("lazy"
+ , compile<qi::domain>(function(unused, context)
+ , qi_modify()(tag::lazy_eval(), modifiers))
+ .what(context)
+ );
+ }
+
+ Function function;
+ Modifiers modifiers;
+ };
+
+
+ template <typename Function, typename Subject, typename Modifiers>
+ struct lazy_directive
+ : unary_parser<lazy_directive<Function, Subject, Modifiers> >
+ {
+ typedef Subject subject_type;
+
+ template <typename Context, typename Iterator>
+ struct attribute
         {
             typedef typename
- result_of::subject<Component>::type
- subject_type;
+ boost::result_of<qi_modify(tag::lazy_eval, Modifiers)>::type
+ modifier;
 
             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, modifier>::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
+ , Modifiers const& modifiers)
+ : function(function), subject(subject), modifiers(modifiers) {}
+
+ 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
+ ), qi_modify()(tag::lazy_eval(), modifiers))
+ .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
+ ), qi_modify()(tag::lazy_eval(), modifiers))
+ .what(context)
+ );
+ }
+
+ Function function;
+ Subject subject;
+ Modifiers modifiers;
+ };
 
- 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>, Modifiers> result_type;
+ result_type operator()(phoenix::actor<Eval> const& f
+ , Modifiers const& modifiers) const
+ {
+ return result_type(f, modifiers);
+ }
+ };
+
+ template <typename Terminal, typename Actor, int Arity, typename Modifiers>
+ struct make_primitive<lazy_terminal<Terminal, Actor, Arity>, Modifiers>
+ {
+ typedef lazy_parser<Actor, Modifiers> result_type;
+ result_type operator()(
+ lazy_terminal<Terminal, Actor, Arity> const& lt
+ , Modifiers const& modifiers) const
+ {
+ return result_type(lt.actor, modifiers);
+ }
+ };
+
+ 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, Modifiers> result_type;
+ result_type operator()(
+ lazy_terminal<Terminal, Actor, Arity> const& lt
+ , Subject const& subject, Modifiers const& modifiers) const
+ {
+ return result_type(lt.actor, subject, modifiers);
         }
     };
 }}}

Deleted: branches/release/boost/spirit/home/qi/auxiliary/meta_grammar.hpp
==============================================================================
--- branches/release/boost/spirit/home/qi/auxiliary/meta_grammar.hpp 2009-09-14 12:50:29 EDT (Mon, 14 Sep 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: branches/release/boost/spirit/home/qi/auxiliary/none.hpp
==============================================================================
--- branches/release/boost/spirit/home/qi/auxiliary/none.hpp 2009-09-14 12:50:29 EDT (Mon, 14 Sep 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: branches/release/boost/spirit/home/qi/auxiliary/primitives.hpp
==============================================================================
--- branches/release/boost/spirit/home/qi/auxiliary/primitives.hpp 2009-09-14 12:50:29 EDT (Mon, 14 Sep 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: branches/release/boost/spirit/home/qi/binary.hpp
==============================================================================
--- branches/release/boost/spirit/home/qi/binary.hpp (original)
+++ branches/release/boost/spirit/home/qi/binary.hpp 2009-09-14 12:50:29 EDT (Mon, 14 Sep 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: branches/release/boost/spirit/home/qi/binary/binary.hpp
==============================================================================
--- branches/release/boost/spirit/home/qi/binary/binary.hpp (original)
+++ branches/release/boost/spirit/home/qi/binary/binary.hpp 2009-09-14 12:50:29 EDT (Mon, 14 Sep 2009)
@@ -1,35 +1,103 @@
-// 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(big_word) // enables big_word
+ BOOST_SPIRIT_ENABLE_BINARY(little_word) // enables little_word
+ BOOST_SPIRIT_ENABLE_BINARY(dword) // enables dword
+ 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 qi
 {
+ using boost::spirit::byte_;
+ using boost::spirit::byte__type;
+ using boost::spirit::word;
+ using boost::spirit::word_type;
+ using boost::spirit::big_word;
+ using boost::spirit::big_word_type;
+ using boost::spirit::little_word;
+ using boost::spirit::little_word_type;
+ using boost::spirit::dword;
+ using boost::spirit::dword_type;
+ using boost::spirit::big_dword;
+ using boost::spirit::big_dword_type;
+ using boost::spirit::little_dword;
+ using boost::spirit::little_dword_type;
+#ifdef BOOST_HAS_LONG_LONG
+ using boost::spirit::qword;
+ using boost::spirit::qword_type;
+ using boost::spirit::big_qword;
+ using boost::spirit::big_qword_type;
+ using boost::spirit::little_qword;
+ using boost::spirit::little_qword_type;
+#endif
+
     namespace detail
     {
         template <int bits>
         struct integer
         {
 #ifdef BOOST_HAS_LONG_LONG
- BOOST_MPL_ASSERT_MSG(
+ BOOST_SPIRIT_ASSERT_MSG(
                 bits == 8 || bits == 16 || bits == 32 || bits == 64,
                 not_supported_binary_size, ());
 #else
- BOOST_MPL_ASSERT_MSG(
+ BOOST_SPIRIT_ASSERT_MSG(
                 bits == 8 || bits == 16 || bits == 32,
                 not_supported_binary_size, ());
 #endif
@@ -62,11 +130,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 +143,7 @@
         };
 
         template <>
- struct what<boost::integer::little>
+ struct what<boost::integer::endianness::little>
         {
             static char const* is()
             {
@@ -84,7 +152,7 @@
         };
 
         template <>
- struct what<boost::integer::big>
+ struct what<boost::integer::endianness::big>
         {
             static char const* is()
             {
@@ -94,10 +162,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 +173,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 +197,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 +248,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(big_word, big, 16)
+ BOOST_SPIRIT_MAKE_BINARY_PRIMITIVE(little_word, little, 16)
+ BOOST_SPIRIT_MAKE_BINARY_PRIMITIVE(dword, native, 32)
+ BOOST_SPIRIT_MAKE_BINARY_PRIMITIVE(big_dword, big, 32)
+ 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: branches/release/boost/spirit/home/qi/binary/meta_grammar.hpp
==============================================================================
--- branches/release/boost/spirit/home/qi/binary/meta_grammar.hpp 2009-09-14 12:50:29 EDT (Mon, 14 Sep 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: branches/release/boost/spirit/home/qi/char.hpp
==============================================================================
--- branches/release/boost/spirit/home/qi/char.hpp (original)
+++ branches/release/boost/spirit/home/qi/char.hpp 2009-09-14 12:50:29 EDT (Mon, 14 Sep 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: branches/release/boost/spirit/home/qi/char/char.hpp
==============================================================================
--- branches/release/boost/spirit/home/qi/char/char.hpp (original)
+++ branches/release/boost/spirit/home/qi/char/char.hpp 2009-09-14 12:50:29 EDT (Mon, 14 Sep 2009)
@@ -1,367 +1,502 @@
 /*=============================================================================
- 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/support/char_set/basic_chset.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/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_SPIRIT_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");
         }
+
+ support::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_SPIRIT_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");
+ }
+
+ support::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
+ {
+ template <typename Modifiers, typename Encoding>
+ struct basic_literal
+ {
+ 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>
     {
- static qi::char_set_component<Char, Elements>
- call(Elements const& elements)
+ typedef tag::char_code<tag::char_, CharEncoding> tag;
+ typedef char_class<tag> result_type;
+ result_type operator()(unused_type, unused_type) const
         {
- return qi::char_set_component<Char, Elements>(
- fusion::at_c<0>(elements));
+ 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 type
- call(Elements const& elements)
+ typedef typename
+ mpl::if_<
+ traits::is_string<A0>
+ , char_set<CharEncoding, no_case>
+ , literal_char<CharEncoding, false, no_case>
+ >::type
+ result_type;
+
+ 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;
+
+ typedef literal_char<CharEncoding, false, 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: branches/release/boost/spirit/home/qi/char/char_class.hpp
==============================================================================
--- branches/release/boost/spirit/home/qi/char/char_class.hpp (original)
+++ branches/release/boost/spirit/home/qi/char/char_class.hpp 2009-09-14 12:50:29 EDT (Mon, 14 Sep 2009)
@@ -1,91 +1,97 @@
 /*=============================================================================
- 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
 {
+ // hoist the char classification namespaces into qi sub-namespaces of the same name
+ namespace ascii { using namespace boost::spirit::ascii; }
+ namespace iso8859_1 { using namespace boost::spirit::iso8859_1; }
+ namespace standard { using namespace boost::spirit::standard; }
+ namespace standard_wide { using namespace boost::spirit::standard_wide; }
+
     ///////////////////////////////////////////////////////////////////////////
- // 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: branches/release/boost/spirit/home/qi/char/char_parser.hpp
==============================================================================
--- branches/release/boost/spirit/home/qi/char/char_parser.hpp (original)
+++ branches/release/boost/spirit/home/qi/char/char_parser.hpp 2009-09-14 12:50:29 EDT (Mon, 14 Sep 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 Attr 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_SPIRIT_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));
         }
     };
 }}}

Deleted: branches/release/boost/spirit/home/qi/char/meta_grammar.hpp
==============================================================================
--- branches/release/boost/spirit/home/qi/char/meta_grammar.hpp 2009-09-14 12:50:29 EDT (Mon, 14 Sep 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: branches/release/boost/spirit/home/qi/debug.hpp
==============================================================================
--- branches/release/boost/spirit/home/qi/debug.hpp 2009-09-14 12:50:29 EDT (Mon, 14 Sep 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: branches/release/boost/spirit/home/qi/detail/alternative_function.hpp
==============================================================================
--- branches/release/boost/spirit/home/qi/detail/alternative_function.hpp (original)
+++ branches/release/boost/spirit/home/qi/detail/alternative_function.hpp 2009-09-14 12:50:29 EDT (Mon, 14 Sep 2009)
@@ -4,13 +4,18 @@
     Distributed under the 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
 {
@@ -27,16 +32,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 +52,13 @@
             return false;
         }
 
+ template <typename Component>
+ bool operator()(Component const& component) const
+ {
+ // return true if the parser succeeds
+ return call(component, spirit::traits::not_is_variant<Attribute>());
+ }
+
         Iterator& first;
         Iterator const& last;
         Context& context;
@@ -65,8 +80,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: branches/release/boost/spirit/home/qi/detail/assign_to.hpp
==============================================================================
--- branches/release/boost/spirit/home/qi/detail/assign_to.hpp (original)
+++ branches/release/boost/spirit/home/qi/detail/assign_to.hpp 2009-09-14 12:50:29 EDT (Mon, 14 Sep 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: branches/release/boost/spirit/home/qi/detail/construct.hpp
==============================================================================
--- branches/release/boost/spirit/home/qi/detail/construct.hpp (original)
+++ branches/release/boost/spirit/home/qi/detail/construct.hpp 2009-09-14 12:50:29 EDT (Mon, 14 Sep 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
+ 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 { namespace detail
 {
@@ -42,7 +44,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 +93,7 @@
             Iterator const& last)
         {
             Iterator first_ = first;
- parse(first_, last, ulong, attr);
+ parse(first_, last, ulong_, attr);
         }
 
 #ifdef BOOST_HAS_LONG_LONG
@@ -138,7 +140,7 @@
             parse(first_, last, long_double, attr);
         }
     }
-
+
 }}}}
 
 #endif

Deleted: branches/release/boost/spirit/home/qi/detail/construct_fwd.hpp
==============================================================================
--- branches/release/boost/spirit/home/qi/detail/construct_fwd.hpp 2009-09-14 12:50:29 EDT (Mon, 14 Sep 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: branches/release/boost/spirit/home/qi/detail/expect_function.hpp
==============================================================================
--- branches/release/boost/spirit/home/qi/detail/expect_function.hpp (original)
+++ branches/release/boost/spirit/home/qi/detail/expect_function.hpp 2009-09-14 12:50:29 EDT (Mon, 14 Sep 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,7 +7,12 @@
 #if !defined(SPIRIT_EXPECT_FUNCTION_APR_29_2007_0558PM)
 #define SPIRIT_EXPECT_FUNCTION_APR_29_2007_0558PM
 
+#if defined(_MSC_VER)
+#pragma once
+#endif
+
 #include <boost/spirit/home/support/unused.hpp>
+#include <boost/spirit/home/support/multi_pass_wrapper.hpp>
 
 namespace boost { namespace spirit { namespace qi { namespace detail
 {
@@ -16,6 +21,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 +36,24 @@
         }
 
         template <typename Component, typename Attribute>
- bool operator()(Component const& component, Attribute& attr)
+ bool operator()(Component const& component, Attribute& attr) const
         {
+ // if this is not the first component in the expect chain we
+ // need to flush any multi_pass iterator we might be acting on
+ if (!is_first)
+ spirit::traits::clear_queue(first);
+
             // 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 +61,24 @@
         }
 
         template <typename Component>
- bool operator()(Component const& component)
+ bool operator()(Component const& component) const
         {
+ // if this is not the first component in the expect chain we
+ // need to flush any multi_pass iterator we might be acting on
+ if (!is_first)
+ spirit::traits::clear_queue(first);
+
             // 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 +89,7 @@
         Iterator const& last;
         Context& context;
         Skipper const& skipper;
- bool is_first;
+ mutable bool is_first;
     };
 }}}}
 

Modified: branches/release/boost/spirit/home/qi/detail/fail_function.hpp
==============================================================================
--- branches/release/boost/spirit/home/qi/detail/fail_function.hpp (original)
+++ branches/release/boost/spirit/home/qi/detail/fail_function.hpp 2009-09-14 12:50:29 EDT (Mon, 14 Sep 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;

Modified: branches/release/boost/spirit/home/qi/detail/pass_function.hpp
==============================================================================
--- branches/release/boost/spirit/home/qi/detail/pass_function.hpp (original)
+++ branches/release/boost/spirit/home/qi/detail/pass_function.hpp 2009-09-14 12:50:29 EDT (Mon, 14 Sep 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: branches/release/boost/spirit/home/qi/detail/permute_function.hpp
==============================================================================
--- branches/release/boost/spirit/home/qi/detail/permute_function.hpp (original)
+++ branches/release/boost/spirit/home/qi/detail/permute_function.hpp 2009-09-14 12:50:29 EDT (Mon, 14 Sep 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: branches/release/boost/spirit/home/qi/detail/string_parse.hpp
==============================================================================
--- branches/release/boost/spirit/home/qi/detail/string_parse.hpp (original)
+++ branches/release/boost/spirit/home/qi/detail/string_parse.hpp 2009-09-14 12:50:29 EDT (Mon, 14 Sep 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: branches/release/boost/spirit/home/qi/directive.hpp
==============================================================================
--- branches/release/boost/spirit/home/qi/directive.hpp (original)
+++ branches/release/boost/spirit/home/qi/directive.hpp 2009-09-14 12:50:29 EDT (Mon, 14 Sep 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: branches/release/boost/spirit/home/qi/directive/lexeme.hpp
==============================================================================
--- branches/release/boost/spirit/home/qi/directive/lexeme.hpp (original)
+++ branches/release/boost/spirit/home/qi/directive/lexeme.hpp 2009-09-14 12:50:29 EDT (Mon, 14 Sep 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,80 @@
 #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/qi/detail/unused_skipper.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 Subject>
+ struct lexeme_directive : unary_parser<lexeme_directive<Subject> >
     {
- template <typename Component, typename Context, typename Iterator>
+ 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
+ , detail::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: branches/release/boost/spirit/home/qi/directive/meta_grammar.hpp
==============================================================================
--- branches/release/boost/spirit/home/qi/directive/meta_grammar.hpp 2009-09-14 12:50:29 EDT (Mon, 14 Sep 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

Modified: branches/release/boost/spirit/home/qi/directive/omit.hpp
==============================================================================
--- branches/release/boost/spirit/home/qi/directive/omit.hpp (original)
+++ branches/release/boost/spirit/home/qi/directive/omit.hpp 2009-09-14 12:50:29 EDT (Mon, 14 Sep 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: branches/release/boost/spirit/home/qi/directive/raw.hpp
==============================================================================
--- branches/release/boost/spirit/home/qi/directive/raw.hpp (original)
+++ branches/release/boost/spirit/home/qi/directive/raw.hpp 2009-09-14 12:50:29 EDT (Mon, 14 Sep 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);
         }
     };
 }}}

Modified: branches/release/boost/spirit/home/qi/domain.hpp
==============================================================================
--- branches/release/boost/spirit/home/qi/domain.hpp (original)
+++ branches/release/boost/spirit/home/qi/domain.hpp 2009-09-14 12:50:29 EDT (Mon, 14 Sep 2009)
@@ -1,15 +1,56 @@
 /*=============================================================================
- 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::_pass;
+ 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: branches/release/boost/spirit/home/qi/meta_grammar.hpp
==============================================================================
--- branches/release/boost/spirit/home/qi/meta_grammar.hpp 2009-09-14 12:50:29 EDT (Mon, 14 Sep 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: branches/release/boost/spirit/home/qi/nonterminal.hpp
==============================================================================
--- branches/release/boost/spirit/home/qi/nonterminal.hpp (original)
+++ branches/release/boost/spirit/home/qi/nonterminal.hpp 2009-09-14 12:50:29 EDT (Mon, 14 Sep 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

Deleted: branches/release/boost/spirit/home/qi/nonterminal/detail/error_handler.hpp
==============================================================================
--- branches/release/boost/spirit/home/qi/nonterminal/detail/error_handler.hpp 2009-09-14 12:50:29 EDT (Mon, 14 Sep 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

Deleted: branches/release/boost/spirit/home/qi/nonterminal/detail/rule.hpp
==============================================================================
--- branches/release/boost/spirit/home/qi/nonterminal/detail/rule.hpp 2009-09-14 12:50:29 EDT (Mon, 14 Sep 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

Deleted: branches/release/boost/spirit/home/qi/nonterminal/error_handler_result.hpp
==============================================================================
--- branches/release/boost/spirit/home/qi/nonterminal/error_handler_result.hpp 2009-09-14 12:50:29 EDT (Mon, 14 Sep 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: branches/release/boost/spirit/home/qi/nonterminal/grammar.hpp
==============================================================================
--- branches/release/boost/spirit/home/qi/nonterminal/grammar.hpp (original)
+++ branches/release/boost/spirit/home/qi/nonterminal/grammar.hpp 2009-09-14 12:50:29 EDT (Mon, 14 Sep 2009)
@@ -1,78 +1,92 @@
 /*=============================================================================
- 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_parameterized_subject() const
+ { return this->proto_base().child0.ref.get(); }
+ typedef start_type parameterized_subject_type;
+ #include <boost/spirit/home/qi/nonterminal/detail/fcall.hpp>
+
+ std::string name_;
+
     };
 }}}
 

Deleted: branches/release/boost/spirit/home/qi/nonterminal/grammar_fwd.hpp
==============================================================================
--- branches/release/boost/spirit/home/qi/nonterminal/grammar_fwd.hpp 2009-09-14 12:50:29 EDT (Mon, 14 Sep 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: branches/release/boost/spirit/home/qi/nonterminal/meta_grammar.hpp
==============================================================================
--- branches/release/boost/spirit/home/qi/nonterminal/meta_grammar.hpp 2009-09-14 12:50:29 EDT (Mon, 14 Sep 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: branches/release/boost/spirit/home/qi/nonterminal/nonterminal.hpp
==============================================================================
--- branches/release/boost/spirit/home/qi/nonterminal/nonterminal.hpp 2009-09-14 12:50:29 EDT (Mon, 14 Sep 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: branches/release/boost/spirit/home/qi/nonterminal/nonterminal_director.hpp
==============================================================================
--- branches/release/boost/spirit/home/qi/nonterminal/nonterminal_director.hpp 2009-09-14 12:50:29 EDT (Mon, 14 Sep 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: branches/release/boost/spirit/home/qi/nonterminal/rule.hpp
==============================================================================
--- branches/release/boost/spirit/home/qi/nonterminal/rule.hpp (original)
+++ branches/release/boost/spirit/home/qi/nonterminal/rule.hpp 2009-09-14 12:50:29 EDT (Mon, 14 Sep 2009)
@@ -1,369 +1,292 @@
 /*=============================================================================
- 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/assert.hpp>
+#include <boost/function.hpp>
+#include <boost/mpl/vector.hpp>
+#include <boost/type_traits/add_reference.hpp>
+#include <boost/utility/enable_if.hpp>
+
+#include <boost/fusion/include/vector.hpp>
+#include <boost/fusion/include/size.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/extract_param.hpp>
+#include <boost/spirit/home/support/nonterminal/locals.hpp>
+#include <boost/spirit/home/qi/reference.hpp>
+#include <boost/spirit/home/qi/nonterminal/detail/parameterized.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::_pass;
+ 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 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 intrusive_ptr<virtual_component> pointer_type;
-
- rule(std::string const& name_ = std::string())
- : name_(name_) {}
-
- ~rule() {}
+ 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
+ spirit::detail::extract_locals<template_params>::type
+ locals_type;
+
+ // The skip-parser type
+ typedef typename
+ spirit::detail::extract_component<
+ qi::domain, template_params>::type
+ skipper_type;
+
+ typedef typename
+ spirit::detail::extract_sig<template_params>::type
+ sig_type;
+
+ // This is the rule's attribute type
+ typedef typename
+ spirit::detail::attr_from_sig<sig_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
+ spirit::detail::params_from_sig<sig_type>::type
+ parameter_types;
+
+ static size_t const params_size =
+ fusion::result_of::size<parameter_types>::type::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;
+
+ explicit rule(std::string const& name_ = "unnamed-rule")
+ : base_type(terminal::make(alias()))
+ , name_(name_)
+ {
+ }
 
         rule(rule const& rhs)
- : ptr(rhs.ptr)
+ : base_type(rhs)
           , name_(rhs.name_)
+ , f(rhs.f)
         {
         }
 
+ template <typename Expr>
+ rule (Expr const& expr, std::string const& name_ = "unnamed-rule")
+ : base_type(terminal::make(alias()))
+ , name_(name_)
+ {
+ // 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);
+
+ f = detail::bind_parser<mpl::true_>(compile<qi::domain>(expr));
+ }
+
         rule& operator=(rule const& rhs)
         {
- ptr = rhs.ptr;
+ // The following assertion fires when you try to initialize a rule
+ // from an uninitialized one. Did you mean to refer to the right
+ // hand side rule instead of assigning from it? In this case you
+ // should write lhs = rhs.alias();
+ BOOST_ASSERT(rhs.f);
+
+ 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;
+ return name_;
+ }
 
- // report invalid expression error as early as possible
-// BOOST_MPL_ASSERT_MSG(
-// is_component::value,
-// xpr_is_not_convertible_to_a_parser, ());
+ void name(std::string const& str)
+ {
+ name_ = str;
+ }
 
- // temp workaround for mpl problem
- BOOST_STATIC_ASSERT(is_component::value);
+ 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 qi expression.
+ BOOST_SPIRIT_ASSERT_MATCH(qi::domain, Expr);
 
- define(xpr, mpl::false_());
+ f = detail::bind_parser<mpl::false_>(compile<qi::domain>(expr));
             return *this;
         }
 
+ // g++ 3.3 barfs if this is a member function :(
         template <typename Expr>
- friend rule& operator%=(rule& r, Expr const& xpr)
+ friend rule& operator%=(rule& r, 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, ());
+ // 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);
 
- // temp workaround for mpl problem
- BOOST_STATIC_ASSERT(is_component::value);
-
- r.define(xpr, mpl::true_());
+ r.f = detail::bind_parser<mpl::true_>(compile<qi::domain>(expr));
             return r;
         }
 
- self_type alias() const
- {
- self_type result;
- result.define(*this, mpl::false_());
- return result;
- }
-
- typename
- make_nonterminal_holder<
- nonterminal_object<self_type>
- , self_type
- >::type
- copy() const
+ // non-const version needed to suppress proto's %= kicking in
+ template <typename Expr>
+ friend rule& operator%=(rule& r, Expr& expr)
         {
- typename
- make_nonterminal_holder<
- nonterminal_object<self_type>
- , self_type
- >::type
- result = {{*this}};
- return result;
+ return r %= static_cast<Expr const&>(expr);
         }
 
- std::string const& name() const
+ template <typename Context, typename Iterator_>
+ struct attribute
         {
- return name_;
- }
+ typedef attr_type type;
+ };
 
- void name(std::string const& str)
+ template <typename Context, typename Skipper, typename Attribute>
+ bool parse(Iterator& first, Iterator const& last
+ , Context& /*context*/, Skipper const& skipper
+ , Attribute& attr) const
         {
- name_ = str;
- }
-
- private:
-
- template <typename Iterator_, typename T0_, typename T1_, typename T2_>
- friend struct grammar;
-
- friend struct detail::rule_decorator;
+ if (f)
+ {
+ typedef traits::make_attribute<attr_type, Attribute> make_attribute;
 
- 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);
- }
+ typename make_attribute::type attr_ = make_attribute::call(attr);
 
- std::string what() const
- {
- if (name_.empty())
- {
- if (ptr)
- {
- return "unnamed-rule";
- }
- else
+ // If you are seeing a compilation error here, you are probably
+ // trying to use a rule or a grammar which has inherited
+ // attributes, without passing values for them.
+ context_type context(attr_);
+
+ // If you are seeing a compilation error here stating that the
+ // forth parameter can't be converted to a qi::reference
+ // then you are probably trying to use a rule or a grammar with
+ // an incompatible skipper type.
+ if (f(first, last, context, skipper))
                 {
- return "empty-rule";
+ 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;
- }
+ typedef traits::make_attribute<attr_type, Attribute> make_attribute;
 
- 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;
- }
+ typename make_attribute::type attr_ = make_attribute::call(attr);
 
- 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;
+ // If you are seeing a compilation error here, you are probably
+ // trying to use a rule or a grammar which has inherited
+ // attributes, passing values of incompatible types for them.
+ context_type context(attr_, params, caller_context);
+
+ // If you are seeing a compilation error here stating that the
+ // forth parameter can't be converted to a qi::reference
+ // then you are probably trying to use a rule or a grammar with
+ // an incompatible skipper type.
+ if (f(first, last, context, skipper))
+ {
+ 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_parameterized_subject() const { return *this; }
+ typedef rule parameterized_subject_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

Deleted: branches/release/boost/spirit/home/qi/nonterminal/virtual_component_base.hpp
==============================================================================
--- branches/release/boost/spirit/home/qi/nonterminal/virtual_component_base.hpp 2009-09-14 12:50:29 EDT (Mon, 14 Sep 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: branches/release/boost/spirit/home/qi/numeric.hpp
==============================================================================
--- branches/release/boost/spirit/home/qi/numeric.hpp (original)
+++ branches/release/boost/spirit/home/qi/numeric.hpp 2009-09-14 12:50:29 EDT (Mon, 14 Sep 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: branches/release/boost/spirit/home/qi/numeric/detail/numeric_utils.hpp
==============================================================================
--- branches/release/boost/spirit/home/qi/numeric/detail/numeric_utils.hpp (original)
+++ branches/release/boost/spirit/home/qi/numeric/detail/numeric_utils.hpp 2009-09-14 12:50:29 EDT (Mon, 14 Sep 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>
@@ -159,7 +163,7 @@
         static void add(T& n, Char ch, mpl::false_) // unchecked add
         {
             const int digit = radix_traits<Radix>::digit(ch);
- n = n * Radix + digit;
+ n = n * T(Radix) + T(digit);
         }
 
         template <typename T, typename Char>
@@ -190,7 +194,7 @@
         static void add(T& n, Char ch, mpl::false_) // unchecked subtract
         {
             const int digit = radix_traits<Radix>::digit(ch);
- n = n * Radix - digit;
+ n = n * T(Radix) - T(digit);
         }
 
         template <typename T, typename Char>
@@ -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(
@@ -345,7 +349,7 @@
                 }
             }
 
- Attribute val = Accumulate ? attr : 0;
+ Attribute val = Accumulate ? attr : Attribute(0);
             std::size_t count = 0;
             char_type ch;
 
@@ -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(
@@ -446,7 +450,7 @@
                 }
             }
 
- Attribute val = Accumulate ? attr : 0;
+ Attribute val = Accumulate ? attr : Attribute(0);
             char_type ch = *it;
 
             if (!radix_check::is_valid(ch) || !extractor::call(ch, 0, val))
@@ -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: branches/release/boost/spirit/home/qi/numeric/detail/real_impl.hpp
==============================================================================
--- branches/release/boost/spirit/home/qi/numeric/detail/real_impl.hpp (original)
+++ branches/release/boost/spirit/home/qi/numeric/detail/real_impl.hpp 2009-09-14 12:50:29 EDT (Mon, 14 Sep 2009)
@@ -1,90 +1,135 @@
 /*=============================================================================
- 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 boost { namespace spirit { namespace traits
 {
- namespace
+ using spirit::detail::pow10;
+
+ template <typename T>
+ inline void
+ scale(int exp, T& n)
     {
- template <typename T>
- inline void
- scale_number(T const& exp, T& n)
+ if (exp >= 0)
         {
- using namespace std; // allow for ADL to find the correct overload
- n *= pow(T(10), exp);
+ // $$$ 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);
         }
-
- inline void
- scale_number(unused_type /*exp*/, unused_type /*n*/)
+ else
         {
- // no-op for unused_type
+ 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);
+ }
         }
+ }
 
- template <typename T>
- inline void
- scale_number(T const& exp, int frac, T& n)
- {
- scale_number(exp - T(frac), n);
- }
+ inline void
+ scale(int /*exp*/, unused_type /*n*/)
+ {
+ // no-op for unused_type
+ }
 
- inline void
- scale_number(unused_type /*exp*/, int /*frac*/, unused_type /*n*/)
- {
- // no-op for unused_type
- }
+ template <typename T>
+ inline void
+ scale(int exp, int frac, T& n)
+ {
+ scale(exp - frac, n);
+ }
 
- template <typename T>
- inline T
- negate_number(bool neg, T const& n)
- {
- return neg ? -n : n;
- }
+ inline void
+ scale(int /*exp*/, int /*frac*/, unused_type /*n*/)
+ {
+ // no-op for unused_type
+ }
 
- inline unused_type
- negate_number(bool /*neg*/, unused_type n)
- {
- // no-op for unused_type
- return n;
- }
-
- template <typename T>
- inline bool
- number_equal_to_one(T const& value)
- {
- return value == 1.0;
- }
+ inline float
+ negate(bool neg, float n)
+ {
+ return neg ? spirit::detail::changesign(n) : n;
+ }
 
- inline bool
- number_equal_to_one(unused_type)
- {
- // no-op for unused_type
- return false;
- }
+ inline double
+ negate(bool neg, double n)
+ {
+ return neg ? spirit::detail::changesign(n) : n;
     }
 
-#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
+ inline long double
+ negate(bool neg, long double n)
+ {
+ return neg ? spirit::detail::changesign(n) : n;
+ }
 
+ template <typename T>
+ inline T
+ negate(bool neg, T const& n)
+ {
+ return neg ? -n : n;
+ }
+
+ inline unused_type
+ negate(bool /*neg*/, unused_type n)
+ {
+ // no-op for unused_type
+ return n;
+ }
+
+ template <typename T>
+ inline bool
+ is_equal_to_one(T const& value)
+ {
+ return value == 1.0;
+ }
+
+ inline bool
+ is_equal_to_one(unused_type)
+ {
+ // no-op for unused_type
+ return false;
+ }
+}}}
+
+namespace boost { namespace spirit { namespace qi { namespace detail
+{
     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)
             {
@@ -108,10 +153,10 @@
                     p.parse_inf(first, last, attr))
                 {
                     // If we got a negative sign, negate the number
- attr = negate_number(neg, attr);
+ attr = traits::negate(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,12 +219,12 @@
             {
                 // 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
                     // exp-frac_digits.
- scale_number(exp, frac_digits, n);
+ traits::scale(exp, frac_digits, n);
                 }
                 else
                 {
@@ -191,11 +236,11 @@
             else if (frac_digits)
             {
                 // No exponent found. Scale the number by -frac_digits.
- scale_number(Attribute(-frac_digits), n);
+ traits::scale(-frac_digits, n);
             }
- else if (number_equal_to_one(n))
+ else if (traits::is_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
@@ -203,22 +248,22 @@
                     p.parse_inf(first, last, attr))
                 {
                     // If we got a negative sign, negate the number
- attr = negate_number(neg, attr);
+ attr = traits::negate(neg, attr);
                     return true; // got a NaN or Inf, return immediately
                 }
             }
-
+
             // If we got a negative sign, negate the number
- attr = negate_number(neg, n);
+ attr = traits::negate(neg, n);
 
             // Success!!!
             return true;
         }
     };
 
-#if BOOST_WORKAROUND(BOOST_MSVC, >= 1400)
-# pragma warning(pop)
-#endif
+#if BOOST_WORKAROUND(BOOST_MSVC, >= 1400)
+# pragma warning(pop)
+#endif
 
 }}}}
 

Modified: branches/release/boost/spirit/home/qi/numeric/int.hpp
==============================================================================
--- branches/release/boost/spirit/home/qi/numeric/int.hpp (original)
+++ branches/release/boost/spirit/home/qi/numeric/int.hpp 2009-09-14 12:50:29 EDT (Mon, 14 Sep 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(
+ BOOST_SPIRIT_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: branches/release/boost/spirit/home/qi/numeric/meta_grammar.hpp
==============================================================================
--- branches/release/boost/spirit/home/qi/numeric/meta_grammar.hpp 2009-09-14 12:50:29 EDT (Mon, 14 Sep 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: branches/release/boost/spirit/home/qi/numeric/numeric_utils.hpp
==============================================================================
--- branches/release/boost/spirit/home/qi/numeric/numeric_utils.hpp (original)
+++ branches/release/boost/spirit/home/qi/numeric/numeric_utils.hpp 2009-09-14 12:50:29 EDT (Mon, 14 Sep 2009)
@@ -1,21 +1,26 @@
 /*=============================================================================
- 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/support/assert_msg.hpp>
 #include <boost/spirit/home/qi/numeric/detail/numeric_utils.hpp>
 #include <boost/assert.hpp>
 #include <boost/mpl/assert.hpp>
 
 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,21 +37,24 @@
         return false;
     }
 
- ///////////////////////////////////////////////////////////////////////
+ ///////////////////////////////////////////////////////////////////////////
     // Low level unsigned integer parser
- ///////////////////////////////////////////////////////////////////////
+ ///////////////////////////////////////////////////////////////////////////
     template <typename T, unsigned Radix, unsigned MinDigits, int MaxDigits
       , bool Accumulate = false>
     struct extract_uint
     {
         // check template parameter 'Radix' for validity
- BOOST_MPL_ASSERT_MSG(
+ BOOST_SPIRIT_ASSERT_MSG(
             Radix == 2 || Radix == 8 || Radix == 10 || Radix == 16,
             not_supported_radix, ());
 
         template <typename Iterator, typename Attribute>
         static bool call(Iterator& first, Iterator const& last, Attribute& attr)
         {
+ if (first == last)
+ return false;
+
             typedef detail::extract_int<
                 T
               , Radix
@@ -66,14 +74,14 @@
         }
     };
 
- ///////////////////////////////////////////////////////////////////////
+ ///////////////////////////////////////////////////////////////////////////
     // Low level signed integer parser
- ///////////////////////////////////////////////////////////////////////
+ ///////////////////////////////////////////////////////////////////////////
     template <typename T, unsigned Radix, unsigned MinDigits, int MaxDigits>
     struct extract_int
     {
         // check template parameter 'Radix' for validity
- BOOST_MPL_ASSERT_MSG(
+ BOOST_SPIRIT_ASSERT_MSG(
             Radix == 2 || Radix == 8 || Radix == 10 || Radix == 16,
             not_supported_radix, ());
 

Modified: branches/release/boost/spirit/home/qi/numeric/real.hpp
==============================================================================
--- branches/release/boost/spirit/home/qi/numeric/real.hpp (original)
+++ branches/release/boost/spirit/home/qi/numeric/real.hpp 2009-09-14 12:50:29 EDT (Mon, 14 Sep 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");
         }
+ };
 
- template <typename Component, typename Context>
- static std::string what(Component const& component, Context const& ctx)
+ ///////////////////////////////////////////////////////////////////////////
+ // This one is the class that the user can instantiate directly
+ ///////////////////////////////////////////////////////////////////////////
+ template <
+ typename T,
+ typename RealPolicies = real_policies<T>
+ >
+ struct real_parser
+ : proto::terminal<real_parser_impl<T, RealPolicies> >::type
+ {
+ };
+
+ ///////////////////////////////////////////////////////////////////////////
+ // 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: branches/release/boost/spirit/home/qi/numeric/real_policies.hpp
==============================================================================
--- branches/release/boost/spirit/home/qi/numeric/real_policies.hpp (original)
+++ branches/release/boost/spirit/home/qi/numeric/real_policies.hpp 2009-09-14 12:50:29 EDT (Mon, 14 Sep 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
- // with a 1.0 (such as 1.0#QNAN or 1.0#INF etc.).
+ // The second call allows to recognize representation formats starting
+ // with a 1.0 (such as 1.0#NAN 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: branches/release/boost/spirit/home/qi/numeric/uint.hpp
==============================================================================
--- branches/release/boost/spirit/home/qi/numeric/uint.hpp (original)
+++ branches/release/boost/spirit/home/qi/numeric/uint.hpp 2009-09-14 12:50:29 EDT (Mon, 14 Sep 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(
+ BOOST_SPIRIT_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: branches/release/boost/spirit/home/qi/operator.hpp
==============================================================================
--- branches/release/boost/spirit/home/qi/operator.hpp (original)
+++ branches/release/boost/spirit/home/qi/operator.hpp 2009-09-14 12:50:29 EDT (Mon, 14 Sep 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: branches/release/boost/spirit/home/qi/operator/alternative.hpp
==============================================================================
--- branches/release/boost/spirit/home/qi/operator/alternative.hpp (original)
+++ branches/release/boost/spirit/home/qi/operator/alternative.hpp 2009-09-14 12:50:29 EDT (Mon, 14 Sep 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: branches/release/boost/spirit/home/qi/operator/and_predicate.hpp
==============================================================================
--- branches/release/boost/spirit/home/qi/operator/and_predicate.hpp (original)
+++ branches/release/boost/spirit/home/qi/operator/and_predicate.hpp 2009-09-14 12:50:29 EDT (Mon, 14 Sep 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: branches/release/boost/spirit/home/qi/operator/difference.hpp
==============================================================================
--- branches/release/boost/spirit/home/qi/operator/difference.hpp (original)
+++ branches/release/boost/spirit/home/qi/operator/difference.hpp 2009-09-14 12:50:29 EDT (Mon, 14 Sep 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: branches/release/boost/spirit/home/qi/operator/expect.hpp
==============================================================================
--- branches/release/boost/spirit/home/qi/operator/expect.hpp (original)
+++ branches/release/boost/spirit/home/qi/operator/expect.hpp 2009-09-14 12:50:29 EDT (Mon, 14 Sep 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: branches/release/boost/spirit/home/qi/operator/kleene.hpp
==============================================================================
--- branches/release/boost/spirit/home/qi/operator/kleene.hpp (original)
+++ branches/release/boost/spirit/home/qi/operator/kleene.hpp 2009-09-14 12:50:29 EDT (Mon, 14 Sep 2009)
@@ -1,85 +1,93 @@
 /*=============================================================================
- 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
+ typedef typename traits::result_of::value<Attribute>::type
+ value_type;
+ value_type val = value_type();
+
+ // 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);
+ traits::clear(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: branches/release/boost/spirit/home/qi/operator/list.hpp
==============================================================================
--- branches/release/boost/spirit/home/qi/operator/list.hpp (original)
+++ branches/release/boost/spirit/home/qi/operator/list.hpp 2009-09-14 12:50:29 EDT (Mon, 14 Sep 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,72 @@
 #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
+ typedef typename traits::result_of::value<Attribute>::type
+ value_type;
+ value_type val = value_type();
 
- 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)
+ && (traits::clear(val), true)
+ && left.parse(i, last, context, skipper, val))
                 {
- container::push_back(attr, val);
+ traits::push_back(attr, val);
                     first = i;
                 }
                 return true;
@@ -71,27 +80,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: branches/release/boost/spirit/home/qi/operator/meta_grammar.hpp
==============================================================================
--- branches/release/boost/spirit/home/qi/operator/meta_grammar.hpp 2009-09-14 12:50:29 EDT (Mon, 14 Sep 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: branches/release/boost/spirit/home/qi/operator/not_predicate.hpp
==============================================================================
--- branches/release/boost/spirit/home/qi/operator/not_predicate.hpp (original)
+++ branches/release/boost/spirit/home/qi/operator/not_predicate.hpp 2009-09-14 12:50:29 EDT (Mon, 14 Sep 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: branches/release/boost/spirit/home/qi/operator/optional.hpp
==============================================================================
--- branches/release/boost/spirit/home/qi/operator/optional.hpp (original)
+++ branches/release/boost/spirit/home/qi/operator/optional.hpp 2009-09-14 12:50:29 EDT (Mon, 14 Sep 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: branches/release/boost/spirit/home/qi/operator/permutation.hpp
==============================================================================
--- branches/release/boost/spirit/home/qi/operator/permutation.hpp (original)
+++ branches/release/boost/spirit/home/qi/operator/permutation.hpp 2009-09-14 12:50:29 EDT (Mon, 14 Sep 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: branches/release/boost/spirit/home/qi/operator/plus.hpp
==============================================================================
--- branches/release/boost/spirit/home/qi/operator/plus.hpp (original)
+++ branches/release/boost/spirit/home/qi/operator/plus.hpp 2009-09-14 12:50:29 EDT (Mon, 14 Sep 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,91 @@
 #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
+ typedef typename traits::result_of::value<Attribute>::type
+ value_type;
+ value_type val = value_type();
+
+ 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);
+ traits::clear(val);
+ while (subject.parse(first, last, context, skipper, val))
                 {
- container::push_back(attr, val);
+ traits::push_back(attr, val);
+ traits::clear(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: branches/release/boost/spirit/home/qi/operator/sequence.hpp
==============================================================================
--- branches/release/boost/spirit/home/qi/operator/sequence.hpp (original)
+++ branches/release/boost/spirit/home/qi/operator/sequence.hpp 2009-09-14 12:50:29 EDT (Mon, 14 Sep 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: branches/release/boost/spirit/home/qi/operator/sequence_base.hpp
==============================================================================
--- branches/release/boost/spirit/home/qi/operator/sequence_base.hpp (original)
+++ branches/release/boost/spirit/home/qi/operator/sequence_base.hpp 2009-09-14 12:50:29 EDT (Mon, 14 Sep 2009)
@@ -1,89 +1,130 @@
 /*=============================================================================
- 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 or if the
+ // attribute of this sequence is a single element tuple
+ typedef typename attribute<Context, Iterator>::type_ attr_type_;
+ typename traits::wrap_if_not_tuple<Attribute
+ , typename traits::one_element_sequence<attr_type_>::type
+ >::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: branches/release/boost/spirit/home/qi/operator/sequential_or.hpp
==============================================================================
--- branches/release/boost/spirit/home/qi/operator/sequential_or.hpp (original)
+++ branches/release/boost/spirit/home/qi/operator/sequential_or.hpp 2009-09-14 12:50:29 EDT (Mon, 14 Sep 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: branches/release/boost/spirit/home/qi/parse.hpp
==============================================================================
--- branches/release/boost/spirit/home/qi/parse.hpp (original)
+++ branches/release/boost/spirit/home/qi/parse.hpp 2009-09-14 12:50:29 EDT (Mon, 14 Sep 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

Deleted: branches/release/boost/spirit/home/qi/skip.hpp
==============================================================================
--- branches/release/boost/spirit/home/qi/skip.hpp 2009-09-14 12:50:29 EDT (Mon, 14 Sep 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

Modified: branches/release/boost/spirit/home/qi/stream.hpp
==============================================================================
--- branches/release/boost/spirit/home/qi/stream.hpp (original)
+++ branches/release/boost/spirit/home/qi/stream.hpp 2009-09-14 12:50:29 EDT (Mon, 14 Sep 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: branches/release/boost/spirit/home/qi/stream/detail/iterator_istream.hpp
==============================================================================
--- branches/release/boost/spirit/home/qi/stream/detail/iterator_istream.hpp 2009-09-14 12:50:29 EDT (Mon, 14 Sep 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

Modified: branches/release/boost/spirit/home/qi/stream/detail/match_manip.hpp
==============================================================================
--- branches/release/boost/spirit/home/qi/stream/detail/match_manip.hpp (original)
+++ branches/release/boost/spirit/home/qi/stream/detail/match_manip.hpp 2009-09-14 12:50:29 EDT (Mon, 14 Sep 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), skipper(s), attr(a), post_skip(skip_flag::postskip) {}
+
+ match_manip(Expr const& xpr, Skipper const& s
+ , BOOST_SCOPED_ENUM(skip_flag) ps, Attribute& a)
+ : expr(xpr), skipper(s), attr(a), post_skip(ps) {}
 
         Expr const& expr;
+ Skipper const& skipper;
         Attribute& attr;
+ BOOST_SCOPED_ENUM(skip_flag) const post_skip;
+ };
+
+ 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), skipper(s), attr(a), post_skip(skip_flag::postskip) {}
+
+ match_manip(Expr const& xpr, Skipper const& s
+ , BOOST_SCOPED_ENUM(skip_flag) ps, Attribute& a)
+ : expr(xpr), skipper(s), attr(a), post_skip(ps) {}
+
+ Expr const& expr;
         Skipper const& skipper;
+ Attribute attr;
+ BOOST_SCOPED_ENUM(skip_flag) const post_skip;
     };
 
     ///////////////////////////////////////////////////////////////////////////
- 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: branches/release/boost/spirit/home/qi/stream/match_manip.hpp
==============================================================================
--- branches/release/boost/spirit/home/qi/stream/match_manip.hpp (original)
+++ branches/release/boost/spirit/home/qi/stream/match_manip.hpp 2009-09-14 12:50:29 EDT (Mon, 14 Sep 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);
         }

Deleted: branches/release/boost/spirit/home/qi/stream/meta_grammar.hpp
==============================================================================
--- branches/release/boost/spirit/home/qi/stream/meta_grammar.hpp 2009-09-14 12:50:29 EDT (Mon, 14 Sep 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: branches/release/boost/spirit/home/qi/stream/stream.hpp
==============================================================================
--- branches/release/boost/spirit/home/qi/stream/stream.hpp (original)
+++ branches/release/boost/spirit/home/qi/stream/stream.hpp 2009-09-14 12:50:29 EDT (Mon, 14 Sep 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: branches/release/boost/spirit/home/qi/string.hpp
==============================================================================
--- branches/release/boost/spirit/home/qi/string.hpp (original)
+++ branches/release/boost/spirit/home/qi/string.hpp 2009-09-14 12:50:29 EDT (Mon, 14 Sep 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: branches/release/boost/spirit/home/qi/string/detail/tst.hpp
==============================================================================
--- branches/release/boost/spirit/home/qi/string/detail/tst.hpp (original)
+++ branches/release/boost/spirit/home/qi/string/detail/tst.hpp 2009-09-14 12:50:29 EDT (Mon, 14 Sep 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>
@@ -101,7 +105,7 @@
         }
 
         template <typename Iterator, typename Alloc>
- static bool
+ static T*
         add(
             tst_node*& start
           , Iterator first
@@ -110,7 +114,7 @@
           , Alloc* alloc)
         {
             if (first == last)
- return false;
+ return 0;
 
             tst_node** pp = &start;
             while (true)
@@ -128,11 +132,8 @@
                     if (++first == last)
                     {
                         if (p->data == 0)
- {
                             p->data = alloc->new_data(val);
- return true;
- }
- return false;
+ return p->data;
                     }
                     pp = &p->eq;
                 }
@@ -207,198 +208,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: branches/release/boost/spirit/home/qi/string/meta_grammar.hpp
==============================================================================
--- branches/release/boost/spirit/home/qi/string/meta_grammar.hpp 2009-09-14 12:50:29 EDT (Mon, 14 Sep 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

Modified: branches/release/boost/spirit/home/qi/what.hpp
==============================================================================
--- branches/release/boost/spirit/home/qi/what.hpp (original)
+++ branches/release/boost/spirit/home/qi/what.hpp 2009-09-14 12:50:29 EDT (Mon, 14 Sep 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,25 @@
 #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>
+#if defined(_MSC_VER)
+#pragma once
+#endif
+
 #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: branches/release/boost/spirit/home/support.hpp
==============================================================================
--- branches/release/boost/spirit/home/support.hpp (original)
+++ branches/release/boost/spirit/home/support.hpp 2009-09-14 12:50:29 EDT (Mon, 14 Sep 2009)
@@ -1,28 +1,35 @@
 /*=============================================================================
- 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/assert_msg.hpp>
+#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
 

Modified: branches/release/boost/spirit/home/support/algorithm/any.hpp
==============================================================================
--- branches/release/boost/spirit/home/support/algorithm/any.hpp (original)
+++ branches/release/boost/spirit/home/support/algorithm/any.hpp 2009-09-14 12:50:29 EDT (Mon, 14 Sep 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: branches/release/boost/spirit/home/support/algorithm/any_if.hpp
==============================================================================
--- branches/release/boost/spirit/home/support/algorithm/any_if.hpp (original)
+++ branches/release/boost/spirit/home/support/algorithm/any_if.hpp 2009-09-14 12:50:29 EDT (Mon, 14 Sep 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,39 +20,29 @@
 #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
     {
         ///////////////////////////////////////////////////////////////////////
         template <typename Iterator, typename Pred>
- struct apply_predicate
- {
- typedef typename
- mpl::apply1<
- Pred,
- typename fusion::result_of::value_of<Iterator>::type
- >::type
- type;
- };
+ struct apply_predicate
+ : mpl::apply1<Pred, typename fusion::result_of::value_of<Iterator>::type>
+ {};
 
         ///////////////////////////////////////////////////////////////////////
         // if the predicate is true, attribute_next returns next(Iterator2),
@@ -177,7 +173,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 +186,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: branches/release/boost/spirit/home/support/algorithm/any_ns.hpp
==============================================================================
--- branches/release/boost/spirit/home/support/algorithm/any_ns.hpp (original)
+++ branches/release/boost/spirit/home/support/algorithm/any_ns.hpp 2009-09-14 12:50:29 EDT (Mon, 14 Sep 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: branches/release/boost/spirit/home/support/argument.hpp
==============================================================================
--- branches/release/boost/spirit/home/support/argument.hpp (original)
+++ branches/release/boost/spirit/home/support/argument.hpp 2009-09-14 12:50:29 EDT (Mon, 14 Sep 2009)
@@ -1,30 +1,35 @@
 /*=============================================================================
- 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
+
+#if defined(_MSC_VER)
+#pragma once
+#endif
 
 #include <boost/preprocessor/repetition/repeat_from_to.hpp>
 #include <boost/preprocessor/arithmetic/inc.hpp>
 #include <boost/spirit/home/phoenix/core/actor.hpp>
 #include <boost/spirit/home/phoenix/core/argument.hpp>
+#include <boost/spirit/home/support/assert_msg.hpp>
 #include <boost/fusion/include/at.hpp>
 #include <boost/fusion/include/size.hpp>
 #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
 {
@@ -38,7 +43,7 @@
             sequence_size;
 
             // report invalid argument not found (N is out of bounds)
- BOOST_MPL_ASSERT_MSG(
+ BOOST_SPIRIT_ASSERT_MSG(
                 (N < sequence_size::value),
                 index_is_out_of_bounds, ());
 
@@ -111,127 +116,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>();
-
- // '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<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>();
 
     // 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: branches/release/boost/spirit/home/support/as_variant.hpp
==============================================================================
--- branches/release/boost/spirit/home/support/as_variant.hpp 2009-09-14 12:50:29 EDT (Mon, 14 Sep 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: branches/release/boost/spirit/home/support/ascii.hpp
==============================================================================
--- branches/release/boost/spirit/home/support/ascii.hpp 2009-09-14 12:50:29 EDT (Mon, 14 Sep 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: branches/release/boost/spirit/home/support/attribute_of.hpp
==============================================================================
--- branches/release/boost/spirit/home/support/attribute_of.hpp 2009-09-14 12:50:29 EDT (Mon, 14 Sep 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: branches/release/boost/spirit/home/support/attribute_transform.hpp
==============================================================================
--- branches/release/boost/spirit/home/support/attribute_transform.hpp 2009-09-14 12:50:29 EDT (Mon, 14 Sep 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

Modified: branches/release/boost/spirit/home/support/char_class.hpp
==============================================================================
--- branches/release/boost/spirit/home/support/char_class.hpp (original)
+++ branches/release/boost/spirit/home/support/char_class.hpp 2009-09-14 12:50:29 EDT (Mon, 14 Sep 2009)
@@ -1,195 +1,236 @@
 /*=============================================================================
- 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>
+#include <boost/spirit/home/support/unused.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 {};
- }
-
- // 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;
- };
+ struct char_ {};
+ struct string {};
 
- // This identity tag types encode the character set.
- struct no_case_base_tag {};
- struct lower_case_base_tag {};
- struct upper_case_base_tag {};
+ ///////////////////////////////////////////////////////////////////////////
+ // 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 lowernum {};
+ struct uppernum {};
+ struct ucs4 {};
 
- 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::lowernum, Char ch)
+ {
+ return CharEncoding::islower(char_type(ch)) ||
+ CharEncoding::isdigit(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));
+ }
+
+ template <typename Char>
+ static bool
+ is(tag::uppernum, Char ch)
+ {
+ return CharEncoding::isupper(char_type(ch)) ||
+ CharEncoding::isdigit(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";
@@ -225,6 +266,11 @@
             return "lower";
         }
 
+ static char const* is(tag::lowernum)
+ {
+ return "lowernum";
+ }
+
         static char const* is(tag::print)
         {
             return "print";
@@ -249,6 +295,16 @@
         {
             return "upper";
         }
+
+ static char const* is(tag::uppernum)
+ {
+ return "uppernum";
+ }
+
+ static char const* is(tag::ucs4)
+ {
+ return "ucs4";
+ }
     };
 }}}
 

Deleted: branches/release/boost/spirit/home/support/component.hpp
==============================================================================
--- branches/release/boost/spirit/home/support/component.hpp 2009-09-14 12:50:29 EDT (Mon, 14 Sep 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

Deleted: branches/release/boost/spirit/home/support/detail/action_dispatch.hpp
==============================================================================
--- branches/release/boost/spirit/home/support/detail/action_dispatch.hpp 2009-09-14 12:50:29 EDT (Mon, 14 Sep 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

Deleted: branches/release/boost/spirit/home/support/detail/container.hpp
==============================================================================
--- branches/release/boost/spirit/home/support/detail/container.hpp 2009-09-14 12:50:29 EDT (Mon, 14 Sep 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

Modified: branches/release/boost/spirit/home/support/detail/hold_any.hpp
==============================================================================
--- branches/release/boost/spirit/home/support/detail/hold_any.hpp (original)
+++ branches/release/boost/spirit/home/support/detail/hold_any.hpp 2009-09-14 12:50:29 EDT (Mon, 14 Sep 2009)
@@ -1,18 +1,23 @@
-// 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
 
+#if defined(_MSC_VER)
+#pragma once
+#endif
+
 #include <boost/config.hpp>
 #include <boost/type_traits/remove_reference.hpp>
 #include <boost/type_traits/is_reference.hpp>
@@ -27,11 +32,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 +258,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 +276,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 +423,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: branches/release/boost/spirit/home/support/detail/integer/cover_operators.hpp
==============================================================================
--- branches/release/boost/spirit/home/support/detail/integer/cover_operators.hpp (original)
+++ branches/release/boost/spirit/home/support/detail/integer/cover_operators.hpp 2009-09-14 12:50:29 EDT (Mon, 14 Sep 2009)
@@ -1,16 +1,32 @@
 // 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>
+#if defined(_MSC_VER)
+#pragma once
+#endif
+
+# ifndef BOOST_MINIMAL_INTEGER_COVER_OPERATORS
+# include <boost/operators.hpp>
+# endif
+
 #include <iosfwd>
 
 namespace boost
@@ -21,13 +37,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 +55,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 +78,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 +107,7 @@
             x = i;
           return s;
         }
+# endif
     };
   } // namespace integer
 } // namespace boost

Modified: branches/release/boost/spirit/home/support/detail/integer/endian.hpp
==============================================================================
--- branches/release/boost/spirit/home/support/detail/integer/endian.hpp (original)
+++ branches/release/boost/spirit/home/support/detail/integer/endian.hpp 2009-09-14 12:50:29 EDT (Mon, 14 Sep 2009)
@@ -1,29 +1,49 @@
-// 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
+
+#if defined(_MSC_VER)
+#pragma once
+#endif
+
+#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 +51,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 +151,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 +170,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 +396,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: branches/release/boost/spirit/home/support/detail/lexer/char_traits.hpp
==============================================================================
--- branches/release/boost/spirit/home/support/detail/lexer/char_traits.hpp (original)
+++ branches/release/boost/spirit/home/support/detail/lexer/char_traits.hpp 2009-09-14 12:50:29 EDT (Mon, 14 Sep 2009)
@@ -1,5 +1,5 @@
 // char_traits.hpp
-// Copyright (c) 2007-2008 Ben Hanson (http://www.benhanson.net/)
+// Copyright (c) 2007-2009 Ben Hanson (http://www.benhanson.net/)
 //
 // Distributed under the Boost Software License, Version 1.0. (See accompanying
 // file licence_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt)

Modified: branches/release/boost/spirit/home/support/detail/lexer/consts.hpp
==============================================================================
--- branches/release/boost/spirit/home/support/detail/lexer/consts.hpp (original)
+++ branches/release/boost/spirit/home/support/detail/lexer/consts.hpp 2009-09-14 12:50:29 EDT (Mon, 14 Sep 2009)
@@ -1,5 +1,5 @@
 // consts.h
-// Copyright (c) 2007-2008 Ben Hanson (http://www.benhanson.net/)
+// Copyright (c) 2007-2009 Ben Hanson (http://www.benhanson.net/)
 //
 // Distributed under the Boost Software License, Version 1.0. (See accompanying
 // file licence_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt)
@@ -15,16 +15,18 @@
 namespace lexer
 {
     enum regex_flags {none = 0, icase = 1, dot_not_newline = 2};
- // 0 = end state, 1 = id, 2 = lex state, 3 = bol, 4 = eol,
- // 5 = dead_state_index
- enum {end_state_index, id_index, state_index, bol_index, eol_index,
- dead_state_index, dfa_offset};
+ // 0 = end state, 1 = id, 2 = unique_id, 3 = lex state, 4 = bol, 5 = eol,
+ // 6 = dead_state_index
+ enum {end_state_index, id_index, unique_id_index, state_index, bol_index,
+ eol_index, dead_state_index, dfa_offset};
 
- const std::size_t max_macro_len = 20;
+ const std::size_t max_macro_len = 30;
     const std::size_t num_chars = 256;
+ // If sizeof(wchar_t) == sizeof(size_t) then don't overflow to 0
+ // by adding one to comparison.
     const std::size_t num_wchar_ts =
         (boost::integer_traits<wchar_t>::const_max < 0x110000) ?
- boost::integer_traits<wchar_t>::const_max : 0x110000;
+ boost::integer_traits<wchar_t>::const_max + 1 : 0x110000;
     const std::size_t null_token = static_cast<std::size_t> (~0);
     const std::size_t bol_token = static_cast<std::size_t> (~1);
     const std::size_t eol_token = static_cast<std::size_t> (~2);

Modified: branches/release/boost/spirit/home/support/detail/lexer/containers/ptr_list.hpp
==============================================================================
--- branches/release/boost/spirit/home/support/detail/lexer/containers/ptr_list.hpp (original)
+++ branches/release/boost/spirit/home/support/detail/lexer/containers/ptr_list.hpp 2009-09-14 12:50:29 EDT (Mon, 14 Sep 2009)
@@ -1,5 +1,5 @@
 // ptr_list.hpp
-// Copyright (c) 2007-2008 Ben Hanson (http://www.benhanson.net/)
+// Copyright (c) 2007-2009 Ben Hanson (http://www.benhanson.net/)
 //
 // Distributed under the Boost Software License, Version 1.0. (See accompanying
 // file licence_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt)
@@ -61,8 +61,8 @@
 private:
     list _list;
 
- ptr_list (ptr_list const &); // No copy construction.
- ptr_list &operator = (ptr_list const &); // No assignment.
+ ptr_list (const ptr_list &); // No copy construction.
+ ptr_list &operator = (const ptr_list &); // No assignment.
 };
 }
 }

Modified: branches/release/boost/spirit/home/support/detail/lexer/containers/ptr_vector.hpp
==============================================================================
--- branches/release/boost/spirit/home/support/detail/lexer/containers/ptr_vector.hpp (original)
+++ branches/release/boost/spirit/home/support/detail/lexer/containers/ptr_vector.hpp 2009-09-14 12:50:29 EDT (Mon, 14 Sep 2009)
@@ -1,5 +1,5 @@
 // ptr_vector.hpp
-// Copyright (c) 2007-2008 Ben Hanson (http://www.benhanson.net/)
+// Copyright (c) 2007-2009 Ben Hanson (http://www.benhanson.net/)
 //
 // Distributed under the Boost Software License, Version 1.0. (See accompanying
 // file licence_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt)
@@ -98,8 +98,8 @@
 private:
     vector _vector;
 
- ptr_vector (ptr_vector const &); // No copy construction.
- ptr_vector &operator = (ptr_vector const &); // No assignment.
+ ptr_vector (const ptr_vector &); // No copy construction.
+ ptr_vector &operator = (const ptr_vector &); // No assignment.
 };
 }
 }

Modified: branches/release/boost/spirit/home/support/detail/lexer/conversion/char_state_machine.hpp
==============================================================================
--- branches/release/boost/spirit/home/support/detail/lexer/conversion/char_state_machine.hpp (original)
+++ branches/release/boost/spirit/home/support/detail/lexer/conversion/char_state_machine.hpp 2009-09-14 12:50:29 EDT (Mon, 14 Sep 2009)
@@ -1,5 +1,5 @@
 // char_state_machine.hpp
-// Copyright (c) 2007-2008 Ben Hanson (http://www.benhanson.net/)
+// Copyright (c) 2007-2009 Ben Hanson (http://www.benhanson.net/)
 //
 // Distributed under the Boost Software License, Version 1.0. (See accompanying
 // file licence_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt)
@@ -29,6 +29,7 @@
 
         bool _end_state;
         std::size_t _id;
+ std::size_t _unique_id;
         std::size_t _state;
         std::size_t _bol_index;
         std::size_t _eol_index;
@@ -37,6 +38,7 @@
         state () :
             _end_state (false),
             _id (0),
+ _unique_id (npos),
             _state (0),
             _bol_index (npos),
             _eol_index (npos)

Modified: branches/release/boost/spirit/home/support/detail/lexer/debug.hpp
==============================================================================
--- branches/release/boost/spirit/home/support/detail/lexer/debug.hpp (original)
+++ branches/release/boost/spirit/home/support/detail/lexer/debug.hpp 2009-09-14 12:50:29 EDT (Mon, 14 Sep 2009)
@@ -1,5 +1,5 @@
 // debug.hpp
-// Copyright (c) 2007-2008 Ben Hanson (http://www.benhanson.net/)
+// Copyright (c) 2007-2009 Ben Hanson (http://www.benhanson.net/)
 //
 // Distributed under the Boost Software License, Version 1.0. (See accompanying
 // file licence_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt)
@@ -8,6 +8,7 @@
 
 #include <map>
 #include <ostream>
+#include "rules.hpp"
 #include "size_t.hpp"
 #include "state_machine.hpp"
 #include "string_token.hpp"
@@ -112,7 +113,8 @@
         }
     }
 
- static void dump (const basic_state_machine<CharT> &state_machine_, ostream &stream_)
+ static void dump (const basic_state_machine<CharT> &state_machine_,
+ basic_rules<CharT> &rules_, ostream &stream_)
     {
         typename basic_state_machine<CharT>::iterator iter_ =
             state_machine_.begin ();
@@ -122,173 +124,222 @@
         for (std::size_t dfa_ = 0, dfas_ = state_machine_.size ();
             dfa_ < dfas_; ++dfa_)
         {
- const std::size_t states_ = iter_->states;
+ lexer_state (stream_);
+ stream_ << rules_.state (dfa_) << std::endl << std::endl;
 
- for (std::size_t i_ = 0; i_ < states_; ++i_)
+ dump_ex (iter_, stream_);
+ }
+ }
+
+ static void dump (const basic_state_machine<CharT> &state_machine_,
+ ostream &stream_)
+ {
+ typename basic_state_machine<CharT>::iterator iter_ =
+ state_machine_.begin ();
+ typename basic_state_machine<CharT>::iterator end_ =
+ state_machine_.end ();
+
+ for (std::size_t dfa_ = 0, dfas_ = state_machine_.size ();
+ dfa_ < dfas_; ++dfa_)
+ {
+ lexer_state (stream_);
+ stream_ << dfa_ << std::endl << std::endl;
+
+ dump_ex (iter_, stream_);
+ }
+ }
+
+protected:
+ typedef std::basic_stringstream<CharT> stringstream;
+
+ static void dump_ex (typename basic_state_machine<CharT>::iterator &iter_,
+ ostream &stream_)
+ {
+ const std::size_t states_ = iter_->states;
+
+ for (std::size_t i_ = 0; i_ < states_; ++i_)
+ {
+ state (stream_);
+ stream_ << i_ << std::endl;
+
+ if (iter_->end_state)
             {
- state (stream_);
- stream_ << i_ << std::endl;
+ end_state (stream_);
+ stream_ << iter_->id;
+ unique_id (stream_);
+ stream_ << iter_->unique_id;
+ dfa (stream_);
+ stream_ << iter_->goto_dfa;
+ stream_ << std::endl;
+ }
 
- if (iter_->end_state)
- {
- end_state (stream_);
- stream_ << iter_->id;
- dfa (stream_);
- stream_ << iter_->goto_dfa;
- stream_ << std::endl;
- }
+ if (iter_->bol_index != npos)
+ {
+ bol (stream_);
+ stream_ << iter_->bol_index << std::endl;
+ }
 
- if (iter_->bol_index != npos)
- {
- bol (stream_);
- stream_ << iter_->bol_index << std::endl;
- }
+ if (iter_->eol_index != npos)
+ {
+ eol (stream_);
+ stream_ << iter_->eol_index << std::endl;
+ }
 
- if (iter_->eol_index != npos)
- {
- eol (stream_);
- stream_ << iter_->eol_index << std::endl;
- }
+ const std::size_t transitions_ = iter_->transitions;
 
- const std::size_t transitions_ = iter_->transitions;
+ if (transitions_ == 0)
+ {
+ ++iter_;
+ }
 
- if (transitions_ == 0)
+ for (std::size_t t_ = 0; t_ < transitions_; ++t_)
+ {
+ std::size_t goto_state_ = iter_->goto_state;
+
+ if (iter_->token.any ())
                 {
- ++iter_;
+ any (stream_);
                 }
-
- for (std::size_t t_ = 0; t_ < transitions_; ++t_)
+ else
                 {
- std::size_t goto_state_ = iter_->goto_state;
+ open_bracket (stream_);
 
- if (iter_->token.any ())
+ if (iter_->token._negated)
                     {
- any (stream_);
+ negated (stream_);
                     }
- else
- {
- open_bracket (stream_);
 
- if (iter_->token._negated)
- {
- negated (stream_);
- }
-
- string charset_;
- CharT c_ = 0;
-
- escape_control_chars (iter_->token._charset,
- charset_);
- c_ = *charset_.c_str ();
-
- if (!iter_->token._negated &&
- (c_ == '^' || c_ == ']'))
- {
- stream_ << '\\';
- }
+ string charset_;
+ CharT c_ = 0;
 
- stream_ << charset_;
- close_bracket (stream_);
+ escape_control_chars (iter_->token._charset,
+ charset_);
+ c_ = *charset_.c_str ();
+
+ if (!iter_->token._negated &&
+ (c_ == '^' || c_ == ']'))
+ {
+ stream_ << '\\';
                     }
 
- stream_ << goto_state_ << std::endl;
- ++iter_;
+ stream_ << charset_;
+ close_bracket (stream_);
                 }
 
- stream_ << std::endl;
+ stream_ << goto_state_ << std::endl;
+ ++iter_;
             }
+
+ stream_ << std::endl;
         }
     }
 
-protected:
- typedef std::basic_stringstream<CharT> stringstream;
+ static void lexer_state (std::ostream &stream_)
+ {
+ stream_ << "Lexer state: ";
+ }
+
+ static void lexer_state (std::wostream &stream_)
+ {
+ stream_ << L"Lexer state: ";
+ }
 
- static void state (std::basic_ostream<char> &stream_)
+ static void state (std::ostream &stream_)
     {
         stream_ << "State: ";
     }
 
- static void state (std::basic_ostream<wchar_t> &stream_)
+ static void state (std::wostream &stream_)
     {
         stream_ << L"State: ";
     }
 
- static void bol (std::basic_ostream<char> &stream_)
+ static void bol (std::ostream &stream_)
     {
         stream_ << " BOL -> ";
     }
 
- static void bol (std::basic_ostream<wchar_t> &stream_)
+ static void bol (std::wostream &stream_)
     {
         stream_ << L" BOL -> ";
     }
 
- static void eol (std::basic_ostream<char> &stream_)
+ static void eol (std::ostream &stream_)
     {
         stream_ << " EOL -> ";
     }
 
- static void eol (std::basic_ostream<wchar_t> &stream_)
+ static void eol (std::wostream &stream_)
     {
         stream_ << L" EOL -> ";
     }
 
- static void end_state (std::basic_ostream<char> &stream_)
+ static void end_state (std::ostream &stream_)
     {
         stream_ << " END STATE, Id = ";
     }
 
- static void end_state (std::basic_ostream<wchar_t> &stream_)
+ static void end_state (std::wostream &stream_)
     {
         stream_ << L" END STATE, Id = ";
     }
 
- static void any (std::basic_ostream<char> &stream_)
+ static void unique_id (std::ostream &stream_)
+ {
+ stream_ << ", Unique Id = ";
+ }
+
+ static void unique_id (std::wostream &stream_)
+ {
+ stream_ << L", Unique Id = ";
+ }
+
+ static void any (std::ostream &stream_)
     {
         stream_ << " . -> ";
     }
 
- static void any (std::basic_ostream<wchar_t> &stream_)
+ static void any (std::wostream &stream_)
     {
         stream_ << L" . -> ";
     }
 
- static void open_bracket (std::basic_ostream<char> &stream_)
+ static void open_bracket (std::ostream &stream_)
     {
         stream_ << " [";
     }
 
- static void open_bracket (std::basic_ostream<wchar_t> &stream_)
+ static void open_bracket (std::wostream &stream_)
     {
         stream_ << L" [";
     }
 
- static void negated (std::basic_ostream<char> &stream_)
+ static void negated (std::ostream &stream_)
     {
         stream_ << "^";
     }
 
- static void negated (std::basic_ostream<wchar_t> &stream_)
+ static void negated (std::wostream &stream_)
     {
         stream_ << L"^";
     }
 
- static void close_bracket (std::basic_ostream<char> &stream_)
+ static void close_bracket (std::ostream &stream_)
     {
         stream_ << "] -> ";
     }
 
- static void close_bracket (std::basic_ostream<wchar_t> &stream_)
+ static void close_bracket (std::wostream &stream_)
     {
         stream_ << L"] -> ";
     }
 
- static void dfa (std::basic_ostream<char> &stream_)
+ static void dfa (std::ostream &stream_)
     {
         stream_ << ", dfa = ";
     }
 
- static void dfa (std::basic_ostream<wchar_t> &stream_)
+ static void dfa (std::wostream &stream_)
     {
         stream_ << L", dfa = ";
     }

Modified: branches/release/boost/spirit/home/support/detail/lexer/file_input.hpp
==============================================================================
--- branches/release/boost/spirit/home/support/detail/lexer/file_input.hpp (original)
+++ branches/release/boost/spirit/home/support/detail/lexer/file_input.hpp 2009-09-14 12:50:29 EDT (Mon, 14 Sep 2009)
@@ -1,5 +1,5 @@
 // file_input.hpp
-// Copyright (c) 2008 Ben Hanson (http://www.benhanson.net/)
+// Copyright (c) 2008-2009 Ben Hanson (http://www.benhanson.net/)
 //
 // Distributed under the Boost Software License, Version 1.0. (See accompanying
 // file licence_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt)
@@ -7,6 +7,8 @@
 #define BOOST_LEXER_FILE_INPUT
 
 #include "char_traits.hpp"
+// memcpy
+#include <cstring>
 #include <fstream>
 #include "size_t.hpp"
 #include "state_machine.hpp"
@@ -31,6 +33,7 @@
         struct data
         {
             std::size_t id;
+ std::size_t unique_id;
             const CharT *start;
             const CharT *end;
             std::size_t state;
@@ -38,14 +41,16 @@
             // Construct in end() state.
             data () :
                 id (0),
+ unique_id (npos),
                 state (npos)
             {
             }
 
             bool operator == (const data &rhs_) const
             {
- return id == rhs_.id && start == rhs_.start &&
- end == rhs_.end && state == rhs_.state;
+ return id == rhs_.id && unique_id == rhs_.unique_id &&
+ start == rhs_.start && end == rhs_.end &&
+ state == rhs_.state;
             }
         };
 
@@ -94,19 +99,22 @@
 
         void next_token ()
         {
+ const detail::internals &internals_ =
+ _input->_state_machine->data ();
+
             _data.start = _data.end;
 
- if (_input->_state_machine->_dfa->size () == 1)
+ if (internals_._dfa->size () == 1)
             {
- _data.id = _input->next (&_input->_state_machine->_lookup->
- front ()->front (), _input->_state_machine->_dfa_alphabet.
- front (), &_input->_state_machine->_dfa->front ()->
- front (), _data.start, _data.end);
+ _data.id = _input->next (&internals_._lookup->front ()->
+ front (), internals_._dfa_alphabet.front (),
+ &internals_._dfa->front ()->front (), _data.start,
+ _data.end, _data.unique_id);
             }
             else
             {
- _data.id = _input->next (*_input->_state_machine, _data.state,
- _data.start, _data.end);
+ _data.id = _input->next (internals_, _data.state, _data.start,
+ _data.end, _data.unique_id);
             }
 
             if (_data.id == 0)
@@ -152,6 +160,7 @@
         iterator iter_;
 
         iter_._input = this;
+ // Over-ride default of 0 (EOF)
         iter_._data.id = npos;
         iter_._data.start = 0;
         iter_._data.end = 0;
@@ -195,20 +204,22 @@
     const CharT *_end_token;
     CharT *_end_buffer;
 
- std::size_t next (const basic_state_machine<CharT> &state_machine_,
- std::size_t &start_state_, const CharT * &start_, const CharT * &end_)
+ std::size_t next (const detail::internals &internals_,
+ std::size_t &start_state_, const CharT * &start_, const CharT * &end_,
+ std::size_t &unique_id_)
     {
         _start_token = _end_token;
 
 again:
- const std::size_t * lookup_ = &state_machine_._lookup[start_state_]->
+ const std::size_t * lookup_ = &internals_._lookup[start_state_]->
             front ();
- std::size_t dfa_alphabet_ = state_machine_._dfa_alphabet[start_state_];
- const std::size_t *dfa_ = &state_machine_._dfa[start_state_]->front ();
+ std::size_t dfa_alphabet_ = internals_._dfa_alphabet[start_state_];
+ const std::size_t *dfa_ = &internals_._dfa[start_state_]->front ();
         const std::size_t *ptr_ = dfa_ + dfa_alphabet_;
         const CharT *curr_ = _start_token;
         bool end_state_ = *ptr_ != 0;
         std::size_t id_ = *(ptr_ + id_index);
+ std::size_t uid_ = *(ptr_ + unique_id_index);
         const CharT *end_token_ = curr_;
 
         for (;;)
@@ -237,7 +248,8 @@
             else
             {
                 const std::size_t state_ =
- ptr_[lookup_[static_cast<typename Traits::index_type> (*curr_++)]];
+ ptr_[lookup_[static_cast<typename Traits::index_type>
+ (*curr_++)]];
 
                 if (state_ == 0)
                 {
@@ -251,6 +263,7 @@
             {
                 end_state_ = true;
                 id_ = *(ptr_ + id_index);
+ uid_ = *(ptr_ + unique_id_index);
                 start_state_ = *(ptr_ + state_index);
                 end_token_ = curr_;
             }
@@ -259,6 +272,7 @@
         if (_start_token >= _end_buffer)
         {
             // No more tokens...
+ unique_id_ = npos;
             return 0;
         }
 
@@ -272,6 +286,7 @@
             {
                 end_state_ = true;
                 id_ = *(ptr_ + id_index);
+ uid_ = *(ptr_ + unique_id_index);
                 start_state_ = *(ptr_ + state_index);
                 end_token_ = curr_;
             }
@@ -289,23 +304,26 @@
             // No match causes char to be skipped
             _end_token = _start_token + 1;
             id_ = npos;
+ uid_ = npos;
         }
 
         start_ = _start_token;
         end_ = _end_token;
+ unique_id_ = uid_;
         return id_;
     }
 
     std::size_t next (const std::size_t * const lookup_,
         const std::size_t dfa_alphabet_, const std::size_t * const dfa_,
- const CharT * &start_, const CharT * &end_)
+ const CharT * &start_, const CharT * &end_, std::size_t &unique_id_)
     {
         _start_token = _end_token;
 
         const std::size_t *ptr_ = dfa_ + dfa_alphabet_;
         const CharT *curr_ = _start_token;
         bool end_state_ = *ptr_ != 0;
- std::size_t id_ = id_ = *(ptr_ + id_index);
+ std::size_t id_ = *(ptr_ + id_index);
+ std::size_t uid_ = *(ptr_ + unique_id_index);
         const CharT *end_token_ = curr_;
 
         for (;;)
@@ -334,7 +352,8 @@
             else
             {
                 const std::size_t state_ =
- ptr_[lookup_[static_cast<typename Traits::index_type> (*curr_++)]];
+ ptr_[lookup_[static_cast<typename Traits::index_type>
+ (*curr_++)]];
 
                 if (state_ == 0)
                 {
@@ -348,6 +367,7 @@
             {
                 end_state_ = true;
                 id_ = *(ptr_ + id_index);
+ uid_ = *(ptr_ + unique_id_index);
                 end_token_ = curr_;
             }
         }
@@ -355,6 +375,7 @@
         if (_start_token >= _end_buffer)
         {
             // No more tokens...
+ unique_id_ = npos;
             return 0;
         }
 
@@ -368,6 +389,7 @@
             {
                 end_state_ = true;
                 id_ = *(ptr_ + id_index);
+ uid_ = *(ptr_ + unique_id_index);
                 end_token_ = curr_;
             }
         }
@@ -382,10 +404,12 @@
             // No match causes char to be skipped
             _end_token = _start_token + 1;
             id_ = npos;
+ uid_ = npos;
         }
 
         start_ = _start_token;
         end_ = _end_token;
+ unique_id_ = uid_;
         return id_;
     }
 
@@ -414,8 +438,11 @@
             else if (_start_token < _end_buffer)
             {
                 const std::size_t len_ = _end_buffer - _start_token;
+ // Some systems have memcpy in namespace std.
+ using namespace std;
 
- ::memcpy (_start_buffer, _start_token - 1, (len_ + 1) * sizeof (CharT));
+ memcpy (_start_buffer, _start_token - 1, (len_ + 1) *
+ sizeof (CharT));
                 _stream->read (_start_buffer + len_ + 1,
                     static_cast<std::streamsize> (_buffer.size () - len_ - 1));
                 count_ = _stream->gcount ();

Modified: branches/release/boost/spirit/home/support/detail/lexer/generate_cpp.hpp
==============================================================================
--- branches/release/boost/spirit/home/support/detail/lexer/generate_cpp.hpp (original)
+++ branches/release/boost/spirit/home/support/detail/lexer/generate_cpp.hpp 2009-09-14 12:50:29 EDT (Mon, 14 Sep 2009)
@@ -1,5 +1,5 @@
 // generate_cpp_code.hpp
-// Copyright (c) 2008 Ben Hanson (http://www.benhanson.net/)
+// Copyright (c) 2008-2009 Ben Hanson (http://www.benhanson.net/)
 //
 // Distributed under the Boost Software License, Version 1.0. (See accompanying
 // file licence_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt)
@@ -8,6 +8,7 @@
 
 #include "char_traits.hpp"
 #include "consts.hpp"
+#include "internals.hpp"
 #include <iostream>
 #include <boost/detail/iterator.hpp>
 #include "runtime_error.hpp"
@@ -20,13 +21,17 @@
 namespace lexer
 {
 template<typename CharT>
-void generate_cpp (const basic_state_machine<CharT> &sm_, std::ostream &os_,
- const bool use_pointers_ = false, const bool skip_unknown_ = true,
- const bool optimise_parameters_ = true, const char *name_ = "next_token")
+void generate_cpp (const basic_state_machine<CharT> &state_machine_,
+ std::ostream &os_, const bool use_pointers_ = false,
+ const bool skip_unknown_ = true, const bool optimise_parameters_ = true,
+ const char *name_ = "next_token")
 {
+ const detail::internals &sm_ = state_machine_.data ();
+
     if (sm_._lookup->size () == 0)
     {
- throw runtime_error ("Cannot generate code from an empty state machine");
+ throw runtime_error ("Cannot generate code from an empty "
+ "state machine");
     }
 
     std::string upper_name_ (__DATE__);
@@ -251,14 +256,14 @@
     }
     else
     {
- const std::size_t *lookup_ = &sm_._lookup[0]->front ();
- const std::size_t *dfa_ = &sm_._dfa[0]->front ();
+ const std::size_t *lookup_ = &sm_._lookup->front ()->front ();
+ const std::size_t *dfa_ = &sm_._dfa->front ()->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_._lookup[0]->size () << "] = {";
+ os_ << sm_._lookup->front ()->size () << "] = {";
 
         for (; i_ < count_; ++i_)
         {
@@ -283,8 +288,8 @@
         os_ << " static const std::size_t dfa_alphabet_ = " <<
             sm_._dfa_alphabet.front () << ";\n";
         os_ << " static const std::size_t dfa_[" <<
- sm_._dfa[0]->size () << "] = {";
- count_ = sm_._dfa[0]->size () / 8;
+ sm_._dfa->front ()->size () << "] = {";
+ count_ = sm_._dfa->front ()->size () / 8;
 
         for (i_ = 0; i_ < count_; ++i_)
         {
@@ -303,7 +308,7 @@
             }
         }
 
- const std::size_t mod_ = sm_._dfa[0]->size () % 8;
+ const std::size_t mod_ = sm_._dfa->front ()->size () % 8;
 
         if (mod_)
         {
@@ -330,8 +335,10 @@
     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 * 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";
     }
 

Modified: branches/release/boost/spirit/home/support/detail/lexer/generator.hpp
==============================================================================
--- branches/release/boost/spirit/home/support/detail/lexer/generator.hpp (original)
+++ branches/release/boost/spirit/home/support/detail/lexer/generator.hpp 2009-09-14 12:50:29 EDT (Mon, 14 Sep 2009)
@@ -1,5 +1,5 @@
 // generator.hpp
-// Copyright (c) 2007-2008 Ben Hanson (http://www.benhanson.net/)
+// Copyright (c) 2007-2009 Ben Hanson (http://www.benhanson.net/)
 //
 // Distributed under the Boost Software License, Version 1.0. (See accompanying
 // file licence_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt)
@@ -26,30 +26,35 @@
 class basic_generator
 {
 public:
- typedef typename basic_state_machine<CharT>::size_t_vector size_t_vector;
+ typedef typename detail::internals::size_t_vector size_t_vector;
     typedef basic_rules<CharT> rules;
 
- static void build (const rules &rules_, basic_state_machine<CharT> &state_machine_)
+ static void build (const rules &rules_,
+ basic_state_machine<CharT> &state_machine_)
     {
         std::size_t index_ = 0;
         std::size_t size_ = rules_.statemap ().size ();
         node_ptr_vector node_ptr_vector_;
+ detail::internals &internals_ = const_cast<detail::internals &>
+ (state_machine_.data ());
+ bool seen_BOL_assertion_ = false;
+ bool seen_EOL_assertion_ = false;
 
         state_machine_.clear ();
 
         for (; index_ < size_; ++index_)
         {
- state_machine_._lookup->push_back (0);
- state_machine_._lookup->back () = new size_t_vector;
- state_machine_._dfa_alphabet.push_back (0);
- state_machine_._dfa->push_back (0);
- state_machine_._dfa->back () = new size_t_vector;
+ internals_._lookup->push_back (0);
+ internals_._lookup->back () = new size_t_vector;
+ internals_._dfa_alphabet.push_back (0);
+ internals_._dfa->push_back (0);
+ internals_._dfa->back () = new size_t_vector;
         }
 
- for (index_ = 0, size_ = state_machine_._lookup->size ();
+ for (index_ = 0, size_ = internals_._lookup->size ();
             index_ < size_; ++index_)
         {
- state_machine_._lookup[index_]->resize (sizeof (CharT) == 1 ?
+ internals_._lookup[index_]->resize (sizeof (CharT) == 1 ?
                 num_chars : num_wchar_ts, dead_state_index);
 
             if (!rules_.regexes ()[index_].empty ())
@@ -58,26 +63,41 @@
                 index_set_vector set_mapping_;
                 // syntax tree
                 detail::node *root_ = build_tree (rules_, index_,
- node_ptr_vector_, state_machine_._lookup[index_],
- set_mapping_, state_machine_._dfa_alphabet[index_],
- state_machine_._seen_BOL_assertion,
- state_machine_._seen_EOL_assertion);
+ node_ptr_vector_, internals_, set_mapping_);
 
                 build_dfa (root_, set_mapping_,
- state_machine_._dfa_alphabet[index_],
- *state_machine_._dfa[index_]);
+ internals_._dfa_alphabet[index_],
+ *internals_._dfa[index_]);
+
+ if (internals_._seen_BOL_assertion)
+ {
+ seen_BOL_assertion_ = true;
+ }
+
+ if (internals_._seen_EOL_assertion)
+ {
+ seen_EOL_assertion_ = true;
+ }
+
+ internals_._seen_BOL_assertion = false;
+ internals_._seen_EOL_assertion = false;
             }
         }
+
+ internals_._seen_BOL_assertion = seen_BOL_assertion_;
+ internals_._seen_EOL_assertion = seen_EOL_assertion_;
     }
 
     static void minimise (basic_state_machine<CharT> &state_machine_)
     {
- const std::size_t machines_ = state_machine_._dfa->size ();
+ detail::internals &internals_ = const_cast<detail::internals &>
+ (state_machine_.data ());
+ const std::size_t machines_ = internals_._dfa->size ();
 
         for (std::size_t i_ = 0; i_ < machines_; ++i_)
         {
- const std::size_t dfa_alphabet_ = state_machine_._dfa_alphabet[i_];
- size_t_vector *dfa_ = state_machine_._dfa[i_];
+ const std::size_t dfa_alphabet_ = internals_._dfa_alphabet[i_];
+ size_t_vector *dfa_ = internals_._dfa[i_];
 
             if (dfa_alphabet_ != 0)
             {
@@ -118,13 +138,14 @@
 
     static detail::node *build_tree (const rules &rules_,
         const std::size_t state_, node_ptr_vector &node_ptr_vector_,
- size_t_vector *lookup_, index_set_vector &set_mapping_,
- std::size_t &dfa_alphabet_, bool &seen_BOL_assertion_,
- bool &seen_EOL_assertion_)
+ detail::internals &internals_, index_set_vector &set_mapping_)
     {
+ size_t_vector *lookup_ = internals_._lookup[state_];
         const typename rules::string_deque_deque &regexes_ =
             rules_.regexes ();
         const typename rules::id_vector_deque &ids_ = rules_.ids ();
+ const typename rules::id_vector_deque &unique_ids_ =
+ rules_.unique_ids ();
         const typename rules::id_vector_deque &states_ = rules_.states ();
         typename rules::string_deque::const_iterator regex_iter_ =
             regexes_[state_].begin ();
@@ -132,6 +153,8 @@
             regexes_[state_].end ();
         typename rules::id_vector::const_iterator ids_iter_ =
             ids_[state_].begin ();
+ typename rules::id_vector::const_iterator unique_ids_iter_ =
+ unique_ids_[state_].begin ();
         typename rules::id_vector::const_iterator states_iter_ =
             states_[state_].begin ();
         const typename rules::string &regex_ = *regex_iter_;
@@ -144,15 +167,17 @@
 
         build_macros (token_map_, macrodeque_, macromap_,
             rules_.flags (), rules_.locale (), node_ptr_vector_,
- seen_BOL_assertion_, seen_EOL_assertion_);
+ internals_._seen_BOL_assertion, internals_._seen_EOL_assertion);
 
         detail::node *root_ = parser::parse (regex_.c_str (),
- regex_.c_str () + regex_.size (), *ids_iter_, *states_iter_,
- rules_.flags (), rules_.locale (), node_ptr_vector_, macromap_,
- token_map_, seen_BOL_assertion_, seen_EOL_assertion_);
+ regex_.c_str () + regex_.size (), *ids_iter_, *unique_ids_iter_,
+ *states_iter_, rules_.flags (), rules_.locale (), node_ptr_vector_,
+ macromap_, token_map_, internals_._seen_BOL_assertion,
+ internals_._seen_EOL_assertion);
 
         ++regex_iter_;
         ++ids_iter_;
+ ++unique_ids_iter_;
         ++states_iter_;
         tree_vector_.push_back (root_);
 
@@ -164,16 +189,18 @@
 
             root_ = parser::parse (regex_.c_str (),
                 regex_.c_str () + regex_.size (), *ids_iter_,
- *states_iter_, rules_.flags (), rules_.locale (),
- node_ptr_vector_, macromap_, token_map_,
- seen_BOL_assertion_, seen_EOL_assertion_);
+ *unique_ids_iter_, *states_iter_, rules_.flags (),
+ rules_.locale (), node_ptr_vector_, macromap_, token_map_,
+ internals_._seen_BOL_assertion,
+ internals_._seen_EOL_assertion);
             tree_vector_.push_back (root_);
             ++regex_iter_;
             ++ids_iter_;
+ ++unique_ids_iter_;
             ++states_iter_;
         }
 
- if (seen_BOL_assertion_)
+ if (internals_._seen_BOL_assertion)
         {
             // Fixup BOLs
             typename detail::node::node_vector::iterator iter_ =
@@ -237,7 +264,7 @@
             }
         }
 
- dfa_alphabet_ = token_list_->size () + dfa_offset;
+ internals_._dfa_alphabet[state_] = token_list_->size () + dfa_offset;
         return root_;
     }
 
@@ -254,11 +281,11 @@
             const typename rules::string &name_ = iter_->first;
             const typename rules::string &regex_ = iter_->second;
             detail::node *node_ = parser::parse (regex_.c_str (),
- regex_.c_str () + regex_.size (), 0, 0, flags_,
+ regex_.c_str () + regex_.size (), 0, 0, 0, flags_,
                 locale_, node_ptr_vector_, macromap_, token_map_,
                 seen_BOL_assertion_, seen_EOL_assertion_);
             macro_iter_pair map_iter_ = macromap_.
- insert (macro_pair (name_, 0));
+ insert (macro_pair (name_, (detail::node const*)0));
 
             map_iter_.first->second = node_;
         }
@@ -292,8 +319,9 @@
                 iter_ != end_; ++iter_)
             {
                 equivset *equivset_ = *iter_;
- const std::size_t transition_ = closure (&equivset_->_followpos,
- seen_sets_, seen_vectors_, hash_vector_, dfa_alphabet_, dfa_);
+ const std::size_t transition_ = closure
+ (&equivset_->_followpos, seen_sets_, seen_vectors_,
+ hash_vector_, dfa_alphabet_, dfa_);
 
                 if (transition_ != npos)
                 {
@@ -335,10 +363,12 @@
 
     static std::size_t closure (typename detail::node::node_vector *followpos_,
         node_set_vector &seen_sets_, node_vector_vector &seen_vectors_,
- size_t_vector &hash_vector_, const std::size_t size_, size_t_vector &dfa_)
+ size_t_vector &hash_vector_, const std::size_t size_,
+ size_t_vector &dfa_)
     {
         bool end_state_ = false;
         std::size_t id_ = 0;
+ std::size_t unique_id_ = npos;
         std::size_t state_ = 0;
         std::size_t hash_ = 0;
 
@@ -352,8 +382,8 @@
             followpos_->begin (), end_ = followpos_->end ();
             iter_ != end_; ++iter_)
         {
- closure_ex (*iter_, end_state_, id_, state_, set_ptr_.get (),
- vector_ptr_.get (), hash_);
+ closure_ex (*iter_, end_state_, id_, unique_id_, state_,
+ set_ptr_.get (), vector_ptr_.get (), hash_);
         }
 
         bool found_ = false;
@@ -390,6 +420,7 @@
             {
                 dfa_[old_size_] |= end_state;
                 dfa_[old_size_ + id_index] = id_;
+ dfa_[old_size_ + unique_id_index] = unique_id_;
                 dfa_[old_size_ + state_index] = state_;
             }
         }
@@ -398,8 +429,8 @@
     }
 
     static void closure_ex (detail::node *node_, bool &end_state_,
- std::size_t &id_, std::size_t &state_, node_set *set_ptr_,
- node_vector *vector_ptr_, std::size_t &hash_)
+ std::size_t &id_, std::size_t &unique_id_, std::size_t &state_,
+ node_set *set_ptr_, node_vector *vector_ptr_, std::size_t &hash_)
     {
         const bool temp_end_state_ = node_->end_state ();
 
@@ -409,6 +440,7 @@
             {
                 end_state_ = true;
                 id_ = node_->id ();
+ unique_id_ = node_->unique_id ();
                 state_ = node_->lexer_state ();
             }
         }
@@ -479,7 +511,7 @@
                     }
                     else
                     {
- iter_ = lhs_->insert (++iter_, 0);
+ iter_ = lhs_->insert (++iter_, (charset*)0);
                         *iter_ = overlap_.release ();
 
                         // VC++ 6 Hack:
@@ -621,7 +653,7 @@
                     }
                     else
                     {
- iter_ = lhs_->insert (++iter_, 0);
+ iter_ = lhs_->insert (++iter_, (equivset*)0);
                         *iter_ = overlap_.release ();
 
                         // VC++ 6 Hack:
@@ -702,12 +734,14 @@
         if (!found_)
         {
             node_ptr_vector_->push_back (0);
- node_ptr_vector_->back () = new detail::leaf_node (bol_token, true);
+ node_ptr_vector_->back () = new detail::leaf_node
+ (bol_token, true);
 
             detail::node *lhs_ = node_ptr_vector_->back ();
 
             node_ptr_vector_->push_back (0);
- node_ptr_vector_->back () = new detail::leaf_node (null_token, true);
+ node_ptr_vector_->back () = new detail::leaf_node
+ (null_token, true);
 
             detail::node *rhs_ = node_ptr_vector_->back ();
 
@@ -793,6 +827,7 @@
 
                 new_ptr_[end_state_index] = ptr_[end_state_index];
                 new_ptr_[id_index] = ptr_[id_index];
+ new_ptr_[unique_id_index] = ptr_[unique_id_index];
                 new_ptr_[state_index] = ptr_[state_index];
                 new_ptr_[bol_index] = lookup_ptr_[ptr_[bol_index]];
                 new_ptr_[eol_index] = lookup_ptr_[ptr_[eol_index]];

Modified: branches/release/boost/spirit/home/support/detail/lexer/input.hpp
==============================================================================
--- branches/release/boost/spirit/home/support/detail/lexer/input.hpp (original)
+++ branches/release/boost/spirit/home/support/detail/lexer/input.hpp 2009-09-14 12:50:29 EDT (Mon, 14 Sep 2009)
@@ -1,5 +1,5 @@
 // input.hpp
-// Copyright (c) 2008 Ben Hanson (http://www.benhanson.net/)
+// Copyright (c) 2008-2009 Ben Hanson (http://www.benhanson.net/)
 //
 // Distributed under the Boost Software License, Version 1.0. (See accompanying
 // file licence_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt)
@@ -7,7 +7,7 @@
 #define BOOST_LEXER_INPUT
 
 #include "char_traits.hpp"
-#include <iterator>
+#include <boost/detail/iterator.hpp>
 #include "size_t.hpp"
 #include "state_machine.hpp"
 
@@ -32,6 +32,7 @@
         struct data
         {
             std::size_t id;
+ std::size_t unique_id;
             FwdIter start;
             FwdIter end;
             bool bol;
@@ -40,6 +41,7 @@
             // Construct in end() state.
             data () :
                 id (0),
+ unique_id (npos),
                 bol (false),
                 state (npos)
             {
@@ -47,8 +49,9 @@
 
             bool operator == (const data &rhs_) const
             {
- return id == rhs_.id && start == rhs_.start &&
- end == rhs_.end && bol == rhs_.bol && state == rhs_.state;
+ return id == rhs_.id && unique_id == rhs_.unique_id &&
+ start == rhs_.start && end == rhs_.end &&
+ bol == rhs_.bol && state == rhs_.state;
             }
         };
 
@@ -102,39 +105,42 @@
 
         void next_token ()
         {
+ const detail::internals &internals_ =
+ _input->_state_machine->data ();
+
             _data.start = _data.end;
 
- if (_input->_state_machine->_dfa->size () == 1)
+ if (internals_._dfa->size () == 1)
             {
- if (_input->_state_machine->_seen_BOL_assertion ||
- _input->_state_machine->_seen_EOL_assertion)
+ if (internals_._seen_BOL_assertion ||
+ internals_._seen_EOL_assertion)
                 {
                     _data.id = next
- (&_input->_state_machine->_lookup->front ()->front (),
- _input->_state_machine->_dfa_alphabet.front (),
- &_input->_state_machine->_dfa->front ()->front (),
- _data.bol, _data.end, _input->_end);
+ (&internals_._lookup->front ()->front (),
+ internals_._dfa_alphabet.front (),
+ &internals_._dfa->front ()->front (),
+ _data.bol, _data.end, _input->_end, _data.unique_id);
                 }
                 else
                 {
- _data.id = next (&_input->_state_machine->_lookup->
- front ()->front (), _input->_state_machine->
- _dfa_alphabet.front (), &_input->_state_machine->
- _dfa->front ()->front (), _data.end, _input->_end);
+ _data.id = next (&internals_._lookup->front ()->front (),
+ internals_._dfa_alphabet.front (), &internals_.
+ _dfa->front ()->front (), _data.end, _input->_end,
+ _data.unique_id);
                 }
             }
             else
             {
- if (_input->_state_machine->_seen_BOL_assertion ||
- _input->_state_machine->_seen_EOL_assertion)
+ if (internals_._seen_BOL_assertion ||
+ internals_._seen_EOL_assertion)
                 {
- _data.id = next (*_input->_state_machine, _data.state,
- _data.bol, _data.end, _input->_end);
+ _data.id = next (internals_, _data.state,
+ _data.bol, _data.end, _input->_end, _data.unique_id);
                 }
                 else
                 {
- _data.id = next (*_input->_state_machine, _data.state,
- _data.end, _input->_end);
+ _data.id = next (internals_, _data.state,
+ _data.end, _input->_end, _data.unique_id);
                 }
             }
 
@@ -145,22 +151,27 @@
             }
         }
 
- std::size_t next (const basic_state_machine
- <typename Traits::char_type> &state_machine_,
+ std::size_t next (const detail::internals &internals_,
             std::size_t &start_state_, bool bol_,
- FwdIter &start_token_, const FwdIter &end_)
+ FwdIter &start_token_, const FwdIter &end_,
+ std::size_t &unique_id_)
         {
- if (start_token_ == end_) return 0;
+ if (start_token_ == end_)
+ {
+ unique_id_ = npos;
+ return 0;
+ }
 
         again:
- const std::size_t * lookup_ = &state_machine_._lookup[start_state_]->
+ const std::size_t * lookup_ = &internals_._lookup[start_state_]->
                 front ();
- std::size_t dfa_alphabet_ = state_machine_._dfa_alphabet[start_state_];
- const std::size_t *dfa_ = &state_machine_._dfa[start_state_]->front ();
+ std::size_t dfa_alphabet_ = internals_._dfa_alphabet[start_state_];
+ const std::size_t *dfa_ = &internals_._dfa[start_state_]->front ();
             const std::size_t *ptr_ = dfa_ + dfa_alphabet_;
             FwdIter curr_ = start_token_;
             bool end_state_ = *ptr_ != 0;
             std::size_t id_ = *(ptr_ + id_index);
+ std::size_t uid_ = *(ptr_ + unique_id_index);
             bool end_bol_ = bol_;
             FwdIter end_token_ = start_token_;
 
@@ -199,6 +210,7 @@
                 {
                     end_state_ = true;
                     id_ = *(ptr_ + id_index);
+ uid_ = *(ptr_ + unique_id_index);
                     start_state_ = *(ptr_ + state_index);
                     end_bol_ = bol_;
                     end_token_ = curr_;
@@ -215,6 +227,7 @@
                 {
                     end_state_ = true;
                     id_ = *(ptr_ + id_index);
+ uid_ = *(ptr_ + unique_id_index);
                     start_state_ = *(ptr_ + state_index);
                     end_bol_ = bol_;
                     end_token_ = curr_;
@@ -239,27 +252,33 @@
                 _data.bol = *start_token_ == '\n';
                 ++start_token_;
                 id_ = npos;
+ uid_ = npos;
             }
 
+ unique_id_ = uid_;
             return id_;
         }
 
- std::size_t next (const basic_state_machine
- <typename Traits::char_type> &state_machine_,
+ std::size_t next (const detail::internals &internals_,
             std::size_t &start_state_, FwdIter &start_token_,
- FwdIter const &end_)
+ FwdIter const &end_, std::size_t &unique_id_)
         {
- if (start_token_ == end_) return 0;
+ if (start_token_ == end_)
+ {
+ unique_id_ = npos;
+ return 0;
+ }
 
         again:
- const std::size_t * lookup_ = &state_machine_._lookup[start_state_]->
+ const std::size_t * lookup_ = &internals_._lookup[start_state_]->
                 front ();
- std::size_t dfa_alphabet_ = state_machine_._dfa_alphabet[start_state_];
- const std::size_t *dfa_ = &state_machine_._dfa[start_state_]->front ();
+ std::size_t dfa_alphabet_ = internals_._dfa_alphabet[start_state_];
+ const std::size_t *dfa_ = &internals_._dfa[start_state_]->front ();
             const std::size_t *ptr_ = dfa_ + dfa_alphabet_;
             FwdIter curr_ = start_token_;
             bool end_state_ = *ptr_ != 0;
             std::size_t id_ = *(ptr_ + id_index);
+ std::size_t uid_ = *(ptr_ + unique_id_index);
             FwdIter end_token_ = start_token_;
 
             while (curr_ != end_)
@@ -278,6 +297,7 @@
                 {
                     end_state_ = true;
                     id_ = *(ptr_ + id_index);
+ uid_ = *(ptr_ + unique_id_index);
                     start_state_ = *(ptr_ + state_index);
                     end_token_ = curr_;
                 }
@@ -295,21 +315,29 @@
                 // No match causes char to be skipped
                 ++start_token_;
                 id_ = npos;
+ uid_ = npos;
             }
 
+ unique_id_ = uid_;
             return id_;
         }
 
         std::size_t next (const std::size_t * const lookup_,
             const std::size_t dfa_alphabet_, const std::size_t * const dfa_,
- bool bol_, FwdIter &start_token_, FwdIter const &end_)
+ bool bol_, FwdIter &start_token_, FwdIter const &end_,
+ std::size_t &unique_id_)
         {
- if (start_token_ == end_) return 0;
+ if (start_token_ == end_)
+ {
+ unique_id_ = npos;
+ return 0;
+ }
 
             const std::size_t *ptr_ = dfa_ + dfa_alphabet_;
             FwdIter curr_ = start_token_;
             bool end_state_ = *ptr_ != 0;
             std::size_t id_ = *(ptr_ + id_index);
+ std::size_t uid_ = *(ptr_ + unique_id_index);
             bool end_bol_ = bol_;
             FwdIter end_token_ = start_token_;
 
@@ -348,6 +376,7 @@
                 {
                     end_state_ = true;
                     id_ = *(ptr_ + id_index);
+ uid_ = *(ptr_ + unique_id_index);
                     end_bol_ = bol_;
                     end_token_ = curr_;
                 }
@@ -363,6 +392,7 @@
                 {
                     end_state_ = true;
                     id_ = *(ptr_ + id_index);
+ uid_ = *(ptr_ + unique_id_index);
                     end_bol_ = bol_;
                     end_token_ = curr_;
                 }
@@ -380,21 +410,29 @@
                 _data.bol = *start_token_ == '\n';
                 ++start_token_;
                 id_ = npos;
+ uid_ = npos;
             }
 
+ unique_id_ = uid_;
             return id_;
         }
 
         std::size_t next (const std::size_t * const lookup_,
             const std::size_t dfa_alphabet_, const std::size_t * const dfa_,
- FwdIter &start_token_, FwdIter const &end_)
+ FwdIter &start_token_, FwdIter const &end_,
+ std::size_t &unique_id_)
         {
- if (start_token_ == end_) return 0;
+ if (start_token_ == end_)
+ {
+ unique_id_ = npos;
+ return 0;
+ }
 
             const std::size_t *ptr_ = dfa_ + dfa_alphabet_;
             FwdIter curr_ = start_token_;
             bool end_state_ = *ptr_ != 0;
             std::size_t id_ = *(ptr_ + id_index);
+ std::size_t uid_ = *(ptr_ + unique_id_index);
             FwdIter end_token_ = start_token_;
 
             while (curr_ != end_)
@@ -413,6 +451,7 @@
                 {
                     end_state_ = true;
                     id_ = *(ptr_ + id_index);
+ uid_ = *(ptr_ + unique_id_index);
                     end_token_ = curr_;
                 }
             }
@@ -427,8 +466,10 @@
                 // No match causes char to be skipped
                 ++start_token_;
                 id_ = npos;
+ uid_ = npos;
             }
 
+ unique_id_ = uid_;
             return id_;
         }
     };
@@ -453,10 +494,11 @@
         iterator iter_;
 
         iter_._input = this;
+ // Over-ride default of 0 (EOI)
         iter_._data.id = npos;
         iter_._data.start = _begin;
         iter_._data.end = _begin;
- iter_._data.bol = _state_machine->_seen_BOL_assertion;
+ iter_._data.bol = _state_machine->data ()._seen_BOL_assertion;
         iter_._data.state = 0;
         ++iter_;
         return iter_;
@@ -479,7 +521,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;
 }

Modified: branches/release/boost/spirit/home/support/detail/lexer/parser/parser.hpp
==============================================================================
--- branches/release/boost/spirit/home/support/detail/lexer/parser/parser.hpp (original)
+++ branches/release/boost/spirit/home/support/detail/lexer/parser/parser.hpp 2009-09-14 12:50:29 EDT (Mon, 14 Sep 2009)
@@ -1,5 +1,5 @@
 // parser.hpp
-// Copyright (c) 2007-2008 Ben Hanson (http://www.benhanson.net/)
+// Copyright (c) 2007-2009 Ben Hanson (http://www.benhanson.net/)
 //
 // Distributed under the Boost Software License, Version 1.0. (See accompanying
 // file licence_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt)
@@ -51,10 +51,10 @@
 <DUPLICATE> -> '?' | '*' | '+' | '{n[,[m]]}'
 */
     static node *parse (const CharT *start_, const CharT * const end_,
- const std::size_t id_, const std::size_t dfa_state_,
- const regex_flags flags_, const std::locale &locale_,
- node_ptr_vector &node_ptr_vector_, const macro_map &macromap_,
- typename tokeniser::token_map &map_,
+ const std::size_t id_, const std::size_t unique_id_,
+ const std::size_t dfa_state_, const regex_flags flags_,
+ const std::locale &locale_, node_ptr_vector &node_ptr_vector_,
+ const macro_map &macromap_, typename tokeniser::token_map &map_,
         bool &seen_BOL_assertion_, bool &seen_EOL_assertion_)
     {
         node *root_ = 0;
@@ -116,11 +116,12 @@
         {
             node_ptr_vector_->push_back (0);
 
- node *rhs_node_ = new end_node (id_, dfa_state_);
+ node *rhs_node_ = new end_node (id_, unique_id_, dfa_state_);
 
             node_ptr_vector_->back () = rhs_node_;
             node_ptr_vector_->push_back (0);
- node_ptr_vector_->back () = new sequence_node (lhs_node_, rhs_node_);
+ node_ptr_vector_->back () = new sequence_node
+ (lhs_node_, rhs_node_);
             root_ = node_ptr_vector_->back ();
         }
 
@@ -252,7 +253,7 @@
         node_ptr_vector &node_ptr_vector_, tree_node_stack &tree_node_stack_)
     {
         assert (handle_.top ()._type == token::SUB &&
- handle_.size () == 1 || handle_.size () == 2);
+ (handle_.size () == 1 || handle_.size () == 2));
 
         if (handle_.size () == 1)
         {
@@ -378,7 +379,7 @@
         // perform ?
         node *lhs_ = tree_node_stack_.top ();
         // You don't know if lhs_ is a leaf_node, so get firstpos.
- node::node_vector &firstpos_ = lhs_->firstpos();
+ node::node_vector &firstpos_ = lhs_->firstpos ();
 
         for (node::node_vector::iterator iter_ = firstpos_.begin (),
             end_ = firstpos_.end (); iter_ != end_; ++iter_)
@@ -425,6 +426,7 @@
         tree_node_stack_.top () = node_ptr_vector_->back ();
     }
 
+ // This is one of the most mind bending routines in this code...
     static void repeatn (const bool greedy_, const token &token_,
         node_ptr_vector &node_ptr_vector_, tree_node_stack &tree_node_stack_)
     {
@@ -449,9 +451,7 @@
 
             for (std::size_t i_ = 2; i_ < top_; ++i_)
             {
- node *temp_ = prev_->copy (node_ptr_vector_);
-
- curr_ = temp_;
+ curr_ = prev_->copy (node_ptr_vector_);
                 tree_node_stack_.push (0);
                 tree_node_stack_.top () = prev_;
                 sequence (node_ptr_vector_, tree_node_stack_);
@@ -462,9 +462,7 @@
             {
                 if (token_._min > 1)
                 {
- node *temp_ = prev_->copy (node_ptr_vector_);
-
- curr_ = temp_;
+ curr_ = prev_->copy (node_ptr_vector_);
                     tree_node_stack_.push (0);
                     tree_node_stack_.top () = prev_;
                     sequence (node_ptr_vector_, tree_node_stack_);
@@ -476,19 +474,14 @@
                     tree_node_stack_.push (0);
                     tree_node_stack_.top () = prev_;
                     optional (greedy_, node_ptr_vector_, tree_node_stack_);
-
- node *temp_ = tree_node_stack_.top ();
-
+ prev_ = tree_node_stack_.top ();
                     tree_node_stack_.pop ();
- prev_ = temp_;
 
                     const std::size_t count_ = token_._max - token_._min;
 
                     for (std::size_t i_ = 1; i_ < count_; ++i_)
                     {
- node *temp_ = prev_->copy (node_ptr_vector_);
-
- curr_ = temp_;
+ curr_ = prev_->copy (node_ptr_vector_);
                         tree_node_stack_.push (0);
                         tree_node_stack_.top () = prev_;
                         sequence (node_ptr_vector_, tree_node_stack_);
@@ -500,10 +493,7 @@
                     tree_node_stack_.push (0);
                     tree_node_stack_.top () = prev_;
                     zero_or_more (greedy_, node_ptr_vector_, tree_node_stack_);
-
- node *temp_ = tree_node_stack_.top ();
-
- prev_ = temp_;
+ prev_ = tree_node_stack_.top ();
                     tree_node_stack_.pop ();
                 }
             }

Modified: branches/release/boost/spirit/home/support/detail/lexer/parser/tokeniser/num_token.hpp
==============================================================================
--- branches/release/boost/spirit/home/support/detail/lexer/parser/tokeniser/num_token.hpp (original)
+++ branches/release/boost/spirit/home/support/detail/lexer/parser/tokeniser/num_token.hpp 2009-09-14 12:50:29 EDT (Mon, 14 Sep 2009)
@@ -1,5 +1,5 @@
 // num_token.hpp
-// Copyright (c) 2007-2008 Ben Hanson (http://www.benhanson.net/)
+// Copyright (c) 2007-2009 Ben Hanson (http://www.benhanson.net/)
 //
 // Distributed under the Boost Software License, Version 1.0. (See accompanying
 // file licence_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt)

Modified: branches/release/boost/spirit/home/support/detail/lexer/parser/tokeniser/re_tokeniser.hpp
==============================================================================
--- branches/release/boost/spirit/home/support/detail/lexer/parser/tokeniser/re_tokeniser.hpp (original)
+++ branches/release/boost/spirit/home/support/detail/lexer/parser/tokeniser/re_tokeniser.hpp 2009-09-14 12:50:29 EDT (Mon, 14 Sep 2009)
@@ -1,5 +1,5 @@
 // tokeniser.hpp
-// Copyright (c) 2007-2008 Ben Hanson (http://www.benhanson.net/)
+// Copyright (c) 2007-2009 Ben Hanson (http://www.benhanson.net/)
 //
 // Distributed under the Boost Software License, Version 1.0. (See accompanying
 // file licence_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt)
@@ -152,6 +152,7 @@
                     if (state_._curr - 1 == state_._start)
                     {
                         token_.set (num_token::CHARSET, bol_token);
+ state_._seen_BOL_assertion = true;
                     }
                     else
                     {
@@ -159,12 +160,12 @@
                             map_, token_);
                     }
 
- state_._seen_BOL_assertion = true;
                     break;
                 case '$':
                     if (state_._curr == state_._end)
                     {
                         token_.set (num_token::CHARSET, eol_token);
+ state_._seen_EOL_assertion = true;
                     }
                     else
                     {
@@ -172,7 +173,6 @@
                             map_, token_);
                     }
 
- state_._seen_EOL_assertion = true;
                     break;
                 case '.':
                 {
@@ -191,6 +191,9 @@
                     charset (state_, map_, token_);
                     break;
                 }
+ case '/':
+ throw runtime_error("Lookahead ('/') is not supported yet.");
+ break;
                 default:
                     if ((state_._flags & icase) &&
                         (std::isupper (ch_, state_._locale) ||
@@ -270,7 +273,7 @@
                 {
                     std::ostringstream ss_;
 
- ss_ << "Unknown option at " <<
+ ss_ << "Unknown option at index " <<
                         state_.index () - 1 << '.';
                     throw runtime_error (ss_.str ().c_str ());
                 }
@@ -525,8 +528,8 @@
                 throw runtime_error ("Unexpected end of regex "
                     "(missing '}').");
             }
- } while (ch_ == '_' || ch_ == '-' || ch_ >= 'A' && ch_ <= 'Z' ||
- ch_ >= 'a' && ch_ <= 'z' || ch_ >= '0' && ch_ <= '9');
+ } while (ch_ == '_' || ch_ == '-' || (ch_ >= 'A' && ch_ <= 'Z') ||
+ (ch_ >= 'a' && ch_ <= 'z') || (ch_ >= '0' && ch_ <= '9'));
 
         if (ch_ != '}')
         {

Modified: branches/release/boost/spirit/home/support/detail/lexer/parser/tokeniser/re_tokeniser_helper.hpp
==============================================================================
--- branches/release/boost/spirit/home/support/detail/lexer/parser/tokeniser/re_tokeniser_helper.hpp (original)
+++ branches/release/boost/spirit/home/support/detail/lexer/parser/tokeniser/re_tokeniser_helper.hpp 2009-09-14 12:50:29 EDT (Mon, 14 Sep 2009)
@@ -1,5 +1,5 @@
 // tokeniser_helper.hpp
-// Copyright (c) 2007-2008 Ben Hanson (http://www.benhanson.net/)
+// Copyright (c) 2007-2009 Ben Hanson (http://www.benhanson.net/)
 //
 // Distributed under the Boost Software License, Version 1.0. (See accompanying
 // file licence_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt)
@@ -103,7 +103,7 @@
                         std::ostringstream ss_;
 
                         ss_ << "Mismatch in charset negation preceding "
- "index " << state_.index () - 1 << '.';
+ "index " << state_.index () << '.';
                         throw runtime_error (ss_.str ().c_str ());
                     }
 
@@ -161,6 +161,70 @@
         }
     }
 
+ static CharT chr (state &state_)
+ {
+ CharT ch_ = 0;
+
+ // eos_ has already been checked for.
+ switch (*state_._curr)
+ {
+ case '0':
+ case '1':
+ case '2':
+ case '3':
+ case '4':
+ case '5':
+ case '6':
+ case '7':
+ ch_ = decode_octal (state_);
+ break;
+ case 'a':
+ ch_ = '\a';
+ state_.increment ();
+ break;
+ case 'b':
+ ch_ = '\b';
+ state_.increment ();
+ break;
+ case 'c':
+ ch_ = decode_control_char (state_);
+ break;
+ case 'e':
+ ch_ = 27; // '\e' not recognised by compiler
+ state_.increment ();
+ break;
+ case 'f':
+ ch_ = '\f';
+ state_.increment ();
+ break;
+ case 'n':
+ ch_ = '\n';
+ state_.increment ();
+ break;
+ case 'r':
+ ch_ = '\r';
+ state_.increment ();
+ break;
+ case 't':
+ ch_ = '\t';
+ state_.increment ();
+ break;
+ case 'v':
+ ch_ = '\v';
+ state_.increment ();
+ break;
+ case 'x':
+ ch_ = decode_hex (state_);
+ break;
+ default:
+ ch_ = *state_._curr;
+ state_.increment ();
+ break;
+ }
+
+ return ch_;
+ }
+
 private:
     static const char *charset_shortcut (const char ch_,
         std::size_t &str_len_)
@@ -246,70 +310,6 @@
         return str_;
     }
 
- static CharT chr (state &state_)
- {
- CharT ch_ = 0;
-
- // eos_ has already been checked for.
- switch (*state_._curr)
- {
- case '0':
- case '1':
- case '2':
- case '3':
- case '4':
- case '5':
- case '6':
- case '7':
- ch_ = decode_octal (state_);
- break;
- case 'a':
- ch_ = '\a';
- state_.increment ();
- break;
- case 'b':
- ch_ = '\b';
- state_.increment ();
- break;
- case 'c':
- ch_ = decode_control_char (state_);
- break;
- case 'e':
- ch_ = 27; // '\e' not recognised by compiler
- state_.increment ();
- break;
- case 'f':
- ch_ = '\f';
- state_.increment ();
- break;
- case 'n':
- ch_ = '\n';
- state_.increment ();
- break;
- case 'r':
- ch_ = '\r';
- state_.increment ();
- break;
- case 't':
- ch_ = '\t';
- state_.increment ();
- break;
- case 'v':
- ch_ = '\v';
- state_.increment ();
- break;
- case 'x':
- ch_ = decode_hex (state_);
- break;
- default:
- ch_ = *state_._curr;
- state_.increment ();
- break;
- }
-
- return ch_;
- }
-
     static CharT decode_octal (state &state_)
     {
         std::size_t accumulator_ = 0;

Modified: branches/release/boost/spirit/home/support/detail/lexer/parser/tokeniser/re_tokeniser_state.hpp
==============================================================================
--- branches/release/boost/spirit/home/support/detail/lexer/parser/tokeniser/re_tokeniser_state.hpp (original)
+++ branches/release/boost/spirit/home/support/detail/lexer/parser/tokeniser/re_tokeniser_state.hpp 2009-09-14 12:50:29 EDT (Mon, 14 Sep 2009)
@@ -1,5 +1,5 @@
 // tokeniser_state.hpp
-// Copyright (c) 2007-2008 Ben Hanson (http://www.benhanson.net/)
+// Copyright (c) 2007-2009 Ben Hanson (http://www.benhanson.net/)
 //
 // Distributed under the Boost Software License, Version 1.0. (See accompanying
 // file licence_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt)
@@ -46,7 +46,8 @@
     }
 
     // prevent VC++ 7.1 warning:
- const basic_re_tokeniser_state &operator = (const basic_re_tokeniser_state &rhs_)
+ const basic_re_tokeniser_state &operator =
+ (const basic_re_tokeniser_state &rhs_)
     {
         _start = rhs_._start;
         _end = rhs_._end;

Modified: branches/release/boost/spirit/home/support/detail/lexer/parser/tree/end_node.hpp
==============================================================================
--- branches/release/boost/spirit/home/support/detail/lexer/parser/tree/end_node.hpp (original)
+++ branches/release/boost/spirit/home/support/detail/lexer/parser/tree/end_node.hpp 2009-09-14 12:50:29 EDT (Mon, 14 Sep 2009)
@@ -1,5 +1,5 @@
 // end_node.hpp
-// Copyright (c) 2007-2008 Ben Hanson (http://www.benhanson.net/)
+// Copyright (c) 2007-2009 Ben Hanson (http://www.benhanson.net/)
 //
 // Distributed under the Boost Software License, Version 1.0. (See accompanying
 // file licence_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt)
@@ -18,9 +18,11 @@
 class end_node : public node
 {
 public:
- end_node (const std::size_t id_, const std::size_t lexer_state_) :
+ end_node (const std::size_t id_, const std::size_t unique_id_,
+ const std::size_t lexer_state_) :
         node (false),
         _id (id_),
+ _unique_id (unique_id_),
         _lexer_state (lexer_state_)
     {
         node::_firstpos.push_back (this);
@@ -58,6 +60,11 @@
         return _id;
     }
 
+ virtual std::size_t unique_id () const
+ {
+ return _unique_id;
+ }
+
     virtual std::size_t lexer_state () const
     {
         return _lexer_state;
@@ -65,6 +72,7 @@
 
 private:
     std::size_t _id;
+ std::size_t _unique_id;
     std::size_t _lexer_state;
     node_vector _followpos;
 

Modified: branches/release/boost/spirit/home/support/detail/lexer/parser/tree/iteration_node.hpp
==============================================================================
--- branches/release/boost/spirit/home/support/detail/lexer/parser/tree/iteration_node.hpp (original)
+++ branches/release/boost/spirit/home/support/detail/lexer/parser/tree/iteration_node.hpp 2009-09-14 12:50:29 EDT (Mon, 14 Sep 2009)
@@ -1,5 +1,5 @@
 // iteration_node.hpp
-// Copyright (c) 2007-2008 Ben Hanson (http://www.benhanson.net/)
+// Copyright (c) 2007-2009 Ben Hanson (http://www.benhanson.net/)
 //
 // Distributed under the Boost Software License, Version 1.0. (See accompanying
 // file licence_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt)

Modified: branches/release/boost/spirit/home/support/detail/lexer/parser/tree/leaf_node.hpp
==============================================================================
--- branches/release/boost/spirit/home/support/detail/lexer/parser/tree/leaf_node.hpp (original)
+++ branches/release/boost/spirit/home/support/detail/lexer/parser/tree/leaf_node.hpp 2009-09-14 12:50:29 EDT (Mon, 14 Sep 2009)
@@ -1,5 +1,5 @@
 // leaf_node.hpp
-// Copyright (c) 2007-2008 Ben Hanson (http://www.benhanson.net/)
+// Copyright (c) 2007-2009 Ben Hanson (http://www.benhanson.net/)
 //
 // Distributed under the Boost Software License, Version 1.0. (See accompanying
 // file licence_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt)

Modified: branches/release/boost/spirit/home/support/detail/lexer/parser/tree/node.hpp
==============================================================================
--- branches/release/boost/spirit/home/support/detail/lexer/parser/tree/node.hpp (original)
+++ branches/release/boost/spirit/home/support/detail/lexer/parser/tree/node.hpp 2009-09-14 12:50:29 EDT (Mon, 14 Sep 2009)
@@ -1,5 +1,5 @@
 // node.hpp
-// Copyright (c) 2007-2008 Ben Hanson (http://www.benhanson.net/)
+// Copyright (c) 2007-2009 Ben Hanson (http://www.benhanson.net/)
 //
 // Distributed under the Boost Software License, Version 1.0. (See accompanying
 // file licence_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt)
@@ -89,7 +89,8 @@
             {
                 const node *top_ = node_stack_.top ();
 
- top_->copy_node (node_ptr_vector_, new_node_stack_, perform_op_stack_, down_);
+ top_->copy_node (node_ptr_vector_, new_node_stack_,
+ perform_op_stack_, down_);
 
                 if (!down_) node_stack_.pop ();
             }
@@ -132,6 +133,11 @@
         throw runtime_error ("Internal error node::id()");
     }
 
+ virtual std::size_t unique_id () const
+ {
+ throw runtime_error ("Internal error node::unique_id()");
+ }
+
     virtual std::size_t lexer_state () const
     {
         throw runtime_error ("Internal error node::state()");

Modified: branches/release/boost/spirit/home/support/detail/lexer/parser/tree/selection_node.hpp
==============================================================================
--- branches/release/boost/spirit/home/support/detail/lexer/parser/tree/selection_node.hpp (original)
+++ branches/release/boost/spirit/home/support/detail/lexer/parser/tree/selection_node.hpp 2009-09-14 12:50:29 EDT (Mon, 14 Sep 2009)
@@ -1,5 +1,5 @@
 // selection_node.hpp
-// Copyright (c) 2007-2008 Ben Hanson (http://www.benhanson.net/)
+// Copyright (c) 2007-2009 Ben Hanson (http://www.benhanson.net/)
 //
 // Distributed under the Boost Software License, Version 1.0. (See accompanying
 // file licence_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt)

Modified: branches/release/boost/spirit/home/support/detail/lexer/parser/tree/sequence_node.hpp
==============================================================================
--- branches/release/boost/spirit/home/support/detail/lexer/parser/tree/sequence_node.hpp (original)
+++ branches/release/boost/spirit/home/support/detail/lexer/parser/tree/sequence_node.hpp 2009-09-14 12:50:29 EDT (Mon, 14 Sep 2009)
@@ -1,5 +1,5 @@
 // sequence_node.hpp
-// Copyright (c) 2007-2008 Ben Hanson (http://www.benhanson.net/)
+// Copyright (c) 2007-2009 Ben Hanson (http://www.benhanson.net/)
 //
 // Distributed under the Boost Software License, Version 1.0. (See accompanying
 // file licence_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt)

Modified: branches/release/boost/spirit/home/support/detail/lexer/partition/charset.hpp
==============================================================================
--- branches/release/boost/spirit/home/support/detail/lexer/partition/charset.hpp (original)
+++ branches/release/boost/spirit/home/support/detail/lexer/partition/charset.hpp 2009-09-14 12:50:29 EDT (Mon, 14 Sep 2009)
@@ -1,5 +1,5 @@
 // charset.hpp
-// Copyright (c) 2007-2008 Ben Hanson (http://www.benhanson.net/)
+// Copyright (c) 2007-2009 Ben Hanson (http://www.benhanson.net/)
 //
 // Distributed under the Boost Software License, Version 1.0. (See accompanying
 // file licence_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt)

Modified: branches/release/boost/spirit/home/support/detail/lexer/partition/equivset.hpp
==============================================================================
--- branches/release/boost/spirit/home/support/detail/lexer/partition/equivset.hpp (original)
+++ branches/release/boost/spirit/home/support/detail/lexer/partition/equivset.hpp 2009-09-14 12:50:29 EDT (Mon, 14 Sep 2009)
@@ -1,5 +1,5 @@
 // equivset.hpp
-// Copyright (c) 2007-2008 Ben Hanson (http://www.benhanson.net/)
+// Copyright (c) 2007-2009 Ben Hanson (http://www.benhanson.net/)
 //
 // Distributed under the Boost Software License, Version 1.0. (See accompanying
 // file licence_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt)

Modified: branches/release/boost/spirit/home/support/detail/lexer/rules.hpp
==============================================================================
--- branches/release/boost/spirit/home/support/detail/lexer/rules.hpp (original)
+++ branches/release/boost/spirit/home/support/detail/lexer/rules.hpp 2009-09-14 12:50:29 EDT (Mon, 14 Sep 2009)
@@ -1,5 +1,5 @@
 // rules.hpp
-// Copyright (c) 2007-2008 Ben Hanson (http://www.benhanson.net/)
+// Copyright (c) 2007-2009 Ben Hanson (http://www.benhanson.net/)
 //
 // Distributed under the Boost Software License, Version 1.0. (See accompanying
 // file licence_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt)
@@ -25,24 +25,34 @@
 {
     // return name of initial state
     template <typename CharT>
- struct initial;
+ struct strings;
 
     template <>
- struct initial<char>
+ struct strings<char>
     {
- static const char *str ()
+ static const char *initial ()
         {
             return "INITIAL";
         }
+
+ static const char *dot ()
+ {
+ return ".";
+ }
     };
 
     template <>
- struct initial<wchar_t>
+ struct strings<wchar_t>
     {
- static const wchar_t *str ()
+ static const wchar_t *initial ()
         {
             return L"INITIAL";
         }
+
+ static const wchar_t *dot ()
+ {
+ return L".";
+ }
     };
 }
 
@@ -61,8 +71,11 @@
     typedef std::map<string, std::size_t> string_size_t_map;
     typedef std::pair<string, std::size_t> string_size_t_pair;
 
- basic_rules (const regex_flags flags_ = dot_not_newline) :
- _flags (flags_)
+ basic_rules (const regex_flags flags_ = dot_not_newline,
+ std::size_t (*counter_ptr_) () = 0) :
+ _flags (flags_),
+ _counter (0),
+ _counter_ptr (counter_ptr_)
     {
         add_state (initial ());
     }
@@ -74,6 +87,7 @@
         _macroset.clear ();
         _regexes.clear ();
         _ids.clear ();
+ _unique_ids.clear ();
         _states.clear ();
         _flags = dot_not_newline;
         _locale = std::locale ();
@@ -88,6 +102,7 @@
         {
             _regexes[state_].clear ();
             _ids[state_].clear ();
+ _unique_ids[state_].clear ();
             _states[state_].clear ();
         }
     }
@@ -102,6 +117,11 @@
         return _flags;
     }
 
+ std::size_t next_unique_id ()
+ {
+ return _counter_ptr ? _counter_ptr () : _counter++;
+ }
+
     std::locale imbue (std::locale &locale_)
     {
         std::locale loc_ = _locale;
@@ -129,17 +149,47 @@
         return state_;
     }
 
- void add_state (const CharT *name_)
+ const CharT *state (const std::size_t index_) const
+ {
+ if (index_ == 0)
+ {
+ return initial ();
+ }
+ else
+ {
+ const std::size_t vec_index_ = index_ - 1;
+
+ if (vec_index_ > _lexer_state_names.size () - 1)
+ {
+ return 0;
+ }
+ else
+ {
+ return _lexer_state_names[vec_index_].c_str ();
+ }
+ }
+ }
+
+ std::size_t add_state (const CharT *name_)
     {
- validate (name_, true);
+ validate (name_);
 
         if (_statemap.insert (string_size_t_pair (name_,
             _statemap.size ())).second)
         {
             _regexes.push_back (string_deque ());
             _ids.push_back (id_vector ());
+ _unique_ids.push_back (id_vector ());
             _states.push_back (id_vector ());
+
+ if (string (name_) != initial ())
+ {
+ _lexer_state_names.push_back (name_);
+ }
         }
+
+ // Initial is not stored, so no need to - 1.
+ return _lexer_state_names.size ();
     }
 
     void add_macro (const CharT *name_, const CharT *regex_)
@@ -155,7 +205,7 @@
 
     void add_macro (const CharT *name_, const string &regex_)
     {
- validate (name_, false);
+ validate (name_);
 
         typename string_set::const_iterator iter_ = _macroset.find (name_);
 
@@ -181,88 +231,248 @@
         }
     }
 
- void add (const CharT *regex_, const std::size_t id_)
+ void add_macros (const basic_rules<CharT> &rules_)
     {
- add (string (regex_), id_);
+ const string_pair_deque &macros_ = rules_.macrodeque ();
+ typename string_pair_deque::const_iterator macro_iter_ =
+ macros_.begin ();
+ typename string_pair_deque::const_iterator macro_end_ =
+ macros_.end ();
+
+ for (; macro_iter_ != macro_end_; ++macro_iter_)
+ {
+ add_macro (macro_iter_->first.c_str (),
+ macro_iter_->second.c_str ());
+ }
+ }
+
+ void merge_macros (const basic_rules<CharT> &rules_)
+ {
+ const string_pair_deque &macros_ = rules_.macrodeque ();
+ typename string_pair_deque::const_iterator macro_iter_ =
+ macros_.begin ();
+ typename string_pair_deque::const_iterator macro_end_ =
+ macros_.end ();
+ typename string_set::const_iterator macro_dest_iter_;
+ typename string_set::const_iterator macro_dest_end_ = _macroset.end ();
+
+ for (; macro_iter_ != macro_end_; ++macro_iter_)
+ {
+ macro_dest_iter_ = _macroset.find (macro_iter_->first);
+
+ if (macro_dest_iter_ == macro_dest_end_)
+ {
+ add_macro (macro_iter_->first.c_str (),
+ macro_iter_->second.c_str ());
+ }
+ }
     }
 
- void add (const CharT *regex_start_, const CharT *regex_end_,
+ std::size_t add (const CharT *regex_, const std::size_t id_)
+ {
+ return add (string (regex_), id_);
+ }
+
+ std::size_t add (const CharT *regex_start_, const CharT *regex_end_,
         const std::size_t id_)
     {
- add (string (regex_start_, regex_end_), id_);
+ return add (string (regex_start_, regex_end_), id_);
     }
 
- void add (const string &regex_, const std::size_t id_)
+ std::size_t add (const string &regex_, const std::size_t id_)
     {
+ const std::size_t counter_ = next_unique_id ();
+
         check_for_invalid_id (id_);
- _regexes[0].push_back (regex_);
- _ids[0].push_back (id_);
- _states[0].push_back (0);
+ _regexes.front ().push_back (regex_);
+ _ids.front ().push_back (id_);
+ _unique_ids.front ().push_back (counter_);
+ _states.front ().push_back (0);
+ return counter_;
     }
 
- void add (const CharT *curr_state_, const CharT *regex_,
+ std::size_t add (const CharT *curr_state_, const CharT *regex_,
         const CharT *new_state_)
     {
- add (curr_state_, string (regex_), new_state_);
+ return add (curr_state_, string (regex_), new_state_);
     }
 
- void add (const CharT *curr_state_, const CharT *regex_start_,
+ std::size_t add (const CharT *curr_state_, const CharT *regex_start_,
         const CharT *regex_end_, const CharT *new_state_)
     {
- add (curr_state_, string (regex_start_, regex_end_), new_state_);
+ return add (curr_state_, string (regex_start_, regex_end_),
+ new_state_);
     }
 
- void add (const CharT *curr_state_, const string &regex_,
+ std::size_t add (const CharT *curr_state_, const string &regex_,
         const CharT *new_state_)
     {
- add (curr_state_, regex_, 0, new_state_, false);
+ return add (curr_state_, regex_, 0, new_state_, false);
     }
 
- void add (const CharT *curr_state_, const CharT *regex_,
+ std::size_t add (const CharT *curr_state_, const CharT *regex_,
         const std::size_t id_, const CharT *new_state_)
     {
- add (curr_state_, string (regex_), id_, new_state_);
+ return add (curr_state_, string (regex_), id_, new_state_);
     }
 
- void add (const CharT *curr_state_, const CharT *regex_start_,
- const CharT *regex_end_, const std::size_t id_, const CharT *new_state_)
+ std::size_t add (const CharT *curr_state_, const CharT *regex_start_,
+ const CharT *regex_end_, const std::size_t id_,
+ const CharT *new_state_)
     {
- add (curr_state_, string (regex_start_, regex_end_), id_, new_state_);
+ return add (curr_state_, string (regex_start_, regex_end_), id_,
+ new_state_);
     }
 
- void add (const CharT *curr_state_, const string &regex_,
+ std::size_t add (const CharT *curr_state_, const string &regex_,
         const std::size_t id_, const CharT *new_state_)
     {
- add (curr_state_, regex_, id_, new_state_, true);
+ return add (curr_state_, regex_, id_, new_state_, true);
     }
 
- void add (const CharT *curr_state_, const basic_rules &rules_)
+ void add (const CharT *source_, const basic_rules<CharT> &rules_,
+ const CharT *dest_, const CharT *to_ = detail::strings<CharT>::dot ())
+ {
+ const bool star_ = *source_ == '*' && *(source_ + 1) == 0;
+ const bool dest_dot_ = *dest_ == '.' && *(dest_ + 1) == 0;
+ const bool to_dot_ = *to_ == '.' && *(to_ + 1) == 0;
+ std::size_t state_ = 0;
+ const string_deque_deque &all_regexes_ = rules_.regexes ();
+ const id_vector_deque &all_ids_ = rules_.ids ();
+ const id_vector_deque &all_unique_ids_ = rules_.unique_ids ();
+ const id_vector_deque &all_states_ = rules_.states ();
+ typename string_deque::const_iterator regex_iter_;
+ typename string_deque::const_iterator regex_end_;
+ typename id_vector::const_iterator id_iter_;
+ typename id_vector::const_iterator uid_iter_;
+ typename id_vector::const_iterator state_iter_;
+
+ if (star_)
+ {
+ typename string_deque_deque::const_iterator all_regexes_iter_ =
+ all_regexes_.begin ();
+ typename string_deque_deque::const_iterator all_regexes_end_ =
+ all_regexes_.end ();
+ typename id_vector_deque::const_iterator all_ids_iter_ =
+ all_ids_.begin ();
+ typename id_vector_deque::const_iterator all_uids_iter_ =
+ all_unique_ids_.begin ();
+ typename id_vector_deque::const_iterator all_states_iter_ =
+ all_states_.begin ();
+
+ for (; all_regexes_iter_ != all_regexes_end_;
+ ++state_, ++all_regexes_iter_, ++all_ids_iter_,
+ ++all_uids_iter_, ++all_states_iter_)
+ {
+ regex_iter_ = all_regexes_iter_->begin ();
+ regex_end_ = all_regexes_iter_->end ();
+ id_iter_ = all_ids_iter_->begin ();
+ uid_iter_ = all_uids_iter_->begin ();
+ state_iter_ = all_states_iter_->begin ();
+
+ for (; regex_iter_ != regex_end_; ++regex_iter_, ++id_iter_,
+ ++uid_iter_, ++state_iter_)
+ {
+ // If ..._dot_ then lookup state name from rules_; otherwise
+ // pass name through.
+ add (dest_dot_ ? rules_.state (state_) : dest_, *regex_iter_,
+ *id_iter_, to_dot_ ? rules_.state (*state_iter_) : to_, true,
+ *uid_iter_);
+ }
+ }
+ }
+ else
+ {
+ const CharT *start_ = source_;
+ string state_name_;
+
+ while (*source_)
+ {
+ while (*source_ && *source_ != ',')
+ {
+ ++source_;
+ }
+
+ state_name_.assign (start_, source_);
+
+ if (*source_)
+ {
+ ++source_;
+ start_ = source_;
+ }
+
+ state_ = rules_.state (state_name_.c_str ());
+
+ if (state_ == npos)
+ {
+ std::basic_stringstream<CharT> ss_;
+ std::ostringstream os_;
+
+ os_ << "Unknown state name '";
+ source_ = state_name_.c_str ();
+
+ while (*source_)
+ {
+ os_ << ss_.narrow (*source_++, ' ');
+ }
+
+ os_ << "'.";
+ throw runtime_error (os_.str ());
+ }
+
+ regex_iter_ = all_regexes_[state_].begin ();
+ regex_end_ = all_regexes_[state_].end ();
+ id_iter_ = all_ids_[state_].begin ();
+ uid_iter_ = all_unique_ids_[state_].begin ();
+ state_iter_ = all_states_[state_].begin ();
+
+ for (; regex_iter_ != regex_end_; ++regex_iter_, ++id_iter_,
+ ++uid_iter_, ++state_iter_)
+ {
+ // If ..._dot_ then lookup state name from rules_; otherwise
+ // pass name through.
+ add (dest_dot_ ? state_name_.c_str () : dest_, *regex_iter_,
+ *id_iter_, to_dot_ ? rules_.state (*state_iter_) : to_, true,
+ *uid_iter_);
+ }
+ }
+ }
+ }
+/*
+ void add (const CharT *curr_state_, const basic_rules<CharT> &rules_)
     {
         const string_deque_deque &regexes_ = rules_.regexes ();
         const id_vector_deque &ids_ = rules_.ids ();
+ const id_vector_deque &unique_ids_ = rules_.unique_ids ();
         typename string_deque_deque::const_iterator state_regex_iter_ =
             regexes_.begin ();
         typename string_deque_deque::const_iterator state_regex_end_ =
             regexes_.end ();
         typename id_vector_deque::const_iterator state_id_iter_ =
             ids_.begin ();
+ typename id_vector_deque::const_iterator state_uid_iter_ =
+ unique_ids_.begin ();
         typename string_deque::const_iterator regex_iter_;
         typename string_deque::const_iterator regex_end_;
         typename id_vector::const_iterator id_iter_;
+ typename id_vector::const_iterator uid_iter_;
 
         for (; state_regex_iter_ != state_regex_end_; ++state_regex_iter_)
         {
             regex_iter_ = state_regex_iter_->begin ();
             regex_end_ = state_regex_iter_->end ();
             id_iter_ = state_id_iter_->begin ();
+ uid_iter_ = state_uid_iter_->begin ();
 
- for (; regex_iter_ != regex_end_; ++regex_iter_, ++id_iter_)
+ for (; regex_iter_ != regex_end_; ++regex_iter_, ++id_iter_,
+ ++uid_iter_)
             {
- add (curr_state_, *regex_iter_, *id_iter_, curr_state_);
+ add (curr_state_, *regex_iter_, *id_iter_, curr_state_, true,
+ *uid_iter_);
             }
         }
     }
-
+*/
     const string_size_t_map &statemap () const
     {
         return _statemap;
@@ -283,6 +493,11 @@
         return _ids;
     }
 
+ const id_vector_deque &unique_ids () const
+ {
+ return _unique_ids;
+ }
+
     const id_vector_deque &states () const
     {
         return _states;
@@ -308,7 +523,7 @@
 
     static const CharT *initial ()
     {
- return detail::initial<CharT>::str ();
+ return detail::strings<CharT>::initial ();
     }
 
 private:
@@ -317,12 +532,17 @@
     string_set _macroset;
     string_deque_deque _regexes;
     id_vector_deque _ids;
+ id_vector_deque _unique_ids;
     id_vector_deque _states;
     regex_flags _flags;
+ std::size_t _counter;
+ std::size_t (*_counter_ptr) ();
     std::locale _locale;
+ string_deque _lexer_state_names;
 
- void add (const CharT *curr_state_, const string &regex_,
- const std::size_t id_, const CharT *new_state_, const bool check_)
+ std::size_t add (const CharT *curr_state_, const string &regex_,
+ const std::size_t id_, const CharT *new_state_, const bool check_,
+ const std::size_t uid_ = npos)
     {
         const bool star_ = *curr_state_ == '*' && *(curr_state_ + 1) == 0;
         const bool dot_ = *new_state_ == '.' && *(new_state_ + 1) == 0;
@@ -334,7 +554,7 @@
 
         if (!dot_)
         {
- validate (new_state_, true);
+ validate (new_state_);
         }
 
         std::size_t new_ = string::npos;
@@ -394,7 +614,7 @@
                     start_ = curr_state_;
                 }
 
- validate (state_.c_str (), true);
+ validate (state_.c_str ());
                 iter_ = _statemap.find (state_.c_str ());
 
                 if (iter_ == end_)
@@ -403,6 +623,7 @@
                     std::ostringstream os_;
 
                     os_ << "Unknown state name '";
+ curr_state_ = state_.c_str ();
 
                     while (*curr_state_)
                     {
@@ -417,19 +638,44 @@
             }
         }
 
+ std::size_t first_counter_ = npos;
+
         for (std::size_t i_ = 0, size_ = states_.size (); i_ < size_; ++i_)
         {
             const std::size_t curr_ = states_[i_];
 
             _regexes[curr_].push_back (regex_);
             _ids[curr_].push_back (id_);
+
+ if (uid_ == npos)
+ {
+ const std::size_t counter_ = next_unique_id ();
+
+ if (first_counter_ == npos)
+ {
+ first_counter_ = counter_;
+ }
+
+ _unique_ids[curr_].push_back (counter_);
+ }
+ else
+ {
+ if (first_counter_ == npos)
+ {
+ first_counter_ = uid_;
+ }
+
+ _unique_ids[curr_].push_back (uid_);
+ }
+
             _states[curr_].push_back (dot_ ? curr_ : new_);
         }
+
+ return first_counter_;
     }
 
- void validate (const CharT *name_, const bool comma_) const
+ void validate (const CharT *name_) const
     {
-again:
         const CharT *start_ = name_;
 
         if (*name_ != '_' && !(*name_ >= 'A' && *name_ <= 'Z') &&
@@ -455,12 +701,6 @@
 
         while (*name_)
         {
- if (*name_ == ',' && comma_)
- {
- ++name_;
- goto again;
- }
-
             if (*name_ != '_' && *name_ != '-' &&
                 !(*name_ >= 'A' && *name_ <= 'Z') &&
                 !(*name_ >= 'a' && *name_ <= 'z') &&
@@ -470,6 +710,7 @@
                 std::ostringstream os_;
 
                 os_ << "Invalid name '";
+ name_ = start_;
 
                 while (*name_)
                 {
@@ -489,6 +730,7 @@
             std::ostringstream os_;
 
             os_ << "Name '";
+ name_ = start_;
 
             while (*name_)
             {

Modified: branches/release/boost/spirit/home/support/detail/lexer/runtime_error.hpp
==============================================================================
--- branches/release/boost/spirit/home/support/detail/lexer/runtime_error.hpp (original)
+++ branches/release/boost/spirit/home/support/detail/lexer/runtime_error.hpp 2009-09-14 12:50:29 EDT (Mon, 14 Sep 2009)
@@ -1,5 +1,5 @@
 // runtime_error.hpp
-// Copyright (c) 2007-2008 Ben Hanson (http://www.benhanson.net/)
+// Copyright (c) 2007-2009 Ben Hanson (http://www.benhanson.net/)
 //
 // Distributed under the Boost Software License, Version 1.0. (See accompanying
 // file licence_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt)

Modified: branches/release/boost/spirit/home/support/detail/lexer/serialise.hpp
==============================================================================
--- branches/release/boost/spirit/home/support/detail/lexer/serialise.hpp (original)
+++ branches/release/boost/spirit/home/support/detail/lexer/serialise.hpp 2009-09-14 12:50:29 EDT (Mon, 14 Sep 2009)
@@ -1,11 +1,12 @@
 // examples/serialise.hpp
-// Copyright (c) 2007-2008 Ben Hanson (http://www.benhanson.net/)
+// Copyright (c) 2007-2009 Ben Hanson (http://www.benhanson.net/)
 //
 // Distributed under the Boost Software License, Version 1.0. (See accompanying
 // file licence_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt)
 #ifndef BOOST_LEXER_SERIALISE_HPP
 #define BOOST_LEXER_SERIALISE_HPP
 
+#include "internals.hpp"
 #include "state_machine.hpp"
 #include <boost/serialization/vector.hpp>
 
@@ -15,14 +16,18 @@
 {
 // IMPORTANT! This won't work if you don't enable RTTI!
 template<typename CharT, class Archive>
-void serialise (basic_state_machine<CharT> &sm_, Archive &ar_, unsigned int version_ = 1)
+void serialise (basic_state_machine<CharT> &sm_, Archive &ar_,
+ unsigned int version_ = 1)
 {
+ detail::internals &internals_ = const_cast<detail::internals &>
+ (sm_.data ());
+
     ar_ & version_;
- ar_ & *sm_._lookup;
- ar_ & sm_._dfa_alphabet;
- ar_ & *sm_._dfa;
- ar_ & sm_._seen_BOL_assertion;
- ar_ & sm_._seen_EOL_assertion;
+ ar_ & *internals_._lookup;
+ ar_ & internals_._dfa_alphabet;
+ ar_ & *internals_._dfa;
+ ar_ & internals_._seen_BOL_assertion;
+ ar_ & internals_._seen_EOL_assertion;
 }
 }
 }

Modified: branches/release/boost/spirit/home/support/detail/lexer/size_t.hpp
==============================================================================
--- branches/release/boost/spirit/home/support/detail/lexer/size_t.hpp (original)
+++ branches/release/boost/spirit/home/support/detail/lexer/size_t.hpp 2009-09-14 12:50:29 EDT (Mon, 14 Sep 2009)
@@ -1,5 +1,5 @@
 // size_t.h
-// Copyright (c) 2007-2008 Ben Hanson (http://www.benhanson.net/)
+// Copyright (c) 2007-2009 Ben Hanson (http://www.benhanson.net/)
 //
 // Distributed under the Boost Software License, Version 1.0. (See accompanying
 // file licence_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt)

Modified: branches/release/boost/spirit/home/support/detail/lexer/state_machine.hpp
==============================================================================
--- branches/release/boost/spirit/home/support/detail/lexer/state_machine.hpp (original)
+++ branches/release/boost/spirit/home/support/detail/lexer/state_machine.hpp 2009-09-14 12:50:29 EDT (Mon, 14 Sep 2009)
@@ -1,5 +1,5 @@
 // state_machine.hpp
-// Copyright (c) 2007 Ben Hanson (http://www.benhanson.net/)
+// Copyright (c) 2007-2009 Ben Hanson (http://www.benhanson.net/)
 //
 // Distributed under the Boost Software License, Version 1.0. (See accompanying
 // file licence_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt)
@@ -10,6 +10,7 @@
 #include "conversion/char_state_machine.hpp"
 #include "consts.hpp"
 #include <deque>
+#include "internals.hpp"
 #include <map>
 #include "containers/ptr_vector.hpp"
 #include "size_t.hpp"
@@ -44,6 +45,7 @@
             // Current state info
             bool end_state;
             std::size_t id;
+ std::size_t unique_id;
             std::size_t goto_dfa;
             std::size_t bol_index;
             std::size_t eol_index;
@@ -60,6 +62,7 @@
                 transition (npos),
                 end_state (false),
                 id (npos),
+ unique_id (npos),
                 goto_dfa (npos),
                 bol_index (npos),
                 eol_index (npos),
@@ -76,6 +79,7 @@
                     transition == rhs_.transition &&
                     end_state == rhs_.end_state &&
                     id == rhs_.id &&
+ unique_id == rhs_.unique_id &&
                     goto_dfa == rhs_.goto_dfa &&
                     bol_index == rhs_.bol_index &&
                     eol_index == rhs_.eol_index &&
@@ -177,7 +181,8 @@
                     }
                     else
                     {
- _states = _sm->_csm._sm_vector[_dfa].size ();
+ _states = _data.states =
+ _sm->_csm._sm_vector[_dfa].size ();
                         _state = _data.state = 0;
                     }
                 }
@@ -195,6 +200,7 @@
                 _transitions = _data.transitions = ptr_->_transitions.size ();
                 _data.end_state = ptr_->_end_state;
                 _data.id = ptr_->_id;
+ _data.unique_id = ptr_->_unique_id;
                 _data.goto_dfa = ptr_->_state;
                 _data.bol_index = ptr_->_bol_index;
                 _data.eol_index = ptr_->_eol_index;
@@ -223,42 +229,39 @@
     friend class iterator;
 #endif
 
- basic_state_machine () :
- _seen_BOL_assertion (false),
- _seen_EOL_assertion (false)
+ basic_state_machine ()
     {
     }
 
     void clear ()
     {
- _lookup.clear ();
- _dfa_alphabet.clear ();
- _dfa.clear ();
- _seen_BOL_assertion = false;
- _seen_EOL_assertion = false;
+ _internals.clear ();
         _csm.clear ();
     }
 
     bool empty () const
     {
         // Don't include _csm in this test, as irrelevant to state.
- return _lookup->empty () && _dfa_alphabet.empty () &&
- _dfa->empty ();
+ return _internals._lookup->empty () &&
+ _internals._dfa_alphabet.empty () &&
+ _internals._dfa->empty ();
     }
 
     std::size_t size () const
     {
- return _dfa->size ();
+ return _internals._dfa->size ();
     }
 
     bool operator == (const basic_state_machine &rhs_) const
     {
         // Don't include _csm in this test, as irrelevant to state.
- return _lookup == rhs_._lookup &&
- _dfa_alphabet == rhs_._dfa_alphabet &&
- _dfa == rhs_._dfa &&
- _seen_BOL_assertion == rhs_._seen_BOL_assertion &&
- _seen_EOL_assertion == rhs_._seen_EOL_assertion;
+ return _internals._lookup == rhs_._internals._lookup &&
+ _internals._dfa_alphabet == rhs_._internals._dfa_alphabet &&
+ _internals._dfa == rhs_._internals._dfa &&
+ _internals._seen_BOL_assertion ==
+ rhs_._internals._seen_BOL_assertion &&
+ _internals._seen_EOL_assertion ==
+ rhs_._internals._seen_EOL_assertion;
     }
 
     iterator begin () const
@@ -268,26 +271,33 @@
         iter_._sm = const_cast<basic_state_machine *>(this);
         check_for_csm ();
 
- if (!_csm.empty())
+ if (!_csm.empty ())
         {
             const typename detail::basic_char_state_machine<CharT>::
- state_vector *ptr_ = &_csm._sm_vector[0];
+ state_vector *ptr_ = &_csm._sm_vector.front ();
 
             iter_._dfas = _csm._sm_vector.size ();
             iter_._states = iter_._data.states = ptr_->size ();
             iter_._transitions = iter_._data.transitions =
- ptr_->front ()._transitions.size ();
+ ptr_->front ()._transitions.size ();
             iter_._dfa = iter_._data.dfa = 0;
             iter_._state = iter_._data.state = 0;
             iter_._transition = 0;
             iter_._data.end_state = ptr_->front ()._end_state;
             iter_._data.id = ptr_->front ()._id;
+ iter_._data.unique_id = ptr_->front ()._unique_id;
             iter_._data.goto_dfa = ptr_->front ()._state;
             iter_._data.bol_index = ptr_->front ()._bol_index;
             iter_._data.eol_index = ptr_->front ()._eol_index;
             iter_._token_iter = ptr_->front ()._transitions.begin ();
             iter_._token_end = ptr_->front ()._transitions.end ();
- ++iter_;
+
+ // Deal with case where there is only a bol or eol
+ // but no other transitions.
+ if (iter_._transitions)
+ {
+ ++iter_;
+ }
         }
 
         return iter_;
@@ -303,26 +313,17 @@
 
     void swap (basic_state_machine &sm_)
     {
- _lookup->swap (*sm_._lookup);
- _dfa_alphabet.swap (sm_._dfa_alphabet);
- _dfa->swap (*sm_._dfa);
- std::swap (_seen_BOL_assertion, sm_._seen_BOL_assertion);
- std::swap (_seen_EOL_assertion, sm_._seen_EOL_assertion);
+ _internals.swap (sm_._internals);
         _csm.swap (sm_._csm);
     }
 
-// VC++ 6, 7.1 and 8 can't cope with template friend classes!
-// #if !(defined _MSC_VER && _MSC_VER < 1500)
-// private:
-// #endif
- typedef std::vector<std::size_t> size_t_vector;
- typedef detail::ptr_vector<size_t_vector> size_t_vector_vector;
-
- size_t_vector_vector _lookup;
- size_t_vector _dfa_alphabet;
- size_t_vector_vector _dfa;
- bool _seen_BOL_assertion;
- bool _seen_EOL_assertion;
+ const detail::internals &data () const
+ {
+ return _internals;
+ }
+
+private:
+ detail::internals _internals;
     mutable detail::basic_char_state_machine<CharT> _csm;
 
     void check_for_csm () const
@@ -337,7 +338,7 @@
     {
         const std::size_t max_ = sizeof (CharT) == 1 ?
             num_chars : num_wchar_ts;
- const std::size_t start_states_ = _dfa->size ();
+ const std::size_t start_states_ = _internals._dfa->size ();
 
         sm_.clear ();
         sm_._sm_vector.resize (start_states_);
@@ -345,13 +346,15 @@
         for (std::size_t start_state_index_ = 0;
             start_state_index_ < start_states_; ++start_state_index_)
         {
- const size_t_vector *lu_ = _lookup[start_state_index_];
- const std::size_t alphabet_ = _dfa_alphabet[start_state_index_] - dfa_offset;
+ const detail::internals::size_t_vector *lu_ =
+ _internals._lookup[start_state_index_];
+ const std::size_t alphabet_ =
+ _internals._dfa_alphabet[start_state_index_] - dfa_offset;
             std::vector<std::basic_string<CharT> > chars_ (alphabet_);
- const std::size_t states_ = _dfa[start_state_index_]->size () /
- (alphabet_ + dfa_offset);
- const std::size_t *read_ptr_ = &_dfa[start_state_index_]->
- front () + alphabet_ + dfa_offset;
+ const std::size_t states_ = _internals._dfa[start_state_index_]->
+ size () / (alphabet_ + dfa_offset);
+ const std::size_t *read_ptr_ = &_internals.
+ _dfa[start_state_index_]->front () + alphabet_ + dfa_offset;
 
             sm_._sm_vector[start_state_index_].resize (states_ - 1);
 
@@ -376,6 +379,7 @@
 
                 state_->_end_state = *read_ptr_ != 0;
                 state_->_id = *(read_ptr_ + id_index);
+ state_->_unique_id = *(read_ptr_ + unique_id_index);
                 state_->_state = *(read_ptr_ + state_index);
                 state_->_bol_index = *(read_ptr_ + bol_index) - 1;
                 state_->_eol_index = *(read_ptr_ + eol_index) - 1;
@@ -423,21 +427,6 @@
             }
         }
     }
-
-#if !(defined _MSC_VER && _MSC_VER < 1500)
- template<typename ChT, typename Traits>
- friend class basic_file_input;
-
- template<typename ChT, typename Traits>
- friend class basic_generator;
-
- template<typename FwdIter, typename Traits>
- friend class basic_input;
-
- template<typename ChT, class Archive>
- friend void serialise (basic_state_machine &sm_, Archive &ar_,
- unsigned int version_);
-#endif
 };
 
 typedef basic_state_machine<char> state_machine;

Modified: branches/release/boost/spirit/home/support/detail/lexer/string_token.hpp
==============================================================================
--- branches/release/boost/spirit/home/support/detail/lexer/string_token.hpp (original)
+++ branches/release/boost/spirit/home/support/detail/lexer/string_token.hpp 2009-09-14 12:50:29 EDT (Mon, 14 Sep 2009)
@@ -1,5 +1,5 @@
 // string_token.hpp
-// Copyright (c) 2007-2008 Ben Hanson (http://www.benhanson.net/)
+// Copyright (c) 2007-2009 Ben Hanson (http://www.benhanson.net/)
 //
 // Distributed under the Boost Software License, Version 1.0. (See accompanying
 // file licence_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt)
@@ -135,7 +135,7 @@
 
     void intersect (basic_string_token &rhs_, basic_string_token &overlap_)
     {
- if (any () && rhs_.any () || (_negated == rhs_._negated &&
+ if ((any () && rhs_.any ()) || (_negated == rhs_._negated &&
             !any () && !rhs_.any ()))
         {
             intersect_same_types (rhs_, overlap_);
@@ -147,7 +147,8 @@
     }
 
 private:
- void intersect_same_types (basic_string_token &rhs_, basic_string_token &overlap_)
+ void intersect_same_types (basic_string_token &rhs_,
+ basic_string_token &overlap_)
     {
         if (any ())
         {

Modified: branches/release/boost/spirit/home/support/detail/math/detail/fp_traits.hpp
==============================================================================
--- branches/release/boost/spirit/home/support/detail/math/detail/fp_traits.hpp (original)
+++ branches/release/boost/spirit/home/support/detail/math/detail/fp_traits.hpp 2009-09-14 12:50:29 EDT (Mon, 14 Sep 2009)
@@ -13,6 +13,10 @@
 # error The VAX floating point mode on VMS is not supported.
 #endif
 
+#if defined(_MSC_VER)
+#pragma once
+#endif
+
 #include <cstring>
 
 #include <boost/assert.hpp>

Modified: branches/release/boost/spirit/home/support/detail/math/fpclassify.hpp
==============================================================================
--- branches/release/boost/spirit/home/support/detail/math/fpclassify.hpp (original)
+++ branches/release/boost/spirit/home/support/detail/math/fpclassify.hpp 2009-09-14 12:50:29 EDT (Mon, 14 Sep 2009)
@@ -38,7 +38,11 @@
 depending on whether all the mantissa bits are copied or not.
 */
 
-#include <boost/config/no_tr1/cmath.hpp>
+#if defined(_MSC_VER)
+#pragma once
+#endif
+
+#include <cmath>
 
 #ifndef FP_INFINITE
 # define FP_INFINITE 0

Deleted: branches/release/boost/spirit/home/support/detail/math/nonfinite_num_facets.hpp
==============================================================================
--- branches/release/boost/spirit/home/support/detail/math/nonfinite_num_facets.hpp 2009-09-14 12:50:29 EDT (Mon, 14 Sep 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

Modified: branches/release/boost/spirit/home/support/detail/math/signbit.hpp
==============================================================================
--- branches/release/boost/spirit/home/support/detail/math/signbit.hpp (original)
+++ branches/release/boost/spirit/home/support/detail/math/signbit.hpp 2009-09-14 12:50:29 EDT (Mon, 14 Sep 2009)
@@ -9,6 +9,10 @@
 // (See accompanying file LICENSE_1_0.txt
 // or copy at http://www.boost.org/LICENSE_1_0.txt)
 
+#if defined(_MSC_VER)
+#pragma once
+#endif
+
 #include <boost/spirit/home/support/detail/math/detail/fp_traits.hpp>
 
 namespace boost {

Deleted: branches/release/boost/spirit/home/support/detail/to_narrow.hpp
==============================================================================
--- branches/release/boost/spirit/home/support/detail/to_narrow.hpp 2009-09-14 12:50:29 EDT (Mon, 14 Sep 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: branches/release/boost/spirit/home/support/detail/values.hpp
==============================================================================
--- branches/release/boost/spirit/home/support/detail/values.hpp 2009-09-14 12:50:29 EDT (Mon, 14 Sep 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: branches/release/boost/spirit/home/support/detail/what_function.hpp
==============================================================================
--- branches/release/boost/spirit/home/support/detail/what_function.hpp (original)
+++ branches/release/boost/spirit/home/support/detail/what_function.hpp 2009-09-14 12:50:29 EDT (Mon, 14 Sep 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;
     };
 }}}
 

Deleted: branches/release/boost/spirit/home/support/iso8859_1.hpp
==============================================================================
--- branches/release/boost/spirit/home/support/iso8859_1.hpp 2009-09-14 12:50:29 EDT (Mon, 14 Sep 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: branches/release/boost/spirit/home/support/iterators/detail/buf_id_check_policy.hpp
==============================================================================
--- branches/release/boost/spirit/home/support/iterators/detail/buf_id_check_policy.hpp (original)
+++ branches/release/boost/spirit/home/support/iterators/detail/buf_id_check_policy.hpp 2009-09-14 12:50:29 EDT (Mon, 14 Sep 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)
@@ -13,7 +13,7 @@
 #include <boost/throw_exception.hpp>
 #include <exception> // for std::exception
 
-namespace boost { namespace spirit { namespace multi_pass_policies
+namespace boost { namespace spirit { namespace iterator_policies
 {
     ///////////////////////////////////////////////////////////////////////////
     // class illegal_backtracking
@@ -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)
             {
@@ -63,7 +58,7 @@
             template <typename MultiPass>
             static void check(MultiPass const& mp)
             {
- if (mp.buf_id != mp.shared->shared_buf_id)
+ if (mp.buf_id != mp.shared()->shared_buf_id)
                     boost::throw_exception(illegal_backtracking());
             }
 
@@ -71,18 +66,17 @@
             template <typename MultiPass>
             static void clear_queue(MultiPass& mp)
             {
- ++mp.shared->shared_buf_id;
+ ++mp.shared()->shared_buf_id;
                 ++mp.buf_id;
             }
 
             template <typename MultiPass>
- static void destroy(MultiPass&)
- {}
+ static void destroy(MultiPass&) {}
 
         protected:
             unsigned long buf_id;
         };
-
+
         ///////////////////////////////////////////////////////////////////////
         struct shared
         {

Modified: branches/release/boost/spirit/home/support/iterators/detail/combine_policies.hpp
==============================================================================
--- branches/release/boost/spirit/home/support/iterators/detail/combine_policies.hpp (original)
+++ branches/release/boost/spirit/home/support/iterators/detail/combine_policies.hpp 2009-09-14 12:50:29 EDT (Mon, 14 Sep 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,19 +6,21 @@
 #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
+namespace boost { namespace spirit { namespace iterator_policies
 {
     ///////////////////////////////////////////////////////////////////////////
     // 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,79 @@
     // 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;
+
+ explicit shared(T const& input)
+ : shared_base_type(input), inhibit_clear_queue_(false) {}
 
- 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) {}
+ // This is needed for the correct implementation of expectation
+ // points. Normally expectation points flush any multi_pass
+ // iterator they may act on, but if the corresponding error handler
+ // is of type 'retry' no flushing of the internal buffers should be
+ // executed (even if explicitly requested).
+ bool inhibit_clear_queue_;
         };
     };
-
+
 }}}
 
 #endif

Modified: branches/release/boost/spirit/home/support/iterators/detail/first_owner_policy.hpp
==============================================================================
--- branches/release/boost/spirit/home/support/iterators/detail/first_owner_policy.hpp (original)
+++ branches/release/boost/spirit/home/support/iterators/detail/first_owner_policy.hpp 2009-09-14 12:50:29 EDT (Mon, 14 Sep 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)
@@ -10,7 +10,7 @@
 #include <boost/spirit/home/support/iterators/multi_pass_fwd.hpp>
 #include <boost/spirit/home/support/iterators/detail/multi_pass.hpp>
 
-namespace boost { namespace spirit { namespace multi_pass_policies
+namespace boost { namespace spirit { namespace iterator_policies
 {
     ///////////////////////////////////////////////////////////////////////////
     // class first_owner
@@ -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: branches/release/boost/spirit/home/support/iterators/detail/fixed_size_queue.hpp
==============================================================================
--- branches/release/boost/spirit/home/support/iterators/detail/fixed_size_queue.hpp (original)
+++ branches/release/boost/spirit/home/support/iterators/detail/fixed_size_queue.hpp 2009-09-14 12:50:29 EDT (Mon, 14 Sep 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: branches/release/boost/spirit/home/support/iterators/detail/fixed_size_queue_policy.hpp
==============================================================================
--- branches/release/boost/spirit/home/support/iterators/detail/fixed_size_queue_policy.hpp (original)
+++ branches/release/boost/spirit/home/support/iterators/detail/fixed_size_queue_policy.hpp 2009-09-14 12:50:29 EDT (Mon, 14 Sep 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)
@@ -12,7 +12,7 @@
 #include <boost/assert.hpp>
 #include <cstdlib>
 
-namespace boost { namespace spirit { namespace multi_pass_policies
+namespace boost { namespace spirit { namespace iterator_policies
 {
     ///////////////////////////////////////////////////////////////////////////
     // class fixed_size_queue
@@ -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)
             {
@@ -57,7 +55,7 @@
             static typename MultiPass::reference
             dereference(MultiPass const& mp)
             {
- if (mp.queuePosition == mp.shared->queuedElements.end())
+ if (mp.queuePosition == mp.shared()->queuedElements.end())
                 {
                     return MultiPass::get_input(mp);
                 }
@@ -73,13 +71,13 @@
             template <typename MultiPass>
             static void increment(MultiPass& mp)
             {
- if (mp.queuePosition == mp.shared->queuedElements.end())
+ if (mp.queuePosition == mp.shared()->queuedElements.end())
                 {
                     // don't let the queue get larger than N
- if (mp.shared->queuedElements.size() >= N)
- mp.shared->queuedElements.pop_front();
+ if (mp.shared()->queuedElements.size() >= N)
+ mp.shared()->queuedElements.pop_front();
 
- mp.shared->queuedElements.push_back(MultiPass::get_input(mp));
+ mp.shared()->queuedElements.push_back(MultiPass::get_input(mp));
                     MultiPass::advance_input(mp);
                 }
                 ++mp.queuePosition;
@@ -91,7 +89,7 @@
             template <typename MultiPass>
             static bool is_eof(MultiPass const& mp)
             {
- return mp.queuePosition == mp.shared->queuedElements.end() &&
+ return mp.queuePosition == mp.shared()->queuedElements.end() &&
                        MultiPass::input_at_eof(mp);
             }
 

Modified: branches/release/boost/spirit/home/support/iterators/detail/functor_input_policy.hpp
==============================================================================
--- branches/release/boost/spirit/home/support/iterators/detail/functor_input_policy.hpp (original)
+++ branches/release/boost/spirit/home/support/iterators/detail/functor_input_policy.hpp 2009-09-14 12:50:29 EDT (Mon, 14 Sep 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)
@@ -10,7 +10,7 @@
 #include <boost/spirit/home/support/iterators/detail/multi_pass.hpp>
 #include <boost/assert.hpp>
 
-namespace boost { namespace spirit { namespace multi_pass_policies
+namespace boost { namespace spirit { namespace iterator_policies
 {
     namespace is_valid_test_
     {
@@ -20,7 +20,7 @@
             return true;
         }
     }
-
+
     ///////////////////////////////////////////////////////////////////////////
     // class functor_input
     // Implementation of the InputPolicy used by multi_pass
@@ -64,7 +64,7 @@
                 // if mp.shared is NULL then this instance of the multi_pass
                 // represents a end iterator, so no advance functionality is
                 // needed
- if (0 != mp.shared)
+ if (0 != mp.shared())
                     t = mp.ftor();
             }
 

Modified: branches/release/boost/spirit/home/support/iterators/detail/input_iterator_policy.hpp
==============================================================================
--- branches/release/boost/spirit/home/support/iterators/detail/input_iterator_policy.hpp (original)
+++ branches/release/boost/spirit/home/support/iterators/detail/input_iterator_policy.hpp 2009-09-14 12:50:29 EDT (Mon, 14 Sep 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)
@@ -12,14 +12,14 @@
 #include <boost/detail/iterator.hpp> // for boost::detail::iterator_traits
 #include <boost/assert.hpp>
 
-namespace boost { namespace spirit { namespace multi_pass_policies
+namespace boost { namespace spirit { namespace iterator_policies
 {
     namespace input_iterator_is_valid_test_
     {
         template <typename Token>
- inline bool token_is_valid(Token const&)
+ inline bool token_is_valid(Token const& c)
         {
- return true;
+ return c ? true : false;
         }
     }
 
@@ -33,7 +33,7 @@
     {
         ///////////////////////////////////////////////////////////////////////
         template <typename T>
- class unique : public detail::default_input_policy
+ class unique // : public detail::default_input_policy
         {
         private:
             typedef
@@ -45,7 +45,7 @@
                 typename boost::detail::iterator_traits<T>::difference_type
             difference_type;
             typedef
- typename boost::detail::iterator_traits<T>::distance_type
+ typename boost::detail::iterator_traits<T>::difference_type
             distance_type;
             typedef
                 typename boost::detail::iterator_traits<T>::pointer
@@ -57,29 +57,26 @@
 
         protected:
             unique() {}
- explicit unique(T x) : input(x) {}
+ explicit unique(T x) {}
 
- void swap(unique& x)
- {
- spirit::detail::swap(input, x.input);
- }
+ void swap(unique&) {}
 
         public:
             template <typename MultiPass>
- static void advance_input(MultiPass& mp, value_type& t)
+ static void destroy(MultiPass&) {}
+
+ template <typename MultiPass>
+ static value_type& advance_input(MultiPass& mp, value_type& t)
             {
- // if mp.shared is NULL then this instance of the multi_pass
- // represents a end iterator, so no advance functionality is
- // needed
- if (0 != mp.shared)
- t = *++mp.input;
+ return t = *mp.shared()->input_++;
             }
 
             // test, whether we reached the end of the underlying stream
             template <typename MultiPass>
             static bool input_at_eof(MultiPass const& mp, value_type const&)
             {
- return mp.input == T();
+ static T const end_iter;
+ return mp.shared()->input_ == end_iter;
             }
 
             template <typename MultiPass>
@@ -89,17 +86,16 @@
                 return token_is_valid(t);
             }
 
- protected:
- T input;
+ // no unique data elements
         };
 
         ///////////////////////////////////////////////////////////////////////
         template <typename T>
         struct shared
         {
- explicit shared(T) {}
+ explicit shared(T const& input) : input_(input) {}
 
- // no shared data elements
+ T input_;
         };
     };
 

Modified: branches/release/boost/spirit/home/support/iterators/detail/lex_input_policy.hpp
==============================================================================
--- branches/release/boost/spirit/home/support/iterators/detail/lex_input_policy.hpp (original)
+++ branches/release/boost/spirit/home/support/iterators/detail/lex_input_policy.hpp 2009-09-14 12:50:29 EDT (Mon, 14 Sep 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)
@@ -10,7 +10,7 @@
 #include <boost/spirit/home/support/iterators/multi_pass_fwd.hpp>
 #include <boost/spirit/home/support/iterators/detail/multi_pass.hpp>
 
-namespace boost { namespace spirit { namespace multi_pass_policies
+namespace boost { namespace spirit { namespace iterator_policies
 {
     ///////////////////////////////////////////////////////////////////////////////
     // class lex_input
@@ -37,16 +37,10 @@
 
         public:
             template <typename MultiPass>
- static void advance_input(MultiPass& mp, value_type& t)
+ static value_type& advance_input(MultiPass& mp, value_type& t)
             {
- // if mp.shared is NULL then this instance of the multi_pass
- // represents a end iterator, so no advance functionality is
- // needed
- if (0 != mp.shared)
- {
- extern int yylex();
- t = yylex();
- }
+ extern int yylex();
+ return t = yylex();
             }
 
             // test, whether we reached the end of the underlying stream

Modified: branches/release/boost/spirit/home/support/iterators/detail/multi_pass.hpp
==============================================================================
--- branches/release/boost/spirit/home/support/iterators/detail/multi_pass.hpp (original)
+++ branches/release/boost/spirit/home/support/iterators/detail/multi_pass.hpp 2009-09-14 12:50:29 EDT (Mon, 14 Sep 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: branches/release/boost/spirit/home/support/iterators/detail/no_check_policy.hpp
==============================================================================
--- branches/release/boost/spirit/home/support/iterators/detail/no_check_policy.hpp (original)
+++ branches/release/boost/spirit/home/support/iterators/detail/no_check_policy.hpp 2009-09-14 12:50:29 EDT (Mon, 14 Sep 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)
@@ -10,7 +10,7 @@
 #include <boost/spirit/home/support/iterators/multi_pass_fwd.hpp>
 #include <boost/spirit/home/support/iterators/detail/multi_pass.hpp>
 
-namespace boost { namespace spirit { namespace multi_pass_policies
+namespace boost { namespace spirit { namespace iterator_policies
 {
     ///////////////////////////////////////////////////////////////////////////
     // class no_check
@@ -35,8 +35,7 @@
         };
 
         ///////////////////////////////////////////////////////////////////////
- struct shared
- {};
+ struct shared {};
     };
 
 }}}

Modified: branches/release/boost/spirit/home/support/iterators/detail/ref_counted_policy.hpp
==============================================================================
--- branches/release/boost/spirit/home/support/iterators/detail/ref_counted_policy.hpp (original)
+++ branches/release/boost/spirit/home/support/iterators/detail/ref_counted_policy.hpp 2009-09-14 12:50:29 EDT (Mon, 14 Sep 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)
@@ -9,9 +9,12 @@
 
 #include <boost/spirit/home/support/iterators/multi_pass_fwd.hpp>
 #include <boost/spirit/home/support/iterators/detail/multi_pass.hpp>
+#if defined(BOOST_HAS_THREADS)
+#include <boost/detail/atomic_count.hpp>
+#endif
 #include <cstdlib>
 
-namespace boost { namespace spirit { namespace multi_pass_policies
+namespace boost { namespace spirit { namespace iterator_policies
 {
     ///////////////////////////////////////////////////////////////////////////
     // class ref_counted
@@ -32,8 +35,8 @@
             template <typename MultiPass>
             static void clone(MultiPass& mp)
             {
- if (0 != mp.shared)
- ++mp.shared->count;
+ if (0 != mp.shared())
+ ++mp.shared()->count;
             }
 
             // called when a copy is deleted. Decrement the ref-count. Return
@@ -41,7 +44,7 @@
             template <typename MultiPass>
             static bool release(MultiPass& mp)
             {
- return 0 != mp.shared && 0 == --mp.shared->count;
+ return 0 != mp.shared() && 0 == --mp.shared()->count;
             }
 
             // returns true if there is only one iterator in existence.
@@ -50,19 +53,23 @@
             template <typename MultiPass>
             static bool is_unique(MultiPass const& mp)
             {
- return 0 == mp.shared || 1 == mp.shared->count;
+ return 0 == mp.shared() || 1 == mp.shared()->count;
             }
 
             template <typename MultiPass>
- static void destroy(MultiPass&)
- {}
+ static void destroy(MultiPass&) {}
         };
 
         ////////////////////////////////////////////////////////////////////////
         struct shared
         {
             shared() : count(1) {}
+
+#if defined(BOOST_HAS_THREADS)
+ boost::detail::atomic_count count;
+#else
             std::size_t count;
+#endif
         };
 
     };

Modified: branches/release/boost/spirit/home/support/iterators/detail/split_functor_input_policy.hpp
==============================================================================
--- branches/release/boost/spirit/home/support/iterators/detail/split_functor_input_policy.hpp (original)
+++ branches/release/boost/spirit/home/support/iterators/detail/split_functor_input_policy.hpp 2009-09-14 12:50:29 EDT (Mon, 14 Sep 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)
@@ -11,7 +11,7 @@
 #include <boost/assert.hpp>
 #include <boost/type_traits/is_empty.hpp>
 
-namespace boost { namespace spirit { namespace multi_pass_policies
+namespace boost { namespace spirit { namespace iterator_policies
 {
     namespace split_functor_input_is_valid_test_
     {
@@ -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: branches/release/boost/spirit/home/support/iterators/detail/split_std_deque_policy.hpp
==============================================================================
--- branches/release/boost/spirit/home/support/iterators/detail/split_std_deque_policy.hpp (original)
+++ branches/release/boost/spirit/home/support/iterators/detail/split_std_deque_policy.hpp 2009-09-14 12:50:29 EDT (Mon, 14 Sep 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)
@@ -12,7 +12,7 @@
 #include <boost/assert.hpp>
 #include <vector>
 
-namespace boost { namespace spirit { namespace multi_pass_policies
+namespace boost { namespace spirit { namespace iterator_policies
 {
     ///////////////////////////////////////////////////////////////////////////
     // class split_std_deque
@@ -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(1) {}
 
             unique(unique const& x)
- : queued_position(x.queued_position)
- {}
+ : queued_position(x.queued_position) {}
 
             void swap(unique& x)
             {
@@ -55,21 +52,15 @@
             static typename MultiPass::reference
             dereference(MultiPass const& mp)
             {
- queue_type& queue = mp.shared->queued_elements;
- if (0 == mp.queued_position)
- {
- if (queue.empty())
- {
- queue.push_back(Value());
- return MultiPass::advance_input(mp, queue[mp.queued_position++]);
- }
- return queue[mp.queued_position++];
- }
- else if (!MultiPass::input_is_valid(mp, queue[mp.queued_position-1]))
- {
- MultiPass::advance_input(mp, queue[mp.queued_position-1]);
- }
- return queue[mp.queued_position-1];
+ queue_type& queue = mp.shared()->queued_elements;
+ typename queue_type::size_type size = queue.size();
+
+ BOOST_ASSERT(mp.queued_position > 0 && mp.queued_position <= size);
+
+ Value& v(queue[mp.queued_position-1]);
+ if (!MultiPass::input_is_valid(mp, v))
+ return MultiPass::advance_input(mp, v);
+ return v;
             }
 
             // This is called when the iterator is incremented. It's a template
@@ -78,9 +69,16 @@
             template <typename MultiPass>
             static void increment(MultiPass& mp)
             {
- queue_type& queue = mp.shared->queued_elements;
+ queue_type& queue = mp.shared()->queued_elements;
                 typename queue_type::size_type size = queue.size();
- BOOST_ASSERT(0 != size && mp.queued_position <= size);
+
+ BOOST_ASSERT(mp.queued_position > 0 && mp.queued_position <= size);
+
+ // do not increment iterator as long as the current token is
+ // invalid
+ if (size > 0 && !MultiPass::input_is_valid(mp, queue[mp.queued_position-1]))
+ return;
+
                 if (mp.queued_position == size)
                 {
                     // check if this is the only iterator
@@ -93,18 +91,17 @@
                         // 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++]);
                     }
                     else
                     {
                         // create a new entry in the queue and initialize
                         // it from the input
- queue.push_back(Value());
- MultiPass::advance_input(mp, queue[mp.queued_position++]);
+ queue.push_back(Value(0));
                     }
+ MultiPass::advance_input(mp, queue[mp.queued_position++]);
                 }
                 else
                 {
@@ -116,15 +113,16 @@
             template <typename MultiPass>
             static void clear_queue(MultiPass& mp)
             {
- mp.shared->queued_elements.clear();
- mp.queued_position = 0;
+ mp.shared()->queued_elements.clear();
+ mp.shared()->queued_elements.push_back(Value(0));
+ mp.queued_position = 1;
             }
 
             // called to determine whether the iterator is an eof iterator
             template <typename MultiPass>
             static bool is_eof(MultiPass const& mp)
             {
- queue_type& queue = mp.shared->queued_elements;
+ queue_type& queue = mp.shared()->queued_elements;
                 return 0 != mp.queued_position &&
                     mp.queued_position == queue.size() &&
                     MultiPass::input_at_eof(mp, queue[mp.queued_position-1]);
@@ -143,10 +141,9 @@
             {
                 return mp.queued_position < x.queued_position;
             }
-
+
             template <typename MultiPass>
- static void destroy(MultiPass&)
- {}
+ static void destroy(MultiPass&) {}
 
         protected:
             mutable typename queue_type::size_type queued_position;
@@ -156,8 +153,12 @@
         template <typename Value>
         struct shared
         {
- shared() { queued_elements.reserve(threshold); }
-
+ shared()
+ {
+ queued_elements.reserve(threshold);
+ queued_elements.push_back(Value(0));
+ }
+
             typedef std::vector<Value> queue_type;
             queue_type queued_elements;
         };

Modified: branches/release/boost/spirit/home/support/iterators/look_ahead.hpp
==============================================================================
--- branches/release/boost/spirit/home/support/iterators/look_ahead.hpp (original)
+++ branches/release/boost/spirit/home/support/iterators/look_ahead.hpp 2009-09-14 12:50:29 EDT (Mon, 14 Sep 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,10 +8,11 @@
 #if !defined(BOOST_SPIRIT_ITERATOR_LOOK_AHEAD_MAR_16_2007_1253PM)
 #define BOOST_SPIRIT_ITERATOR_LOOK_AHEAD_MAR_16_2007_1253PM
 
-#include <boost/spirit/home/support/iterators/detail/input_iterator_policy.hpp>
 #include <boost/spirit/home/support/iterators/detail/first_owner_policy.hpp>
 #include <boost/spirit/home/support/iterators/detail/no_check_policy.hpp>
+#include <boost/spirit/home/support/iterators/detail/input_iterator_policy.hpp>
 #include <boost/spirit/home/support/iterators/detail/fixed_size_queue_policy.hpp>
+#include <boost/spirit/home/support/iterators/detail/combine_policies.hpp>
 #include <boost/spirit/home/support/iterators/multi_pass.hpp>
 
 namespace boost { namespace spirit
@@ -22,23 +23,23 @@
     ///////////////////////////////////////////////////////////////////////////
     template <typename T, std::size_t N>
     class look_ahead :
- public multi_pass<
- T,
- multi_pass_policies::input_iterator,
- multi_pass_policies::first_owner,
- multi_pass_policies::no_check,
- multi_pass_policies::fixed_size_queue<N>
+ public multi_pass<T
+ , iterator_policies::default_policy<
+ iterator_policies::first_owner
+ , iterator_policies::no_check
+ , iterator_policies::input_iterator
+ , iterator_policies::fixed_size_queue<N> >
>
     {
     private:
- typedef multi_pass<
- T,
- multi_pass_policies::input_iterator,
- multi_pass_policies::first_owner,
- multi_pass_policies::no_check,
- multi_pass_policies::fixed_size_queue<N> >
- base_type;
-
+ typedef multi_pass<T
+ , iterator_policies::default_policy<
+ iterator_policies::first_owner
+ , iterator_policies::no_check
+ , iterator_policies::input_iterator
+ , iterator_policies::fixed_size_queue<N> >
+ > base_type;
+
     public:
         look_ahead()
           : base_type() {}

Modified: branches/release/boost/spirit/home/support/iterators/multi_pass.hpp
==============================================================================
--- branches/release/boost/spirit/home/support/iterators/multi_pass.hpp (original)
+++ branches/release/boost/spirit/home/support/iterators/multi_pass.hpp 2009-09-14 12:50:29 EDT (Mon, 14 Sep 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,11 +8,13 @@
 #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>
 #include <boost/limits.hpp>
 #include <boost/detail/workaround.hpp>
+#include <boost/utility/base_from_member.hpp>
 
 namespace boost { namespace spirit
 {
@@ -21,7 +23,9 @@
     ///////////////////////////////////////////////////////////////////////////
     template<typename T, typename Policies>
     class multi_pass
- : public Policies::BOOST_NESTED_TEMPLATE unique<T>
+ : private boost::base_from_member<
+ typename Policies::BOOST_NESTED_TEMPLATE shared<T>*>
+ , public Policies::BOOST_NESTED_TEMPLATE unique<T>
 #if defined(BOOST_NO_TEMPLATE_PARTIAL_SPECIALIZATION)
       , typename iterator_base_creator<T, typename Policies::input_policy>::type
 #endif
@@ -32,7 +36,9 @@
             policies_base_type;
         typedef typename Policies::BOOST_NESTED_TEMPLATE shared<T>
             shared_data_type;
-
+
+ typedef boost::base_from_member<shared_data_type*> member_base;
+
         // define the types the standard embedded iterator typedefs are taken
         // from
 #if defined(BOOST_NO_TEMPLATE_PARTIAL_SPECIALIZATION)
@@ -50,13 +56,22 @@
         typedef typename iterator_type::reference reference;
         typedef typename iterator_type::pointer pointer;
 
- multi_pass()
- : shared(0)
- {}
-
- explicit multi_pass(T input)
- : shared(new shared_data_type(input)), policies_base_type(input)
- {}
+ multi_pass() : member_base((shared_data_type*)0) {}
+
+ // Newer versions of gcc (and perhaps other compilers) are known to
+ // generate warnings about the base class and the 'shared' member
+ // being initialized in the wrong order ('shared' is initialized before
+ // the base class). This is fully intended behavior as some policies
+ // rely on the fact that their shared part is initialized before their
+ // unique part. Please ignore the warnings, these are harmless.
+ explicit multi_pass(T const& input)
+ : member_base(new shared_data_type(input)), policies_base_type(input) {}
+
+ multi_pass(multi_pass const& x)
+ : member_base(x.member), policies_base_type(x)
+ {
+ policies_base_type::clone(*this);
+ }
 
 #if BOOST_WORKAROUND(__GLIBCPP__, == 20020514)
         // The standard library shipped with gcc-3.1 has a bug in
@@ -65,25 +80,17 @@
         // 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) : member_base((shared_data_type*)0) {}
 #endif // BOOST_WORKAROUND(__GLIBCPP__, == 20020514)
 
         ~multi_pass()
         {
             if (policies_base_type::release(*this)) {
                 policies_base_type::destroy(*this);
- delete shared;
+ delete this->member;
             }
         }
 
- multi_pass(multi_pass const& x)
- : shared(x.shared), policies_base_type(x)
- {
- policies_base_type::clone(*this);
- }
-
         multi_pass& operator=(multi_pass const& x)
         {
             if (this != &x) {
@@ -95,7 +102,7 @@
 
         void swap(multi_pass& x)
         {
- spirit::detail::swap(shared, x.shared);
+ spirit::detail::swap(this->member, x.member);
             this->policies_base_type::swap(x);
         }
 
@@ -122,9 +129,19 @@
             return tmp;
         }
 
- void clear_queue()
+ void clear_queue(BOOST_SCOPED_ENUM(traits::clear_mode) mode =
+ traits::clear_mode::clear_if_enabled)
+ {
+ if (mode == traits::clear_mode::clear_always || !inhibit_clear_queue())
+ policies_base_type::clear_queue(*this);
+ }
+ bool inhibit_clear_queue() const
+ {
+ return this->member->inhibit_clear_queue_;
+ }
+ void inhibit_clear_queue(bool flag)
         {
- policies_base_type::clear_queue(*this);
+ this->member->inhibit_clear_queue_ = flag;
         }
 
         bool operator==(multi_pass const& y) const
@@ -133,7 +150,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
@@ -141,14 +158,14 @@
             return policies_base_type::less_than(*this, y);
         }
 
+ // allow access to base member
+ shared_data_type* shared() const { return this->member; }
+
     private: // helper functions
         bool is_eof() const
         {
- return (0 == shared) || policies_base_type::is_eof(*this);
+ return (0 == this->member) || policies_base_type::is_eof(*this);
         }
-
- public:
- shared_data_type *shared;
     };
 
 
@@ -185,19 +202,49 @@
     ///////////////////////////////////////////////////////////////////////////
     template <typename Policies, typename T>
     inline multi_pass<T, Policies>
- make_multi_pass(T i)
+ make_multi_pass(T const& i)
     {
         return multi_pass<T, Policies>(i);
     }
 
+ template <typename T>
+ inline multi_pass<T>
+ make_default_multi_pass(T const& i)
+ {
+ return multi_pass<T>(i);
+ }
+
     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);
     }
 
+ // define special functions allowing to integrate any multi_pass iterator
+ // with expectation points
+ namespace traits
+ {
+ template <typename T, typename Policies>
+ void clear_queue(multi_pass<T, Policies>& mp
+ , BOOST_SCOPED_ENUM(traits::clear_mode) mode)
+ {
+ mp.clear_queue(mode);
+ }
+
+ template <typename T, typename Policies>
+ void inhibit_clear_queue(multi_pass<T, Policies>& mp, bool flag)
+ {
+ mp.inhibit_clear_queue(flag);
+ }
+
+ template <typename T, typename Policies>
+ bool inhibit_clear_queue(multi_pass<T, Policies>& mp)
+ {
+ return mp.inhibit_clear_queue();
+ }
+ }
+
 }} // namespace boost::spirit
 
 #endif

Modified: branches/release/boost/spirit/home/support/iterators/multi_pass_fwd.hpp
==============================================================================
--- branches/release/boost/spirit/home/support/iterators/multi_pass_fwd.hpp (original)
+++ branches/release/boost/spirit/home/support/iterators/multi_pass_fwd.hpp 2009-09-14 12:50:29 EDT (Mon, 14 Sep 2009)
@@ -1,5 +1,6 @@
 /*=============================================================================
     Copyright (c) 2007 Tobias Schwinger
+ Copyright (c) 2001-2009 Hartmut Kaiser
     http://spirit.sourceforge.net/
 
     Distributed under the Boost Software License, Version 1.0. (See accompanying
@@ -9,32 +10,49 @@
 #define BOOST_SPIRIT_ITERATOR_MULTI_PASS_FWD_APR_18_2008_1102AM
 
 #include <cstddef>
+#include <boost/spirit/home/support/multi_pass_wrapper.hpp>
 
 namespace boost { namespace spirit {
 
- namespace multi_pass_policies
+ namespace iterator_policies
     {
         // input policies
         struct input_iterator;
         struct lex_input;
         struct functor_input;
         struct split_functor_input;
-
+
         // ownership policies
         struct ref_counted;
         struct first_owner;
-
+
         // checking policies
         class illegal_backtracking;
         struct buf_id_check;
         struct no_check;
-
+
         // storage policies
- struct std_deque;
+ struct split_std_deque;
         template<std::size_t N> struct fixed_size_queue;
+
+ // policy combiner
+#if defined(BOOST_SPIRIT_DEBUG)
+ template<typename Ownership = ref_counted
+ , typename Checking = buf_id_check
+ , typename Input = input_iterator
+ , typename Storage = split_std_deque>
+ struct default_policy;
+#else
+ template<typename Ownership = ref_counted
+ , typename Checking = no_check
+ , typename Input = input_iterator
+ , typename Storage = split_std_deque>
+ struct default_policy;
+#endif
     }
 
- template <typename T, typename Policies>
+ template <typename T
+ , typename Policies = iterator_policies::default_policy<> >
     class multi_pass;
 
     template <typename T, typename Policies>
@@ -44,8 +62,32 @@
     {
         template <typename T> void swap(T& t1, T& t2);
     }
-
+
 }} // namespace boost::spirit
 
+namespace boost { namespace spirit { namespace traits
+{
+ // declare special functions allowing to integrate any multi_pass iterator
+ // with expectation points
+
+ // multi_pass iterators require special handling (for the non-specialized
+ // versions of these functions see support/multi_pass_wrapper.hpp)
+ template <typename T, typename Policies>
+ void clear_queue(multi_pass<T, Policies>&
+ , BOOST_SCOPED_ENUM(clear_mode) mode = clear_mode::clear_if_enabled);
+
+ template <typename T, typename Policies>
+ void inhibit_clear_queue(multi_pass<T, Policies>&, bool);
+
+ template <typename T, typename Policies>
+ bool inhibit_clear_queue(multi_pass<T, Policies>&);
+
+ // Helper template to recognize a multi_pass iterator. This specialization
+ // will be instantiated for any multi_pass iterator.
+ template <typename T, typename Policies>
+ struct is_multi_pass<multi_pass<T, Policies> > : mpl::true_ {};
+
+}}}
+
 #endif
 

Deleted: branches/release/boost/spirit/home/support/meta_grammar.hpp
==============================================================================
--- branches/release/boost/spirit/home/support/meta_grammar.hpp 2009-09-14 12:50:29 EDT (Mon, 14 Sep 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: branches/release/boost/spirit/home/support/modifier.hpp
==============================================================================
--- branches/release/boost/spirit/home/support/modifier.hpp 2009-09-14 12:50:29 EDT (Mon, 14 Sep 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

Modified: branches/release/boost/spirit/home/support/nonterminal/locals.hpp
==============================================================================
--- branches/release/boost/spirit/home/support/nonterminal/locals.hpp (original)
+++ branches/release/boost/spirit/home/support/nonterminal/locals.hpp 2009-09-14 12:50:29 EDT (Mon, 14 Sep 2009)
@@ -1,16 +1,19 @@
-// 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/preprocessor/repetition/enum_params_with_a_default.hpp>
+#include <boost/preprocessor/repetition/enum_params.hpp>
 #include <boost/mpl/vector.hpp>
 #include <boost/mpl/bool.hpp>
 
@@ -23,7 +26,7 @@
 # endif
 #endif
 
-namespace boost { namespace spirit
+namespace boost { namespace spirit
 {
     ///////////////////////////////////////////////////////////////////////////
     template <
@@ -38,12 +41,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: branches/release/boost/spirit/home/support/nonterminal/nonterminal.hpp
==============================================================================
--- branches/release/boost/spirit/home/support/nonterminal/nonterminal.hpp 2009-09-14 12:50:29 EDT (Mon, 14 Sep 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: branches/release/boost/spirit/home/support/placeholders.hpp
==============================================================================
--- branches/release/boost/spirit/home/support/placeholders.hpp 2009-09-14 12:50:29 EDT (Mon, 14 Sep 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: branches/release/boost/spirit/home/support/safe_bool.hpp
==============================================================================
--- branches/release/boost/spirit/home/support/safe_bool.hpp (original)
+++ branches/release/boost/spirit/home/support/safe_bool.hpp 2009-09-14 12:50:29 EDT (Mon, 14 Sep 2009)
@@ -1,5 +1,6 @@
 /*=============================================================================
- Copyright (c) 2003 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)
@@ -7,50 +8,23 @@
 #if !defined(BOOST_SPIRIT_SAFE_BOOL_HPP)
 #define BOOST_SPIRIT_SAFE_BOOL_HPP
 
-#include <boost/config.hpp>
-#include <boost/detail/workaround.hpp>
+#if defined(_MSC_VER)
+#pragma once
+#endif
 
 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

Deleted: branches/release/boost/spirit/home/support/standard.hpp
==============================================================================
--- branches/release/boost/spirit/home/support/standard.hpp 2009-09-14 12:50:29 EDT (Mon, 14 Sep 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: branches/release/boost/spirit/home/support/standard_wide.hpp
==============================================================================
--- branches/release/boost/spirit/home/support/standard_wide.hpp 2009-09-14 12:50:29 EDT (Mon, 14 Sep 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

Modified: branches/release/boost/spirit/home/support/unused.hpp
==============================================================================
--- branches/release/boost/spirit/home/support/unused.hpp (original)
+++ branches/release/boost/spirit/home/support/unused.hpp 2009-09-14 12:50:29 EDT (Mon, 14 Sep 2009)
@@ -1,52 +1,63 @@
 /*=============================================================================
- 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>
+
+///////////////////////////////////////////////////////////////////////////////
+// implement streaming operators for unused_type for older versions of Fusion
+#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
 {
     ///////////////////////////////////////////////////////////////////////////
     // 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

Modified: branches/release/boost/spirit/include/karma.hpp
==============================================================================
--- branches/release/boost/spirit/include/karma.hpp (original)
+++ branches/release/boost/spirit/include/karma.hpp 2009-09-14 12:50:29 EDT (Mon, 14 Sep 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,11 @@
 =============================================================================*/
 #ifndef BOOST_SPIRIT_INCLUDE_KARMA
 #define BOOST_SPIRIT_INCLUDE_KARMA
+
+#if defined(_MSC_VER)
+#pragma once
+#endif
+
 #include <boost/spirit/home/karma.hpp>
+
 #endif

Modified: branches/release/boost/spirit/include/karma_action.hpp
==============================================================================
--- branches/release/boost/spirit/include/karma_action.hpp (original)
+++ branches/release/boost/spirit/include/karma_action.hpp 2009-09-14 12:50:29 EDT (Mon, 14 Sep 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,11 @@
 =============================================================================*/
 #ifndef BOOST_SPIRIT_INCLUDE_KARMA_ACTION
 #define BOOST_SPIRIT_INCLUDE_KARMA_ACTION
+
+#if defined(_MSC_VER)
+#pragma once
+#endif
+
 #include <boost/spirit/home/karma/action.hpp>
+
 #endif

Modified: branches/release/boost/spirit/include/karma_auxiliary.hpp
==============================================================================
--- branches/release/boost/spirit/include/karma_auxiliary.hpp (original)
+++ branches/release/boost/spirit/include/karma_auxiliary.hpp 2009-09-14 12:50:29 EDT (Mon, 14 Sep 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,11 @@
 =============================================================================*/
 #ifndef BOOST_SPIRIT_INCLUDE_KARMA_AUXILIARY
 #define BOOST_SPIRIT_INCLUDE_KARMA_AUXILIARY
+
+#if defined(_MSC_VER)
+#pragma once
+#endif
+
 #include <boost/spirit/home/karma/auxiliary.hpp>
+
 #endif

Modified: branches/release/boost/spirit/include/karma_binary.hpp
==============================================================================
--- branches/release/boost/spirit/include/karma_binary.hpp (original)
+++ branches/release/boost/spirit/include/karma_binary.hpp 2009-09-14 12:50:29 EDT (Mon, 14 Sep 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,11 @@
 =============================================================================*/
 #ifndef BOOST_SPIRIT_INCLUDE_KARMA_BINARY
 #define BOOST_SPIRIT_INCLUDE_KARMA_BINARY
+
+#if defined(_MSC_VER)
+#pragma once
+#endif
+
 #include <boost/spirit/home/karma/binary.hpp>
+
 #endif

Modified: branches/release/boost/spirit/include/karma_char.hpp
==============================================================================
--- branches/release/boost/spirit/include/karma_char.hpp (original)
+++ branches/release/boost/spirit/include/karma_char.hpp 2009-09-14 12:50:29 EDT (Mon, 14 Sep 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,11 @@
 =============================================================================*/
 #ifndef BOOST_SPIRIT_INCLUDE_KARMA_CHAR
 #define BOOST_SPIRIT_INCLUDE_KARMA_CHAR
+
+#if defined(_MSC_VER)
+#pragma once
+#endif
+
 #include <boost/spirit/home/karma/char.hpp>
+
 #endif

Modified: branches/release/boost/spirit/include/karma_delimit.hpp
==============================================================================
--- branches/release/boost/spirit/include/karma_delimit.hpp (original)
+++ branches/release/boost/spirit/include/karma_delimit.hpp 2009-09-14 12:50:29 EDT (Mon, 14 Sep 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,11 @@
 =============================================================================*/
 #ifndef BOOST_SPIRIT_INCLUDE_KARMA_DELIMIT
 #define BOOST_SPIRIT_INCLUDE_KARMA_DELIMIT
-#include <boost/spirit/home/karma/delimit.hpp>
+
+#if defined(_MSC_VER)
+#pragma once
+#endif
+
+#include <boost/spirit/home/karma/directive/delimit.hpp>
+
 #endif

Modified: branches/release/boost/spirit/include/karma_directive.hpp
==============================================================================
--- branches/release/boost/spirit/include/karma_directive.hpp (original)
+++ branches/release/boost/spirit/include/karma_directive.hpp 2009-09-14 12:50:29 EDT (Mon, 14 Sep 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,11 @@
 =============================================================================*/
 #ifndef BOOST_SPIRIT_INCLUDE_KARMA_DIRECTIVE
 #define BOOST_SPIRIT_INCLUDE_KARMA_DIRECTIVE
+
+#if defined(_MSC_VER)
+#pragma once
+#endif
+
 #include <boost/spirit/home/karma/directive.hpp>
+
 #endif

Modified: branches/release/boost/spirit/include/karma_domain.hpp
==============================================================================
--- branches/release/boost/spirit/include/karma_domain.hpp (original)
+++ branches/release/boost/spirit/include/karma_domain.hpp 2009-09-14 12:50:29 EDT (Mon, 14 Sep 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,11 @@
 =============================================================================*/
 #ifndef BOOST_SPIRIT_INCLUDE_KARMA_DOMAIN
 #define BOOST_SPIRIT_INCLUDE_KARMA_DOMAIN
+
+#if defined(_MSC_VER)
+#pragma once
+#endif
+
 #include <boost/spirit/home/karma/domain.hpp>
+
 #endif

Modified: branches/release/boost/spirit/include/karma_generate.hpp
==============================================================================
--- branches/release/boost/spirit/include/karma_generate.hpp (original)
+++ branches/release/boost/spirit/include/karma_generate.hpp 2009-09-14 12:50:29 EDT (Mon, 14 Sep 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,11 @@
 =============================================================================*/
 #ifndef BOOST_SPIRIT_INCLUDE_KARMA_GENERATE
 #define BOOST_SPIRIT_INCLUDE_KARMA_GENERATE
+
+#if defined(_MSC_VER)
+#pragma once
+#endif
+
 #include <boost/spirit/home/karma/generate.hpp>
+
 #endif

Deleted: branches/release/boost/spirit/include/karma_meta_grammar.hpp
==============================================================================
--- branches/release/boost/spirit/include/karma_meta_grammar.hpp 2009-09-14 12:50:29 EDT (Mon, 14 Sep 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: branches/release/boost/spirit/include/karma_nonterminal.hpp
==============================================================================
--- branches/release/boost/spirit/include/karma_nonterminal.hpp (original)
+++ branches/release/boost/spirit/include/karma_nonterminal.hpp 2009-09-14 12:50:29 EDT (Mon, 14 Sep 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,11 @@
 =============================================================================*/
 #ifndef BOOST_SPIRIT_INCLUDE_KARMA_NONTERMINAL
 #define BOOST_SPIRIT_INCLUDE_KARMA_NONTERMINAL
+
+#if defined(_MSC_VER)
+#pragma once
+#endif
+
 #include <boost/spirit/home/karma/nonterminal.hpp>
+
 #endif

Modified: branches/release/boost/spirit/include/karma_numeric.hpp
==============================================================================
--- branches/release/boost/spirit/include/karma_numeric.hpp (original)
+++ branches/release/boost/spirit/include/karma_numeric.hpp 2009-09-14 12:50:29 EDT (Mon, 14 Sep 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,11 @@
 =============================================================================*/
 #ifndef BOOST_SPIRIT_INCLUDE_KARMA_NUMERIC
 #define BOOST_SPIRIT_INCLUDE_KARMA_NUMERIC
+
+#if defined(_MSC_VER)
+#pragma once
+#endif
+
 #include <boost/spirit/home/karma/numeric.hpp>
+
 #endif

Modified: branches/release/boost/spirit/include/karma_operator.hpp
==============================================================================
--- branches/release/boost/spirit/include/karma_operator.hpp (original)
+++ branches/release/boost/spirit/include/karma_operator.hpp 2009-09-14 12:50:29 EDT (Mon, 14 Sep 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,11 @@
 =============================================================================*/
 #ifndef BOOST_SPIRIT_INCLUDE_KARMA_OPERATOR
 #define BOOST_SPIRIT_INCLUDE_KARMA_OPERATOR
+
+#if defined(_MSC_VER)
+#pragma once
+#endif
+
 #include <boost/spirit/home/karma/operator.hpp>
+
 #endif

Modified: branches/release/boost/spirit/include/karma_stream.hpp
==============================================================================
--- branches/release/boost/spirit/include/karma_stream.hpp (original)
+++ branches/release/boost/spirit/include/karma_stream.hpp 2009-09-14 12:50:29 EDT (Mon, 14 Sep 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,11 @@
 =============================================================================*/
 #ifndef BOOST_SPIRIT_INCLUDE_KARMA_STREAM
 #define BOOST_SPIRIT_INCLUDE_KARMA_STREAM
+
+#if defined(_MSC_VER)
+#pragma once
+#endif
+
 #include <boost/spirit/home/karma/stream.hpp>
+
 #endif

Modified: branches/release/boost/spirit/include/karma_string.hpp
==============================================================================
--- branches/release/boost/spirit/include/karma_string.hpp (original)
+++ branches/release/boost/spirit/include/karma_string.hpp 2009-09-14 12:50:29 EDT (Mon, 14 Sep 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,11 @@
 =============================================================================*/
 #ifndef BOOST_SPIRIT_INCLUDE_KARMA_STRING
 #define BOOST_SPIRIT_INCLUDE_KARMA_STRING
+
+#if defined(_MSC_VER)
+#pragma once
+#endif
+
 #include <boost/spirit/home/karma/string.hpp>
+
 #endif

Modified: branches/release/boost/spirit/include/karma_what.hpp
==============================================================================
--- branches/release/boost/spirit/include/karma_what.hpp (original)
+++ branches/release/boost/spirit/include/karma_what.hpp 2009-09-14 12:50:29 EDT (Mon, 14 Sep 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,11 @@
 =============================================================================*/
 #ifndef BOOST_SPIRIT_INCLUDE_KARMA_WHAT
 #define BOOST_SPIRIT_INCLUDE_KARMA_WHAT
+
+#if defined(_MSC_VER)
+#pragma once
+#endif
+
 #include <boost/spirit/home/karma/what.hpp>
+
 #endif

Modified: branches/release/boost/spirit/include/lex.hpp
==============================================================================
--- branches/release/boost/spirit/include/lex.hpp (original)
+++ branches/release/boost/spirit/include/lex.hpp 2009-09-14 12:50:29 EDT (Mon, 14 Sep 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,11 @@
 =============================================================================*/
 #ifndef BOOST_SPIRIT_INCLUDE_LEX
 #define BOOST_SPIRIT_INCLUDE_LEX
+
+#if defined(_MSC_VER)
+#pragma once
+#endif
+
 #include <boost/spirit/home/lex.hpp>
+
 #endif

Modified: branches/release/boost/spirit/include/lex_domain.hpp
==============================================================================
--- branches/release/boost/spirit/include/lex_domain.hpp (original)
+++ branches/release/boost/spirit/include/lex_domain.hpp 2009-09-14 12:50:29 EDT (Mon, 14 Sep 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,11 @@
 =============================================================================*/
 #ifndef BOOST_SPIRIT_INCLUDE_LEX_DOMAIN
 #define BOOST_SPIRIT_INCLUDE_LEX_DOMAIN
+
+#if defined(_MSC_VER)
+#pragma once
+#endif
+
 #include <boost/spirit/home/lex/domain.hpp>
+
 #endif

Modified: branches/release/boost/spirit/include/lex_lexer.hpp
==============================================================================
--- branches/release/boost/spirit/include/lex_lexer.hpp (original)
+++ branches/release/boost/spirit/include/lex_lexer.hpp 2009-09-14 12:50:29 EDT (Mon, 14 Sep 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,11 @@
 =============================================================================*/
 #ifndef BOOST_SPIRIT_INCLUDE_LEX_LEXER
 #define BOOST_SPIRIT_INCLUDE_LEX_LEXER
+
+#if defined(_MSC_VER)
+#pragma once
+#endif
+
 #include <boost/spirit/home/lex/lexer.hpp>
+
 #endif

Deleted: branches/release/boost/spirit/include/lex_lexer_lexertl.hpp
==============================================================================
--- branches/release/boost/spirit/include/lex_lexer_lexertl.hpp 2009-09-14 12:50:29 EDT (Mon, 14 Sep 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: branches/release/boost/spirit/include/lex_lexer_static_lexertl.hpp
==============================================================================
--- branches/release/boost/spirit/include/lex_lexer_static_lexertl.hpp 2009-09-14 12:50:29 EDT (Mon, 14 Sep 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: branches/release/boost/spirit/include/lex_meta_grammar.hpp
==============================================================================
--- branches/release/boost/spirit/include/lex_meta_grammar.hpp 2009-09-14 12:50:29 EDT (Mon, 14 Sep 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: branches/release/boost/spirit/include/lex_set_state.hpp
==============================================================================
--- branches/release/boost/spirit/include/lex_set_state.hpp 2009-09-14 12:50:29 EDT (Mon, 14 Sep 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: branches/release/boost/spirit/include/lex_tokenize_and_parse.hpp
==============================================================================
--- branches/release/boost/spirit/include/lex_tokenize_and_parse.hpp (original)
+++ branches/release/boost/spirit/include/lex_tokenize_and_parse.hpp 2009-09-14 12:50:29 EDT (Mon, 14 Sep 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,12 @@
 =============================================================================*/
 #ifndef BOOST_SPIRIT_INCLUDE_LEX_TOKENIZE_AND_PARSE
 #define BOOST_SPIRIT_INCLUDE_LEX_TOKENIZE_AND_PARSE
+
+#if defined(_MSC_VER)
+#pragma once
+#endif
+
 #include <boost/spirit/home/lex/tokenize_and_parse.hpp>
+#include <boost/spirit/home/lex/tokenize_and_parse_attr.hpp>
+
 #endif

Modified: branches/release/boost/spirit/include/phoenix.hpp
==============================================================================
--- branches/release/boost/spirit/include/phoenix.hpp (original)
+++ branches/release/boost/spirit/include/phoenix.hpp 2009-09-14 12:50:29 EDT (Mon, 14 Sep 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: branches/release/boost/spirit/include/phoenix_algorithm.hpp
==============================================================================
--- branches/release/boost/spirit/include/phoenix_algorithm.hpp (original)
+++ branches/release/boost/spirit/include/phoenix_algorithm.hpp 2009-09-14 12:50:29 EDT (Mon, 14 Sep 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: branches/release/boost/spirit/include/phoenix_bind.hpp
==============================================================================
--- branches/release/boost/spirit/include/phoenix_bind.hpp (original)
+++ branches/release/boost/spirit/include/phoenix_bind.hpp 2009-09-14 12:50:29 EDT (Mon, 14 Sep 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: branches/release/boost/spirit/include/phoenix_container.hpp
==============================================================================
--- branches/release/boost/spirit/include/phoenix_container.hpp (original)
+++ branches/release/boost/spirit/include/phoenix_container.hpp 2009-09-14 12:50:29 EDT (Mon, 14 Sep 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: branches/release/boost/spirit/include/phoenix_core.hpp
==============================================================================
--- branches/release/boost/spirit/include/phoenix_core.hpp (original)
+++ branches/release/boost/spirit/include/phoenix_core.hpp 2009-09-14 12:50:29 EDT (Mon, 14 Sep 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: branches/release/boost/spirit/include/phoenix_function.hpp
==============================================================================
--- branches/release/boost/spirit/include/phoenix_function.hpp (original)
+++ branches/release/boost/spirit/include/phoenix_function.hpp 2009-09-14 12:50:29 EDT (Mon, 14 Sep 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: branches/release/boost/spirit/include/phoenix_fusion.hpp
==============================================================================
--- branches/release/boost/spirit/include/phoenix_fusion.hpp (original)
+++ branches/release/boost/spirit/include/phoenix_fusion.hpp 2009-09-14 12:50:29 EDT (Mon, 14 Sep 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: branches/release/boost/spirit/include/phoenix_object.hpp
==============================================================================
--- branches/release/boost/spirit/include/phoenix_object.hpp (original)
+++ branches/release/boost/spirit/include/phoenix_object.hpp 2009-09-14 12:50:29 EDT (Mon, 14 Sep 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: branches/release/boost/spirit/include/phoenix_operator.hpp
==============================================================================
--- branches/release/boost/spirit/include/phoenix_operator.hpp (original)
+++ branches/release/boost/spirit/include/phoenix_operator.hpp 2009-09-14 12:50:29 EDT (Mon, 14 Sep 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: branches/release/boost/spirit/include/phoenix_scope.hpp
==============================================================================
--- branches/release/boost/spirit/include/phoenix_scope.hpp (original)
+++ branches/release/boost/spirit/include/phoenix_scope.hpp 2009-09-14 12:50:29 EDT (Mon, 14 Sep 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: branches/release/boost/spirit/include/phoenix_statement.hpp
==============================================================================
--- branches/release/boost/spirit/include/phoenix_statement.hpp (original)
+++ branches/release/boost/spirit/include/phoenix_statement.hpp 2009-09-14 12:50:29 EDT (Mon, 14 Sep 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: branches/release/boost/spirit/include/phoenix_stl.hpp
==============================================================================
--- branches/release/boost/spirit/include/phoenix_stl.hpp (original)
+++ branches/release/boost/spirit/include/phoenix_stl.hpp 2009-09-14 12:50:29 EDT (Mon, 14 Sep 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: branches/release/boost/spirit/include/phoenix_version.hpp
==============================================================================
--- branches/release/boost/spirit/include/phoenix_version.hpp (original)
+++ branches/release/boost/spirit/include/phoenix_version.hpp 2009-09-14 12:50:29 EDT (Mon, 14 Sep 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: branches/release/boost/spirit/include/qi.hpp
==============================================================================
--- branches/release/boost/spirit/include/qi.hpp (original)
+++ branches/release/boost/spirit/include/qi.hpp 2009-09-14 12:50:29 EDT (Mon, 14 Sep 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,11 @@
 =============================================================================*/
 #ifndef BOOST_SPIRIT_INCLUDE_QI
 #define BOOST_SPIRIT_INCLUDE_QI
+
+#if defined(_MSC_VER)
+#pragma once
+#endif
+
 #include <boost/spirit/home/qi.hpp>
+
 #endif

Modified: branches/release/boost/spirit/include/qi_action.hpp
==============================================================================
--- branches/release/boost/spirit/include/qi_action.hpp (original)
+++ branches/release/boost/spirit/include/qi_action.hpp 2009-09-14 12:50:29 EDT (Mon, 14 Sep 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,11 @@
 =============================================================================*/
 #ifndef BOOST_SPIRIT_INCLUDE_QI_ACTION
 #define BOOST_SPIRIT_INCLUDE_QI_ACTION
+
+#if defined(_MSC_VER)
+#pragma once
+#endif
+
 #include <boost/spirit/home/qi/action.hpp>
+
 #endif

Modified: branches/release/boost/spirit/include/qi_auxiliary.hpp
==============================================================================
--- branches/release/boost/spirit/include/qi_auxiliary.hpp (original)
+++ branches/release/boost/spirit/include/qi_auxiliary.hpp 2009-09-14 12:50:29 EDT (Mon, 14 Sep 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,11 @@
 =============================================================================*/
 #ifndef BOOST_SPIRIT_INCLUDE_QI_AUXILIARY
 #define BOOST_SPIRIT_INCLUDE_QI_AUXILIARY
+
+#if defined(_MSC_VER)
+#pragma once
+#endif
+
 #include <boost/spirit/home/qi/auxiliary.hpp>
+
 #endif

Modified: branches/release/boost/spirit/include/qi_binary.hpp
==============================================================================
--- branches/release/boost/spirit/include/qi_binary.hpp (original)
+++ branches/release/boost/spirit/include/qi_binary.hpp 2009-09-14 12:50:29 EDT (Mon, 14 Sep 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,11 @@
 =============================================================================*/
 #ifndef BOOST_SPIRIT_INCLUDE_QI_BINARY
 #define BOOST_SPIRIT_INCLUDE_QI_BINARY
+
+#if defined(_MSC_VER)
+#pragma once
+#endif
+
 #include <boost/spirit/home/qi/binary.hpp>
+
 #endif

Modified: branches/release/boost/spirit/include/qi_char.hpp
==============================================================================
--- branches/release/boost/spirit/include/qi_char.hpp (original)
+++ branches/release/boost/spirit/include/qi_char.hpp 2009-09-14 12:50:29 EDT (Mon, 14 Sep 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,11 @@
 =============================================================================*/
 #ifndef BOOST_SPIRIT_INCLUDE_QI_CHAR
 #define BOOST_SPIRIT_INCLUDE_QI_CHAR
+
+#if defined(_MSC_VER)
+#pragma once
+#endif
+
 #include <boost/spirit/home/qi/char.hpp>
+
 #endif

Deleted: branches/release/boost/spirit/include/qi_debug.hpp
==============================================================================
--- branches/release/boost/spirit/include/qi_debug.hpp 2009-09-14 12:50:29 EDT (Mon, 14 Sep 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_DEBUG
-#define BOOST_SPIRIT_INCLUDE_QI_DEBUG
-#include <boost/spirit/home/qi/debug.hpp>
-#endif

Modified: branches/release/boost/spirit/include/qi_directive.hpp
==============================================================================
--- branches/release/boost/spirit/include/qi_directive.hpp (original)
+++ branches/release/boost/spirit/include/qi_directive.hpp 2009-09-14 12:50:29 EDT (Mon, 14 Sep 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,11 @@
 =============================================================================*/
 #ifndef BOOST_SPIRIT_INCLUDE_QI_DIRECTIVE
 #define BOOST_SPIRIT_INCLUDE_QI_DIRECTIVE
+
+#if defined(_MSC_VER)
+#pragma once
+#endif
+
 #include <boost/spirit/home/qi/directive.hpp>
+
 #endif

Modified: branches/release/boost/spirit/include/qi_domain.hpp
==============================================================================
--- branches/release/boost/spirit/include/qi_domain.hpp (original)
+++ branches/release/boost/spirit/include/qi_domain.hpp 2009-09-14 12:50:29 EDT (Mon, 14 Sep 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,11 @@
 =============================================================================*/
 #ifndef BOOST_SPIRIT_INCLUDE_QI_DOMAIN
 #define BOOST_SPIRIT_INCLUDE_QI_DOMAIN
+
+#if defined(_MSC_VER)
+#pragma once
+#endif
+
 #include <boost/spirit/home/qi/domain.hpp>
+
 #endif

Deleted: branches/release/boost/spirit/include/qi_meta_grammar.hpp
==============================================================================
--- branches/release/boost/spirit/include/qi_meta_grammar.hpp 2009-09-14 12:50:29 EDT (Mon, 14 Sep 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: branches/release/boost/spirit/include/qi_nonterminal.hpp
==============================================================================
--- branches/release/boost/spirit/include/qi_nonterminal.hpp (original)
+++ branches/release/boost/spirit/include/qi_nonterminal.hpp 2009-09-14 12:50:29 EDT (Mon, 14 Sep 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,11 @@
 =============================================================================*/
 #ifndef BOOST_SPIRIT_INCLUDE_QI_NONTERMINAL
 #define BOOST_SPIRIT_INCLUDE_QI_NONTERMINAL
+
+#if defined(_MSC_VER)
+#pragma once
+#endif
+
 #include <boost/spirit/home/qi/nonterminal.hpp>
+
 #endif

Modified: branches/release/boost/spirit/include/qi_numeric.hpp
==============================================================================
--- branches/release/boost/spirit/include/qi_numeric.hpp (original)
+++ branches/release/boost/spirit/include/qi_numeric.hpp 2009-09-14 12:50:29 EDT (Mon, 14 Sep 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,11 @@
 =============================================================================*/
 #ifndef BOOST_SPIRIT_INCLUDE_QI_NUMERIC
 #define BOOST_SPIRIT_INCLUDE_QI_NUMERIC
+
+#if defined(_MSC_VER)
+#pragma once
+#endif
+
 #include <boost/spirit/home/qi/numeric.hpp>
+
 #endif

Modified: branches/release/boost/spirit/include/qi_operator.hpp
==============================================================================
--- branches/release/boost/spirit/include/qi_operator.hpp (original)
+++ branches/release/boost/spirit/include/qi_operator.hpp 2009-09-14 12:50:29 EDT (Mon, 14 Sep 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,11 @@
 =============================================================================*/
 #ifndef BOOST_SPIRIT_INCLUDE_QI_OPERATOR
 #define BOOST_SPIRIT_INCLUDE_QI_OPERATOR
+
+#if defined(_MSC_VER)
+#pragma once
+#endif
+
 #include <boost/spirit/home/qi/operator.hpp>
+
 #endif

Modified: branches/release/boost/spirit/include/qi_parse.hpp
==============================================================================
--- branches/release/boost/spirit/include/qi_parse.hpp (original)
+++ branches/release/boost/spirit/include/qi_parse.hpp 2009-09-14 12:50:29 EDT (Mon, 14 Sep 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,11 @@
 =============================================================================*/
 #ifndef BOOST_SPIRIT_INCLUDE_QI_PARSE
 #define BOOST_SPIRIT_INCLUDE_QI_PARSE
+
+#if defined(_MSC_VER)
+#pragma once
+#endif
+
 #include <boost/spirit/home/qi/parse.hpp>
+
 #endif

Modified: branches/release/boost/spirit/include/qi_skip.hpp
==============================================================================
--- branches/release/boost/spirit/include/qi_skip.hpp (original)
+++ branches/release/boost/spirit/include/qi_skip.hpp 2009-09-14 12:50:29 EDT (Mon, 14 Sep 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,11 @@
 =============================================================================*/
 #ifndef BOOST_SPIRIT_INCLUDE_QI_SKIP
 #define BOOST_SPIRIT_INCLUDE_QI_SKIP
-#include <boost/spirit/home/qi/skip.hpp>
+
+#if defined(_MSC_VER)
+#pragma once
+#endif
+
+#include <boost/spirit/home/qi/skip_over.hpp>
+
 #endif

Modified: branches/release/boost/spirit/include/qi_stream.hpp
==============================================================================
--- branches/release/boost/spirit/include/qi_stream.hpp (original)
+++ branches/release/boost/spirit/include/qi_stream.hpp 2009-09-14 12:50:29 EDT (Mon, 14 Sep 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,11 @@
 =============================================================================*/
 #ifndef BOOST_SPIRIT_INCLUDE_QI_STREAM
 #define BOOST_SPIRIT_INCLUDE_QI_STREAM
+
+#if defined(_MSC_VER)
+#pragma once
+#endif
+
 #include <boost/spirit/home/qi/stream.hpp>
+
 #endif

Modified: branches/release/boost/spirit/include/qi_string.hpp
==============================================================================
--- branches/release/boost/spirit/include/qi_string.hpp (original)
+++ branches/release/boost/spirit/include/qi_string.hpp 2009-09-14 12:50:29 EDT (Mon, 14 Sep 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,11 @@
 =============================================================================*/
 #ifndef BOOST_SPIRIT_INCLUDE_QI_STRING
 #define BOOST_SPIRIT_INCLUDE_QI_STRING
+
+#if defined(_MSC_VER)
+#pragma once
+#endif
+
 #include <boost/spirit/home/qi/string.hpp>
+
 #endif

Modified: branches/release/boost/spirit/include/qi_what.hpp
==============================================================================
--- branches/release/boost/spirit/include/qi_what.hpp (original)
+++ branches/release/boost/spirit/include/qi_what.hpp 2009-09-14 12:50:29 EDT (Mon, 14 Sep 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,11 @@
 =============================================================================*/
 #ifndef BOOST_SPIRIT_INCLUDE_QI_WHAT
 #define BOOST_SPIRIT_INCLUDE_QI_WHAT
+
+#if defined(_MSC_VER)
+#pragma once
+#endif
+
 #include <boost/spirit/home/qi/what.hpp>
+
 #endif

Modified: branches/release/boost/spirit/include/support.hpp
==============================================================================
--- branches/release/boost/spirit/include/support.hpp (original)
+++ branches/release/boost/spirit/include/support.hpp 2009-09-14 12:50:29 EDT (Mon, 14 Sep 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,11 @@
 =============================================================================*/
 #ifndef BOOST_SPIRIT_INCLUDE_SUPPORT
 #define BOOST_SPIRIT_INCLUDE_SUPPORT
+
+#if defined(_MSC_VER)
+#pragma once
+#endif
+
 #include <boost/spirit/home/support.hpp>
+
 #endif

Modified: branches/release/boost/spirit/include/support_any.hpp
==============================================================================
--- branches/release/boost/spirit/include/support_any.hpp (original)
+++ branches/release/boost/spirit/include/support_any.hpp 2009-09-14 12:50:29 EDT (Mon, 14 Sep 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,11 @@
 =============================================================================*/
 #ifndef BOOST_SPIRIT_INCLUDE_SUPPORT_ANY
 #define BOOST_SPIRIT_INCLUDE_SUPPORT_ANY
+
+#if defined(_MSC_VER)
+#pragma once
+#endif
+
 #include <boost/spirit/home/support/algorithm/any.hpp>
+
 #endif

Modified: branches/release/boost/spirit/include/support_any_if.hpp
==============================================================================
--- branches/release/boost/spirit/include/support_any_if.hpp (original)
+++ branches/release/boost/spirit/include/support_any_if.hpp 2009-09-14 12:50:29 EDT (Mon, 14 Sep 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,11 @@
 =============================================================================*/
 #ifndef BOOST_SPIRIT_INCLUDE_SUPPORT_ANY_IF
 #define BOOST_SPIRIT_INCLUDE_SUPPORT_ANY_IF
+
+#if defined(_MSC_VER)
+#pragma once
+#endif
+
 #include <boost/spirit/home/support/algorithm/any_if.hpp>
+
 #endif

Modified: branches/release/boost/spirit/include/support_any_ns.hpp
==============================================================================
--- branches/release/boost/spirit/include/support_any_ns.hpp (original)
+++ branches/release/boost/spirit/include/support_any_ns.hpp 2009-09-14 12:50:29 EDT (Mon, 14 Sep 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,11 @@
 =============================================================================*/
 #ifndef BOOST_SPIRIT_INCLUDE_SUPPORT_ANY_NS
 #define BOOST_SPIRIT_INCLUDE_SUPPORT_ANY_NS
+
+#if defined(_MSC_VER)
+#pragma once
+#endif
+
 #include <boost/spirit/home/support/algorithm/any_ns.hpp>
+
 #endif

Modified: branches/release/boost/spirit/include/support_argument.hpp
==============================================================================
--- branches/release/boost/spirit/include/support_argument.hpp (original)
+++ branches/release/boost/spirit/include/support_argument.hpp 2009-09-14 12:50:29 EDT (Mon, 14 Sep 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,11 @@
 =============================================================================*/
 #ifndef BOOST_SPIRIT_INCLUDE_SUPPORT_ARGUMENT
 #define BOOST_SPIRIT_INCLUDE_SUPPORT_ARGUMENT
+
+#if defined(_MSC_VER)
+#pragma once
+#endif
+
 #include <boost/spirit/home/support/argument.hpp>
+
 #endif

Deleted: branches/release/boost/spirit/include/support_as_variant.hpp
==============================================================================
--- branches/release/boost/spirit/include/support_as_variant.hpp 2009-09-14 12:50:29 EDT (Mon, 14 Sep 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: branches/release/boost/spirit/include/support_ascii.hpp
==============================================================================
--- branches/release/boost/spirit/include/support_ascii.hpp (original)
+++ branches/release/boost/spirit/include/support_ascii.hpp 2009-09-14 12:50:29 EDT (Mon, 14 Sep 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,11 @@
 =============================================================================*/
 #ifndef BOOST_SPIRIT_INCLUDE_SUPPORT_ASCII
 #define BOOST_SPIRIT_INCLUDE_SUPPORT_ASCII
-#include <boost/spirit/home/support/ascii.hpp>
+
+#if defined(_MSC_VER)
+#pragma once
+#endif
+
+#include <boost/spirit/home/support/char_encoding/ascii.hpp>
+
 #endif

Deleted: branches/release/boost/spirit/include/support_attribute_of.hpp
==============================================================================
--- branches/release/boost/spirit/include/support_attribute_of.hpp 2009-09-14 12:50:29 EDT (Mon, 14 Sep 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: branches/release/boost/spirit/include/support_attribute_transform.hpp
==============================================================================
--- branches/release/boost/spirit/include/support_attribute_transform.hpp 2009-09-14 12:50:29 EDT (Mon, 14 Sep 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: branches/release/boost/spirit/include/support_basic_rules.hpp
==============================================================================
--- branches/release/boost/spirit/include/support_basic_rules.hpp 2009-09-14 12:50:29 EDT (Mon, 14 Sep 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: branches/release/boost/spirit/include/support_basic_transforms.hpp
==============================================================================
--- branches/release/boost/spirit/include/support_basic_transforms.hpp 2009-09-14 12:50:29 EDT (Mon, 14 Sep 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: branches/release/boost/spirit/include/support_char_class.hpp
==============================================================================
--- branches/release/boost/spirit/include/support_char_class.hpp (original)
+++ branches/release/boost/spirit/include/support_char_class.hpp 2009-09-14 12:50:29 EDT (Mon, 14 Sep 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,11 @@
 =============================================================================*/
 #ifndef BOOST_SPIRIT_INCLUDE_SUPPORT_CHAR_CLASS
 #define BOOST_SPIRIT_INCLUDE_SUPPORT_CHAR_CLASS
+
+#if defined(_MSC_VER)
+#pragma once
+#endif
+
 #include <boost/spirit/home/support/char_class.hpp>
+
 #endif

Deleted: branches/release/boost/spirit/include/support_component.hpp
==============================================================================
--- branches/release/boost/spirit/include/support_component.hpp 2009-09-14 12:50:29 EDT (Mon, 14 Sep 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: branches/release/boost/spirit/include/support_functor_holder.hpp
==============================================================================
--- branches/release/boost/spirit/include/support_functor_holder.hpp 2009-09-14 12:50:29 EDT (Mon, 14 Sep 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: branches/release/boost/spirit/include/support_grammar.hpp
==============================================================================
--- branches/release/boost/spirit/include/support_grammar.hpp 2009-09-14 12:50:29 EDT (Mon, 14 Sep 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: branches/release/boost/spirit/include/support_iso8859_1.hpp
==============================================================================
--- branches/release/boost/spirit/include/support_iso8859_1.hpp (original)
+++ branches/release/boost/spirit/include/support_iso8859_1.hpp 2009-09-14 12:50:29 EDT (Mon, 14 Sep 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,11 @@
 =============================================================================*/
 #ifndef BOOST_SPIRIT_INCLUDE_SUPPORT_ISO8859_1
 #define BOOST_SPIRIT_INCLUDE_SUPPORT_ISO8859_1
-#include <boost/spirit/home/support/iso8859_1.hpp>
+
+#if defined(_MSC_VER)
+#pragma once
+#endif
+
+#include <boost/spirit/home/support/char_encoding/iso8859_1.hpp>
+
 #endif

Modified: branches/release/boost/spirit/include/support_locals.hpp
==============================================================================
--- branches/release/boost/spirit/include/support_locals.hpp (original)
+++ branches/release/boost/spirit/include/support_locals.hpp 2009-09-14 12:50:29 EDT (Mon, 14 Sep 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,11 @@
 =============================================================================*/
 #ifndef BOOST_SPIRIT_INCLUDE_SUPPORT_LOCALS
 #define BOOST_SPIRIT_INCLUDE_SUPPORT_LOCALS
+
+#if defined(_MSC_VER)
+#pragma once
+#endif
+
 #include <boost/spirit/home/support/nonterminal/locals.hpp>
+
 #endif

Modified: branches/release/boost/spirit/include/support_look_ahead.hpp
==============================================================================
--- branches/release/boost/spirit/include/support_look_ahead.hpp (original)
+++ branches/release/boost/spirit/include/support_look_ahead.hpp 2009-09-14 12:50:29 EDT (Mon, 14 Sep 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,11 @@
 =============================================================================*/
 #ifndef BOOST_SPIRIT_INCLUDE_SUPPORT_LOOK_AHEAD
 #define BOOST_SPIRIT_INCLUDE_SUPPORT_LOOK_AHEAD
+
+#if defined(_MSC_VER)
+#pragma once
+#endif
+
 #include <boost/spirit/home/support/iterators/look_ahead.hpp>
+
 #endif

Deleted: branches/release/boost/spirit/include/support_meta_function_holder.hpp
==============================================================================
--- branches/release/boost/spirit/include/support_meta_function_holder.hpp 2009-09-14 12:50:29 EDT (Mon, 14 Sep 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: branches/release/boost/spirit/include/support_meta_grammar.hpp
==============================================================================
--- branches/release/boost/spirit/include/support_meta_grammar.hpp 2009-09-14 12:50:29 EDT (Mon, 14 Sep 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: branches/release/boost/spirit/include/support_modifier.hpp
==============================================================================
--- branches/release/boost/spirit/include/support_modifier.hpp 2009-09-14 12:50:29 EDT (Mon, 14 Sep 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: branches/release/boost/spirit/include/support_multi_pass.hpp
==============================================================================
--- branches/release/boost/spirit/include/support_multi_pass.hpp (original)
+++ branches/release/boost/spirit/include/support_multi_pass.hpp 2009-09-14 12:50:29 EDT (Mon, 14 Sep 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,11 @@
 =============================================================================*/
 #ifndef BOOST_SPIRIT_INCLUDE_SUPPORT_MULTI_PASS
 #define BOOST_SPIRIT_INCLUDE_SUPPORT_MULTI_PASS
+
+#if defined(_MSC_VER)
+#pragma once
+#endif
+
 #include <boost/spirit/home/support/multi_pass.hpp>
+
 #endif

Modified: branches/release/boost/spirit/include/support_multi_pass_fwd.hpp
==============================================================================
--- branches/release/boost/spirit/include/support_multi_pass_fwd.hpp (original)
+++ branches/release/boost/spirit/include/support_multi_pass_fwd.hpp 2009-09-14 12:50:29 EDT (Mon, 14 Sep 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,11 @@
 =============================================================================*/
 #ifndef BOOST_SPIRIT_INCLUDE_SUPPORT_MULTI_PASS_FWD
 #define BOOST_SPIRIT_INCLUDE_SUPPORT_MULTI_PASS_FWD
+
+#if defined(_MSC_VER)
+#pragma once
+#endif
+
 #include <boost/spirit/home/support/iterators/multi_pass_fwd.hpp>
+
 #endif

Deleted: branches/release/boost/spirit/include/support_nonterminal.hpp
==============================================================================
--- branches/release/boost/spirit/include/support_nonterminal.hpp 2009-09-14 12:50:29 EDT (Mon, 14 Sep 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: branches/release/boost/spirit/include/support_placeholders.hpp
==============================================================================
--- branches/release/boost/spirit/include/support_placeholders.hpp 2009-09-14 12:50:29 EDT (Mon, 14 Sep 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: branches/release/boost/spirit/include/support_safe_bool.hpp
==============================================================================
--- branches/release/boost/spirit/include/support_safe_bool.hpp (original)
+++ branches/release/boost/spirit/include/support_safe_bool.hpp 2009-09-14 12:50:29 EDT (Mon, 14 Sep 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,11 @@
 =============================================================================*/
 #ifndef BOOST_SPIRIT_INCLUDE_SUPPORT_SAFE_BOOL
 #define BOOST_SPIRIT_INCLUDE_SUPPORT_SAFE_BOOL
+
+#if defined(_MSC_VER)
+#pragma once
+#endif
+
 #include <boost/spirit/home/support/safe_bool.hpp>
+
 #endif

Modified: branches/release/boost/spirit/include/support_standard.hpp
==============================================================================
--- branches/release/boost/spirit/include/support_standard.hpp (original)
+++ branches/release/boost/spirit/include/support_standard.hpp 2009-09-14 12:50:29 EDT (Mon, 14 Sep 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,11 @@
 =============================================================================*/
 #ifndef BOOST_SPIRIT_INCLUDE_SUPPORT_STANDARD
 #define BOOST_SPIRIT_INCLUDE_SUPPORT_STANDARD
-#include <boost/spirit/home/support/standard.hpp>
+
+#if defined(_MSC_VER)
+#pragma once
+#endif
+
+#include <boost/spirit/home/support/char_encoding/standard.hpp>
+
 #endif

Modified: branches/release/boost/spirit/include/support_standard_wide.hpp
==============================================================================
--- branches/release/boost/spirit/include/support_standard_wide.hpp (original)
+++ branches/release/boost/spirit/include/support_standard_wide.hpp 2009-09-14 12:50:29 EDT (Mon, 14 Sep 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,11 @@
 =============================================================================*/
 #ifndef BOOST_SPIRIT_INCLUDE_SUPPORT_STANDARD_WIDE
 #define BOOST_SPIRIT_INCLUDE_SUPPORT_STANDARD_WIDE
-#include <boost/spirit/home/support/standard_wide.hpp>
+
+#if defined(_MSC_VER)
+#pragma once
+#endif
+
+#include <boost/spirit/home/support/char_encoding/standard_wide.hpp>
+
 #endif

Modified: branches/release/boost/spirit/include/support_unused.hpp
==============================================================================
--- branches/release/boost/spirit/include/support_unused.hpp (original)
+++ branches/release/boost/spirit/include/support_unused.hpp 2009-09-14 12:50:29 EDT (Mon, 14 Sep 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,11 @@
 =============================================================================*/
 #ifndef BOOST_SPIRIT_INCLUDE_SUPPORT_UNUSED
 #define BOOST_SPIRIT_INCLUDE_SUPPORT_UNUSED
+
+#if defined(_MSC_VER)
+#pragma once
+#endif
+
 #include <boost/spirit/home/support/unused.hpp>
+
 #endif

Modified: branches/release/boost/spirit/version.hpp
==============================================================================
--- branches/release/boost/spirit/version.hpp (original)
+++ branches/release/boost/spirit/version.hpp 2009-09-14 12:50:29 EDT (Mon, 14 Sep 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


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