Boost logo

Boost-Commit :

Subject: [Boost-commit] svn:boost r56187 - in branches/release/libs/spirit: . benchmarks benchmarks/karma benchmarks/qi classic/doc classic/doc/theme classic/example/fundamental classic/example/fundamental/more_calculators doc doc/abstracts doc/karma doc/lex doc/notes doc/qi doc/qi_and_karma doc/reference doc/support example/karma example/lex example/lex/static_lexer example/qi example/qi/calc6 example/qi/calc7 example/qi/mini_c example/support phoenix/example phoenix/test/algorithm repository repository/doc repository/doc/html repository/doc/html/images repository/doc/html/images/callouts repository/doc/html/spirit_repository repository/doc/html/spirit_repository/karma_components repository/doc/html/spirit_repository/karma_components/directives repository/doc/html/spirit_repository/karma_components/nonterminal repository/doc/html/spirit_repository/qi_components repository/doc/html/spirit_repository/qi_components/directives repository/doc/html/spirit_repository/qi_components/nonterminal repository/doc/html/spirit_repository/qi_components/primitive repository/doc/karma repository/doc/qi repository/example repository/example/karma repository/example/qi repository/test repository/test/karma repository/test/qi repository/test/test_headers test test/karma test/lex test/qi test/support test/support/detail test/test_headers
From: hartmut.kaiser_at_[hidden]
Date: 2009-09-14 12:45:56


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

Log:
Spirit: merging V2.1 from trunk
Added:
   branches/release/libs/spirit/CMakeLists.txt
      - copied unchanged from r56184, /trunk/libs/spirit/CMakeLists.txt
   branches/release/libs/spirit/benchmarks/
      - copied from r56184, /trunk/libs/spirit/benchmarks/
   branches/release/libs/spirit/benchmarks/boiler_plate.cpp
      - copied unchanged from r56184, /trunk/libs/spirit/benchmarks/boiler_plate.cpp
   branches/release/libs/spirit/benchmarks/high_resolution_timer.hpp
      - copied unchanged from r56184, /trunk/libs/spirit/benchmarks/high_resolution_timer.hpp
   branches/release/libs/spirit/benchmarks/karma/
      - copied from r56184, /trunk/libs/spirit/benchmarks/karma/
   branches/release/libs/spirit/benchmarks/karma/CMakeLists.txt
      - copied unchanged from r56184, /trunk/libs/spirit/benchmarks/karma/CMakeLists.txt
   branches/release/libs/spirit/benchmarks/karma/Jamfile
      - copied unchanged from r56184, /trunk/libs/spirit/benchmarks/karma/Jamfile
   branches/release/libs/spirit/benchmarks/karma/double_performance.cpp
      - copied unchanged from r56184, /trunk/libs/spirit/benchmarks/karma/double_performance.cpp
   branches/release/libs/spirit/benchmarks/karma/format_performance.cpp
      - copied unchanged from r56184, /trunk/libs/spirit/benchmarks/karma/format_performance.cpp
   branches/release/libs/spirit/benchmarks/karma/int_generator.cpp
      - copied unchanged from r56184, /trunk/libs/spirit/benchmarks/karma/int_generator.cpp
   branches/release/libs/spirit/benchmarks/karma/real_generator.cpp
      - copied unchanged from r56184, /trunk/libs/spirit/benchmarks/karma/real_generator.cpp
   branches/release/libs/spirit/benchmarks/karma/sequence_performance.cpp
      - copied unchanged from r56184, /trunk/libs/spirit/benchmarks/karma/sequence_performance.cpp
   branches/release/libs/spirit/benchmarks/measure.hpp
      - copied unchanged from r56184, /trunk/libs/spirit/benchmarks/measure.hpp
   branches/release/libs/spirit/benchmarks/qi/ (props changed)
      - copied from r56184, /trunk/libs/spirit/benchmarks/qi/
   branches/release/libs/spirit/benchmarks/qi/int_parser.cpp
      - copied unchanged from r56184, /trunk/libs/spirit/benchmarks/qi/int_parser.cpp
   branches/release/libs/spirit/benchmarks/qi/real_parser.cpp
      - copied unchanged from r56184, /trunk/libs/spirit/benchmarks/qi/real_parser.cpp
   branches/release/libs/spirit/doc/abstracts/
      - copied from r56184, /trunk/libs/spirit/doc/abstracts/
   branches/release/libs/spirit/doc/abstracts.qbk
      - copied unchanged from r56184, /trunk/libs/spirit/doc/abstracts.qbk
   branches/release/libs/spirit/doc/abstracts/peg.qbk
      - copied unchanged from r56184, /trunk/libs/spirit/doc/abstracts/peg.qbk
   branches/release/libs/spirit/doc/abstracts/syntax_diagram.qbk
      - copied unchanged from r56184, /trunk/libs/spirit/doc/abstracts/syntax_diagram.qbk
   branches/release/libs/spirit/doc/karma/
      - copied from r56184, /trunk/libs/spirit/doc/karma/
   branches/release/libs/spirit/doc/karma.qbk
      - copied unchanged from r56184, /trunk/libs/spirit/doc/karma.qbk
   branches/release/libs/spirit/doc/karma/action.qbk
      - copied unchanged from r56184, /trunk/libs/spirit/doc/karma/action.qbk
   branches/release/libs/spirit/doc/karma/actions.qbk
      - copied unchanged from r56184, /trunk/libs/spirit/doc/karma/actions.qbk
   branches/release/libs/spirit/doc/karma/auxiliary.qbk
      - copied unchanged from r56184, /trunk/libs/spirit/doc/karma/auxiliary.qbk
   branches/release/libs/spirit/doc/karma/basics.qbk
      - copied unchanged from r56184, /trunk/libs/spirit/doc/karma/basics.qbk
   branches/release/libs/spirit/doc/karma/binary.qbk
      - copied unchanged from r56184, /trunk/libs/spirit/doc/karma/binary.qbk
   branches/release/libs/spirit/doc/karma/char.qbk
      - copied unchanged from r56184, /trunk/libs/spirit/doc/karma/char.qbk
   branches/release/libs/spirit/doc/karma/complex.qbk
      - copied unchanged from r56184, /trunk/libs/spirit/doc/karma/complex.qbk
   branches/release/libs/spirit/doc/karma/concepts.qbk
      - copied unchanged from r56184, /trunk/libs/spirit/doc/karma/concepts.qbk
   branches/release/libs/spirit/doc/karma/directive.qbk
      - copied unchanged from r56184, /trunk/libs/spirit/doc/karma/directive.qbk
   branches/release/libs/spirit/doc/karma/nonterminal.qbk
      - copied unchanged from r56184, /trunk/libs/spirit/doc/karma/nonterminal.qbk
   branches/release/libs/spirit/doc/karma/numeric.qbk
      - copied unchanged from r56184, /trunk/libs/spirit/doc/karma/numeric.qbk
   branches/release/libs/spirit/doc/karma/numeric_performance.qbk
      - copied unchanged from r56184, /trunk/libs/spirit/doc/karma/numeric_performance.qbk
   branches/release/libs/spirit/doc/karma/operator.qbk
      - copied unchanged from r56184, /trunk/libs/spirit/doc/karma/operator.qbk
   branches/release/libs/spirit/doc/karma/quick_reference.qbk
      - copied unchanged from r56184, /trunk/libs/spirit/doc/karma/quick_reference.qbk
   branches/release/libs/spirit/doc/karma/stream.qbk
      - copied unchanged from r56184, /trunk/libs/spirit/doc/karma/stream.qbk
   branches/release/libs/spirit/doc/karma/string.qbk
      - copied unchanged from r56184, /trunk/libs/spirit/doc/karma/string.qbk
   branches/release/libs/spirit/doc/karma/tutorial_intro.qbk
      - copied unchanged from r56184, /trunk/libs/spirit/doc/karma/tutorial_intro.qbk
   branches/release/libs/spirit/doc/karma/warming_up.qbk
      - copied unchanged from r56184, /trunk/libs/spirit/doc/karma/warming_up.qbk
   branches/release/libs/spirit/doc/karma_performance.xlsx
      - copied unchanged from r56184, /trunk/libs/spirit/doc/karma_performance.xlsx
   branches/release/libs/spirit/doc/lex/basics.qbk
      - copied unchanged from r56184, /trunk/libs/spirit/doc/lex/basics.qbk
   branches/release/libs/spirit/doc/lex/concepts.qbk
      - copied unchanged from r56184, /trunk/libs/spirit/doc/lex/concepts.qbk
   branches/release/libs/spirit/doc/lex/lexer.qbk
      - copied unchanged from r56184, /trunk/libs/spirit/doc/lex/lexer.qbk
   branches/release/libs/spirit/doc/lex/lexer_class.qbk
      - copied unchanged from r56184, /trunk/libs/spirit/doc/lex/lexer_class.qbk
   branches/release/libs/spirit/doc/lex/quick_reference.qbk
      - copied unchanged from r56184, /trunk/libs/spirit/doc/lex/quick_reference.qbk
   branches/release/libs/spirit/doc/lex/token.qbk
      - copied unchanged from r56184, /trunk/libs/spirit/doc/lex/token.qbk
   branches/release/libs/spirit/doc/lex/token_class.qbk
      - copied unchanged from r56184, /trunk/libs/spirit/doc/lex/token_class.qbk
   branches/release/libs/spirit/doc/lex/token_primitives.qbk
      - copied unchanged from r56184, /trunk/libs/spirit/doc/lex/token_primitives.qbk
   branches/release/libs/spirit/doc/lex/tokendef.qbk
      - copied unchanged from r56184, /trunk/libs/spirit/doc/lex/tokendef.qbk
   branches/release/libs/spirit/doc/lex/tokendef_class.qbk
      - copied unchanged from r56184, /trunk/libs/spirit/doc/lex/tokendef_class.qbk
   branches/release/libs/spirit/doc/notes/porting_from_1_8.qbk
      - copied unchanged from r56184, /trunk/libs/spirit/doc/notes/porting_from_1_8.qbk
   branches/release/libs/spirit/doc/qi/
      - copied from r56184, /trunk/libs/spirit/doc/qi/
   branches/release/libs/spirit/doc/qi.qbk
      - copied unchanged from r56184, /trunk/libs/spirit/doc/qi.qbk
   branches/release/libs/spirit/doc/qi/action.qbk
      - copied unchanged from r56184, /trunk/libs/spirit/doc/qi/action.qbk
   branches/release/libs/spirit/doc/qi/actions.qbk
      - copied unchanged from r56184, /trunk/libs/spirit/doc/qi/actions.qbk
   branches/release/libs/spirit/doc/qi/auxiliary.qbk
      - copied unchanged from r56184, /trunk/libs/spirit/doc/qi/auxiliary.qbk
   branches/release/libs/spirit/doc/qi/basics.qbk
      - copied unchanged from r56184, /trunk/libs/spirit/doc/qi/basics.qbk
   branches/release/libs/spirit/doc/qi/binary.qbk
      - copied unchanged from r56184, /trunk/libs/spirit/doc/qi/binary.qbk
   branches/release/libs/spirit/doc/qi/char.qbk
      - copied unchanged from r56184, /trunk/libs/spirit/doc/qi/char.qbk
   branches/release/libs/spirit/doc/qi/complex.qbk
      - copied unchanged from r56184, /trunk/libs/spirit/doc/qi/complex.qbk
   branches/release/libs/spirit/doc/qi/concepts.qbk
      - copied unchanged from r56184, /trunk/libs/spirit/doc/qi/concepts.qbk
   branches/release/libs/spirit/doc/qi/directive.qbk
      - copied unchanged from r56184, /trunk/libs/spirit/doc/qi/directive.qbk
   branches/release/libs/spirit/doc/qi/employee.qbk
      - copied unchanged from r56184, /trunk/libs/spirit/doc/qi/employee.qbk
   branches/release/libs/spirit/doc/qi/error_handling.qbk
      - copied unchanged from r56184, /trunk/libs/spirit/doc/qi/error_handling.qbk
   branches/release/libs/spirit/doc/qi/mini_xml.qbk
      - copied unchanged from r56184, /trunk/libs/spirit/doc/qi/mini_xml.qbk
   branches/release/libs/spirit/doc/qi/nonterminal.qbk
      - copied unchanged from r56184, /trunk/libs/spirit/doc/qi/nonterminal.qbk
   branches/release/libs/spirit/doc/qi/num_list2.qbk
      - copied unchanged from r56184, /trunk/libs/spirit/doc/qi/num_list2.qbk
   branches/release/libs/spirit/doc/qi/num_list3.qbk
      - copied unchanged from r56184, /trunk/libs/spirit/doc/qi/num_list3.qbk
   branches/release/libs/spirit/doc/qi/num_list4.qbk
      - copied unchanged from r56184, /trunk/libs/spirit/doc/qi/num_list4.qbk
   branches/release/libs/spirit/doc/qi/numeric.qbk
      - copied unchanged from r56184, /trunk/libs/spirit/doc/qi/numeric.qbk
   branches/release/libs/spirit/doc/qi/operator.qbk
      - copied unchanged from r56184, /trunk/libs/spirit/doc/qi/operator.qbk
   branches/release/libs/spirit/doc/qi/parser.qbk
      - copied unchanged from r56184, /trunk/libs/spirit/doc/qi/parser.qbk
   branches/release/libs/spirit/doc/qi/quick_reference.qbk
      - copied unchanged from r56184, /trunk/libs/spirit/doc/qi/quick_reference.qbk
   branches/release/libs/spirit/doc/qi/roman.qbk
      - copied unchanged from r56184, /trunk/libs/spirit/doc/qi/roman.qbk
   branches/release/libs/spirit/doc/qi/stream.qbk
      - copied unchanged from r56184, /trunk/libs/spirit/doc/qi/stream.qbk
   branches/release/libs/spirit/doc/qi/string.qbk
      - copied unchanged from r56184, /trunk/libs/spirit/doc/qi/string.qbk
   branches/release/libs/spirit/doc/qi/sum_tutorial.qbk
      - copied unchanged from r56184, /trunk/libs/spirit/doc/qi/sum_tutorial.qbk
   branches/release/libs/spirit/doc/qi/tutorial_intro.qbk
      - copied unchanged from r56184, /trunk/libs/spirit/doc/qi/tutorial_intro.qbk
   branches/release/libs/spirit/doc/qi/warming_up.qbk
      - copied unchanged from r56184, /trunk/libs/spirit/doc/qi/warming_up.qbk
   branches/release/libs/spirit/doc/repository.qbk
      - copied unchanged from r56184, /trunk/libs/spirit/doc/repository.qbk
   branches/release/libs/spirit/doc/structure.qbk
      - copied unchanged from r56184, /trunk/libs/spirit/doc/structure.qbk
   branches/release/libs/spirit/doc/support/
      - copied from r56184, /trunk/libs/spirit/doc/support/
   branches/release/libs/spirit/doc/support.qbk
      - copied unchanged from r56184, /trunk/libs/spirit/doc/support.qbk
   branches/release/libs/spirit/doc/support/multi_pass.qbk
      - copied unchanged from r56184, /trunk/libs/spirit/doc/support/multi_pass.qbk
   branches/release/libs/spirit/example/karma/CMakeLists.txt
      - copied unchanged from r56184, /trunk/libs/spirit/example/karma/CMakeLists.txt
   branches/release/libs/spirit/example/karma/calc2_ast_dump.cpp
      - copied unchanged from r56184, /trunk/libs/spirit/example/karma/calc2_ast_dump.cpp
   branches/release/libs/spirit/example/karma/calc2_ast_rpn.cpp
      - copied unchanged from r56184, /trunk/libs/spirit/example/karma/calc2_ast_rpn.cpp
   branches/release/libs/spirit/example/karma/classify_char.cpp
      - copied unchanged from r56184, /trunk/libs/spirit/example/karma/classify_char.cpp
   branches/release/libs/spirit/example/karma/complex_number.cpp
      - copied unchanged from r56184, /trunk/libs/spirit/example/karma/complex_number.cpp
   branches/release/libs/spirit/example/karma/complex_number_easier.cpp
      - copied unchanged from r56184, /trunk/libs/spirit/example/karma/complex_number_easier.cpp
   branches/release/libs/spirit/example/karma/key_value_sequence.cpp
      - copied unchanged from r56184, /trunk/libs/spirit/example/karma/key_value_sequence.cpp
   branches/release/libs/spirit/example/karma/num_list1.cpp
      - copied unchanged from r56184, /trunk/libs/spirit/example/karma/num_list1.cpp
   branches/release/libs/spirit/example/karma/printf_style_double_format.cpp
      - copied unchanged from r56184, /trunk/libs/spirit/example/karma/printf_style_double_format.cpp
   branches/release/libs/spirit/example/karma/reference.cpp
      - copied unchanged from r56184, /trunk/libs/spirit/example/karma/reference.cpp
   branches/release/libs/spirit/example/lex/CMakeLists.txt
      - copied unchanged from r56184, /trunk/libs/spirit/example/lex/CMakeLists.txt
   branches/release/libs/spirit/example/lex/reference.cpp
      - copied unchanged from r56184, /trunk/libs/spirit/example/lex/reference.cpp
   branches/release/libs/spirit/example/lex/static_lexer/word_count_lexer_generate.cpp
      - copied unchanged from r56184, /trunk/libs/spirit/example/lex/static_lexer/word_count_lexer_generate.cpp
   branches/release/libs/spirit/example/lex/static_lexer/word_count_lexer_static.cpp
      - copied unchanged from r56184, /trunk/libs/spirit/example/lex/static_lexer/word_count_lexer_static.cpp
   branches/release/libs/spirit/example/lex/static_lexer/word_count_lexer_static.hpp
      - copied unchanged from r56184, /trunk/libs/spirit/example/lex/static_lexer/word_count_lexer_static.hpp
   branches/release/libs/spirit/example/lex/static_lexer/word_count_lexer_tokens.hpp
      - copied unchanged from r56184, /trunk/libs/spirit/example/lex/static_lexer/word_count_lexer_tokens.hpp
   branches/release/libs/spirit/example/qi/CMakeLists.txt
      - copied unchanged from r56184, /trunk/libs/spirit/example/qi/CMakeLists.txt
   branches/release/libs/spirit/example/qi/calc4_debug.cpp
      - copied unchanged from r56184, /trunk/libs/spirit/example/qi/calc4_debug.cpp
   branches/release/libs/spirit/example/qi/porting_guide_classic.cpp
      - copied unchanged from r56184, /trunk/libs/spirit/example/qi/porting_guide_classic.cpp
   branches/release/libs/spirit/example/qi/porting_guide_qi.cpp
      - copied unchanged from r56184, /trunk/libs/spirit/example/qi/porting_guide_qi.cpp
   branches/release/libs/spirit/example/qi/reference.cpp
      - copied unchanged from r56184, /trunk/libs/spirit/example/qi/reference.cpp
   branches/release/libs/spirit/example/support/
      - copied from r56184, /trunk/libs/spirit/example/support/
   branches/release/libs/spirit/example/support/CMakeLists.txt
      - copied unchanged from r56184, /trunk/libs/spirit/example/support/CMakeLists.txt
   branches/release/libs/spirit/example/support/Jamfile
      - copied unchanged from r56184, /trunk/libs/spirit/example/support/Jamfile
   branches/release/libs/spirit/example/support/multi_pass.cpp
      - copied unchanged from r56184, /trunk/libs/spirit/example/support/multi_pass.cpp
   branches/release/libs/spirit/example/support/multi_pass.txt
      - copied unchanged from r56184, /trunk/libs/spirit/example/support/multi_pass.txt
   branches/release/libs/spirit/module.cmake
      - copied unchanged from r56184, /trunk/libs/spirit/module.cmake
   branches/release/libs/spirit/phoenix/example/CMakeLists.txt
      - copied unchanged from r56184, /trunk/libs/spirit/phoenix/example/CMakeLists.txt
   branches/release/libs/spirit/repository/ (props changed)
      - copied from r56184, /trunk/libs/spirit/repository/
   branches/release/libs/spirit/repository/doc/
      - copied from r56184, /trunk/libs/spirit/repository/doc/
   branches/release/libs/spirit/repository/doc/Jamfile
      - copied unchanged from r56184, /trunk/libs/spirit/repository/doc/Jamfile
   branches/release/libs/spirit/repository/doc/html/ (props changed)
      - copied from r56184, /trunk/libs/spirit/repository/doc/html/
   branches/release/libs/spirit/repository/doc/html/images/
      - copied from r56184, /trunk/libs/spirit/repository/doc/html/images/
   branches/release/libs/spirit/repository/doc/html/images/alert.png
      - copied unchanged from r56184, /trunk/libs/spirit/repository/doc/html/images/alert.png
   branches/release/libs/spirit/repository/doc/html/images/callouts/
      - copied from r56184, /trunk/libs/spirit/repository/doc/html/images/callouts/
   branches/release/libs/spirit/repository/doc/html/images/callouts/1.png
      - copied unchanged from r56184, /trunk/libs/spirit/repository/doc/html/images/callouts/1.png
   branches/release/libs/spirit/repository/doc/html/images/callouts/10.png
      - copied unchanged from r56184, /trunk/libs/spirit/repository/doc/html/images/callouts/10.png
   branches/release/libs/spirit/repository/doc/html/images/callouts/11.png
      - copied unchanged from r56184, /trunk/libs/spirit/repository/doc/html/images/callouts/11.png
   branches/release/libs/spirit/repository/doc/html/images/callouts/12.png
      - copied unchanged from r56184, /trunk/libs/spirit/repository/doc/html/images/callouts/12.png
   branches/release/libs/spirit/repository/doc/html/images/callouts/13.png
      - copied unchanged from r56184, /trunk/libs/spirit/repository/doc/html/images/callouts/13.png
   branches/release/libs/spirit/repository/doc/html/images/callouts/14.png
      - copied unchanged from r56184, /trunk/libs/spirit/repository/doc/html/images/callouts/14.png
   branches/release/libs/spirit/repository/doc/html/images/callouts/15.png
      - copied unchanged from r56184, /trunk/libs/spirit/repository/doc/html/images/callouts/15.png
   branches/release/libs/spirit/repository/doc/html/images/callouts/2.png
      - copied unchanged from r56184, /trunk/libs/spirit/repository/doc/html/images/callouts/2.png
   branches/release/libs/spirit/repository/doc/html/images/callouts/3.png
      - copied unchanged from r56184, /trunk/libs/spirit/repository/doc/html/images/callouts/3.png
   branches/release/libs/spirit/repository/doc/html/images/callouts/4.png
      - copied unchanged from r56184, /trunk/libs/spirit/repository/doc/html/images/callouts/4.png
   branches/release/libs/spirit/repository/doc/html/images/callouts/5.png
      - copied unchanged from r56184, /trunk/libs/spirit/repository/doc/html/images/callouts/5.png
   branches/release/libs/spirit/repository/doc/html/images/callouts/6.png
      - copied unchanged from r56184, /trunk/libs/spirit/repository/doc/html/images/callouts/6.png
   branches/release/libs/spirit/repository/doc/html/images/callouts/7.png
      - copied unchanged from r56184, /trunk/libs/spirit/repository/doc/html/images/callouts/7.png
   branches/release/libs/spirit/repository/doc/html/images/callouts/8.png
      - copied unchanged from r56184, /trunk/libs/spirit/repository/doc/html/images/callouts/8.png
   branches/release/libs/spirit/repository/doc/html/images/callouts/9.png
      - copied unchanged from r56184, /trunk/libs/spirit/repository/doc/html/images/callouts/9.png
   branches/release/libs/spirit/repository/doc/html/images/caution.png
      - copied unchanged from r56184, /trunk/libs/spirit/repository/doc/html/images/caution.png
   branches/release/libs/spirit/repository/doc/html/images/important.png
      - copied unchanged from r56184, /trunk/libs/spirit/repository/doc/html/images/important.png
   branches/release/libs/spirit/repository/doc/html/images/note.png
      - copied unchanged from r56184, /trunk/libs/spirit/repository/doc/html/images/note.png
   branches/release/libs/spirit/repository/doc/html/images/tip.png
      - copied unchanged from r56184, /trunk/libs/spirit/repository/doc/html/images/tip.png
   branches/release/libs/spirit/repository/doc/html/index.html
      - copied, changed from r56184, /trunk/libs/spirit/repository/doc/html/index.html
   branches/release/libs/spirit/repository/doc/html/spirit_repository/
      - copied from r56184, /trunk/libs/spirit/repository/doc/html/spirit_repository/
   branches/release/libs/spirit/repository/doc/html/spirit_repository/karma_components/
      - copied from r56184, /trunk/libs/spirit/repository/doc/html/spirit_repository/karma_components/
   branches/release/libs/spirit/repository/doc/html/spirit_repository/karma_components.html
      - copied unchanged from r56184, /trunk/libs/spirit/repository/doc/html/spirit_repository/karma_components.html
   branches/release/libs/spirit/repository/doc/html/spirit_repository/karma_components/directives/
      - copied from r56184, /trunk/libs/spirit/repository/doc/html/spirit_repository/karma_components/directives/
   branches/release/libs/spirit/repository/doc/html/spirit_repository/karma_components/directives.html
      - copied unchanged from r56184, /trunk/libs/spirit/repository/doc/html/spirit_repository/karma_components/directives.html
   branches/release/libs/spirit/repository/doc/html/spirit_repository/karma_components/directives/karma_confix_generator.html
      - copied, changed from r56184, /trunk/libs/spirit/repository/doc/html/spirit_repository/karma_components/directives/karma_confix_generator.html
   branches/release/libs/spirit/repository/doc/html/spirit_repository/karma_components/nonterminal/
      - copied from r56184, /trunk/libs/spirit/repository/doc/html/spirit_repository/karma_components/nonterminal/
   branches/release/libs/spirit/repository/doc/html/spirit_repository/karma_components/nonterminal.html
      - copied unchanged from r56184, /trunk/libs/spirit/repository/doc/html/spirit_repository/karma_components/nonterminal.html
   branches/release/libs/spirit/repository/doc/html/spirit_repository/karma_components/nonterminal/subrule.html
      - copied, changed from r56184, /trunk/libs/spirit/repository/doc/html/spirit_repository/karma_components/nonterminal/subrule.html
   branches/release/libs/spirit/repository/doc/html/spirit_repository/preface.html
      - copied, changed from r56184, /trunk/libs/spirit/repository/doc/html/spirit_repository/preface.html
   branches/release/libs/spirit/repository/doc/html/spirit_repository/qi_components/
      - copied from r56184, /trunk/libs/spirit/repository/doc/html/spirit_repository/qi_components/
   branches/release/libs/spirit/repository/doc/html/spirit_repository/qi_components.html
      - copied unchanged from r56184, /trunk/libs/spirit/repository/doc/html/spirit_repository/qi_components.html
   branches/release/libs/spirit/repository/doc/html/spirit_repository/qi_components/directives/
      - copied from r56184, /trunk/libs/spirit/repository/doc/html/spirit_repository/qi_components/directives/
   branches/release/libs/spirit/repository/doc/html/spirit_repository/qi_components/directives.html
      - copied unchanged from r56184, /trunk/libs/spirit/repository/doc/html/spirit_repository/qi_components/directives.html
   branches/release/libs/spirit/repository/doc/html/spirit_repository/qi_components/directives/confix.html
      - copied, changed from r56184, /trunk/libs/spirit/repository/doc/html/spirit_repository/qi_components/directives/confix.html
   branches/release/libs/spirit/repository/doc/html/spirit_repository/qi_components/directives/distinct.html
      - copied, changed from r56184, /trunk/libs/spirit/repository/doc/html/spirit_repository/qi_components/directives/distinct.html
   branches/release/libs/spirit/repository/doc/html/spirit_repository/qi_components/nonterminal/
      - copied from r56184, /trunk/libs/spirit/repository/doc/html/spirit_repository/qi_components/nonterminal/
   branches/release/libs/spirit/repository/doc/html/spirit_repository/qi_components/nonterminal.html
      - copied unchanged from r56184, /trunk/libs/spirit/repository/doc/html/spirit_repository/qi_components/nonterminal.html
   branches/release/libs/spirit/repository/doc/html/spirit_repository/qi_components/nonterminal/subrule.html
      - copied, changed from r56184, /trunk/libs/spirit/repository/doc/html/spirit_repository/qi_components/nonterminal/subrule.html
   branches/release/libs/spirit/repository/doc/html/spirit_repository/qi_components/primitive/
      - copied from r56184, /trunk/libs/spirit/repository/doc/html/spirit_repository/qi_components/primitive/
   branches/release/libs/spirit/repository/doc/html/spirit_repository/qi_components/primitive.html
      - copied unchanged from r56184, /trunk/libs/spirit/repository/doc/html/spirit_repository/qi_components/primitive.html
   branches/release/libs/spirit/repository/doc/html/spirit_repository/qi_components/primitive/flush_multi_pass.html
      - copied, changed from r56184, /trunk/libs/spirit/repository/doc/html/spirit_repository/qi_components/primitive/flush_multi_pass.html
   branches/release/libs/spirit/repository/doc/karma/
      - copied from r56184, /trunk/libs/spirit/repository/doc/karma/
   branches/release/libs/spirit/repository/doc/karma.qbk
      - copied unchanged from r56184, /trunk/libs/spirit/repository/doc/karma.qbk
   branches/release/libs/spirit/repository/doc/karma/compound_generators.qbk
      - copied unchanged from r56184, /trunk/libs/spirit/repository/doc/karma/compound_generators.qbk
   branches/release/libs/spirit/repository/doc/karma/confix.qbk
      - copied unchanged from r56184, /trunk/libs/spirit/repository/doc/karma/confix.qbk
   branches/release/libs/spirit/repository/doc/karma/directives.qbk
      - copied unchanged from r56184, /trunk/libs/spirit/repository/doc/karma/directives.qbk
   branches/release/libs/spirit/repository/doc/karma/nonterminals.qbk
      - copied unchanged from r56184, /trunk/libs/spirit/repository/doc/karma/nonterminals.qbk
   branches/release/libs/spirit/repository/doc/karma/primitive_generators.qbk
      - copied unchanged from r56184, /trunk/libs/spirit/repository/doc/karma/primitive_generators.qbk
   branches/release/libs/spirit/repository/doc/karma/subrule.qbk
      - copied unchanged from r56184, /trunk/libs/spirit/repository/doc/karma/subrule.qbk
   branches/release/libs/spirit/repository/doc/preface.qbk
      - copied unchanged from r56184, /trunk/libs/spirit/repository/doc/preface.qbk
   branches/release/libs/spirit/repository/doc/qi/
      - copied from r56184, /trunk/libs/spirit/repository/doc/qi/
   branches/release/libs/spirit/repository/doc/qi.qbk
      - copied unchanged from r56184, /trunk/libs/spirit/repository/doc/qi.qbk
   branches/release/libs/spirit/repository/doc/qi/compound_parsers.qbk
      - copied unchanged from r56184, /trunk/libs/spirit/repository/doc/qi/compound_parsers.qbk
   branches/release/libs/spirit/repository/doc/qi/confix.qbk
      - copied unchanged from r56184, /trunk/libs/spirit/repository/doc/qi/confix.qbk
   branches/release/libs/spirit/repository/doc/qi/directives.qbk
      - copied unchanged from r56184, /trunk/libs/spirit/repository/doc/qi/directives.qbk
   branches/release/libs/spirit/repository/doc/qi/distinct.qbk
      - copied unchanged from r56184, /trunk/libs/spirit/repository/doc/qi/distinct.qbk
   branches/release/libs/spirit/repository/doc/qi/flush_multi_pass.qbk
      - copied unchanged from r56184, /trunk/libs/spirit/repository/doc/qi/flush_multi_pass.qbk
   branches/release/libs/spirit/repository/doc/qi/nonterminals.qbk
      - copied unchanged from r56184, /trunk/libs/spirit/repository/doc/qi/nonterminals.qbk
   branches/release/libs/spirit/repository/doc/qi/primitive_parsers.qbk
      - copied unchanged from r56184, /trunk/libs/spirit/repository/doc/qi/primitive_parsers.qbk
   branches/release/libs/spirit/repository/doc/qi/subrule.qbk
      - copied unchanged from r56184, /trunk/libs/spirit/repository/doc/qi/subrule.qbk
   branches/release/libs/spirit/repository/doc/repository_template.qbk
      - copied unchanged from r56184, /trunk/libs/spirit/repository/doc/repository_template.qbk
   branches/release/libs/spirit/repository/doc/spirit2_repository.qbk
      - copied unchanged from r56184, /trunk/libs/spirit/repository/doc/spirit2_repository.qbk
   branches/release/libs/spirit/repository/example/
      - copied from r56184, /trunk/libs/spirit/repository/example/
   branches/release/libs/spirit/repository/example/karma/
      - copied from r56184, /trunk/libs/spirit/repository/example/karma/
   branches/release/libs/spirit/repository/example/karma/Jamfile
      - copied unchanged from r56184, /trunk/libs/spirit/repository/example/karma/Jamfile
   branches/release/libs/spirit/repository/example/karma/calc2_ast.hpp
      - copied unchanged from r56184, /trunk/libs/spirit/repository/example/karma/calc2_ast.hpp
   branches/release/libs/spirit/repository/example/karma/calc2_ast_dump_sr.cpp
      - copied unchanged from r56184, /trunk/libs/spirit/repository/example/karma/calc2_ast_dump_sr.cpp
   branches/release/libs/spirit/repository/example/karma/confix.cpp
      - copied unchanged from r56184, /trunk/libs/spirit/repository/example/karma/confix.cpp
   branches/release/libs/spirit/repository/example/karma/mini_xml_karma_sr.cpp
      - copied unchanged from r56184, /trunk/libs/spirit/repository/example/karma/mini_xml_karma_sr.cpp
   branches/release/libs/spirit/repository/example/qi/
      - copied from r56184, /trunk/libs/spirit/repository/example/qi/
   branches/release/libs/spirit/repository/example/qi/Jamfile
      - copied unchanged from r56184, /trunk/libs/spirit/repository/example/qi/Jamfile
   branches/release/libs/spirit/repository/example/qi/calc1_sr.cpp
      - copied unchanged from r56184, /trunk/libs/spirit/repository/example/qi/calc1_sr.cpp
   branches/release/libs/spirit/repository/example/qi/confix.cpp
      - copied unchanged from r56184, /trunk/libs/spirit/repository/example/qi/confix.cpp
   branches/release/libs/spirit/repository/example/qi/distinct.cpp
      - copied unchanged from r56184, /trunk/libs/spirit/repository/example/qi/distinct.cpp
   branches/release/libs/spirit/repository/example/qi/flush_multi_pass.cpp
      - copied unchanged from r56184, /trunk/libs/spirit/repository/example/qi/flush_multi_pass.cpp
   branches/release/libs/spirit/repository/example/qi/flush_multi_pass.txt
      - copied unchanged from r56184, /trunk/libs/spirit/repository/example/qi/flush_multi_pass.txt
   branches/release/libs/spirit/repository/example/qi/mini_xml2_sr.cpp
      - copied unchanged from r56184, /trunk/libs/spirit/repository/example/qi/mini_xml2_sr.cpp
   branches/release/libs/spirit/repository/test/
      - copied from r56184, /trunk/libs/spirit/repository/test/
   branches/release/libs/spirit/repository/test/CMakeLists.txt
      - copied unchanged from r56184, /trunk/libs/spirit/repository/test/CMakeLists.txt
   branches/release/libs/spirit/repository/test/Jamfile
      - copied unchanged from r56184, /trunk/libs/spirit/repository/test/Jamfile
   branches/release/libs/spirit/repository/test/karma/
      - copied from r56184, /trunk/libs/spirit/repository/test/karma/
   branches/release/libs/spirit/repository/test/karma/confix.cpp
      - copied unchanged from r56184, /trunk/libs/spirit/repository/test/karma/confix.cpp
   branches/release/libs/spirit/repository/test/karma/subrule.cpp
      - copied unchanged from r56184, /trunk/libs/spirit/repository/test/karma/subrule.cpp
   branches/release/libs/spirit/repository/test/karma/test.hpp
      - copied unchanged from r56184, /trunk/libs/spirit/repository/test/karma/test.hpp
   branches/release/libs/spirit/repository/test/qi/
      - copied from r56184, /trunk/libs/spirit/repository/test/qi/
   branches/release/libs/spirit/repository/test/qi/confix.cpp
      - copied unchanged from r56184, /trunk/libs/spirit/repository/test/qi/confix.cpp
   branches/release/libs/spirit/repository/test/qi/distinct.cpp
      - copied unchanged from r56184, /trunk/libs/spirit/repository/test/qi/distinct.cpp
   branches/release/libs/spirit/repository/test/qi/subrule.cpp
      - copied unchanged from r56184, /trunk/libs/spirit/repository/test/qi/subrule.cpp
   branches/release/libs/spirit/repository/test/qi/test.hpp
      - copied unchanged from r56184, /trunk/libs/spirit/repository/test/qi/test.hpp
   branches/release/libs/spirit/repository/test/test_headers/
      - copied from r56184, /trunk/libs/spirit/repository/test/test_headers/
   branches/release/libs/spirit/repository/test/test_headers/Jamfile
      - copied unchanged from r56184, /trunk/libs/spirit/repository/test/test_headers/Jamfile
   branches/release/libs/spirit/repository/test/test_headers/main.cpp
      - copied unchanged from r56184, /trunk/libs/spirit/repository/test/test_headers/main.cpp
   branches/release/libs/spirit/repository/test/test_headers/test.cpp
      - copied unchanged from r56184, /trunk/libs/spirit/repository/test/test_headers/test.cpp
   branches/release/libs/spirit/test/CMakeLists.txt
      - copied unchanged from r56184, /trunk/libs/spirit/test/CMakeLists.txt
   branches/release/libs/spirit/test/karma/and_predicate.cpp
      - copied unchanged from r56184, /trunk/libs/spirit/test/karma/and_predicate.cpp
   branches/release/libs/spirit/test/karma/buffer.cpp
      - copied unchanged from r56184, /trunk/libs/spirit/test/karma/buffer.cpp
   branches/release/libs/spirit/test/karma/char_class.cpp
      - copied unchanged from r56184, /trunk/libs/spirit/test/karma/char_class.cpp
   branches/release/libs/spirit/test/karma/format_manip_attr.cpp
      - copied unchanged from r56184, /trunk/libs/spirit/test/karma/format_manip_attr.cpp
   branches/release/libs/spirit/test/karma/format_pointer_container.cpp
      - copied unchanged from r56184, /trunk/libs/spirit/test/karma/format_pointer_container.cpp
   branches/release/libs/spirit/test/karma/generate_attr.cpp
      - copied unchanged from r56184, /trunk/libs/spirit/test/karma/generate_attr.cpp
   branches/release/libs/spirit/test/karma/maxwidth.cpp
      - copied unchanged from r56184, /trunk/libs/spirit/test/karma/maxwidth.cpp
   branches/release/libs/spirit/test/karma/not_predicate.cpp
      - copied unchanged from r56184, /trunk/libs/spirit/test/karma/not_predicate.cpp
   branches/release/libs/spirit/test/karma/omit.cpp
      - copied unchanged from r56184, /trunk/libs/spirit/test/karma/omit.cpp
   branches/release/libs/spirit/test/karma/plus.cpp
      - copied unchanged from r56184, /trunk/libs/spirit/test/karma/plus.cpp
   branches/release/libs/spirit/test/karma/repeat.cpp
      - copied unchanged from r56184, /trunk/libs/spirit/test/karma/repeat.cpp
   branches/release/libs/spirit/test/karma/stream.cpp
      - copied unchanged from r56184, /trunk/libs/spirit/test/karma/stream.cpp
   branches/release/libs/spirit/test/karma/test_attr.hpp
      - copied unchanged from r56184, /trunk/libs/spirit/test/karma/test_attr.hpp
   branches/release/libs/spirit/test/karma/test_manip_attr.hpp
      - copied unchanged from r56184, /trunk/libs/spirit/test/karma/test_manip_attr.hpp
   branches/release/libs/spirit/test/karma/tricky_alignment.cpp
      - copied unchanged from r56184, /trunk/libs/spirit/test/karma/tricky_alignment.cpp
   branches/release/libs/spirit/test/lex/dedent_handling_phoenix.cpp
      - copied unchanged from r56184, /trunk/libs/spirit/test/lex/dedent_handling_phoenix.cpp
   branches/release/libs/spirit/test/lex/lexer_state_switcher.cpp
      - copied unchanged from r56184, /trunk/libs/spirit/test/lex/lexer_state_switcher.cpp
   branches/release/libs/spirit/test/lex/matlib.h
      - copied unchanged from r56184, /trunk/libs/spirit/test/lex/matlib.h
   branches/release/libs/spirit/test/lex/regression001.cpp
      - copied unchanged from r56184, /trunk/libs/spirit/test/lex/regression001.cpp
   branches/release/libs/spirit/test/lex/regression002.cpp
      - copied unchanged from r56184, /trunk/libs/spirit/test/lex/regression002.cpp
   branches/release/libs/spirit/test/lex/regression003.cpp
      - copied unchanged from r56184, /trunk/libs/spirit/test/lex/regression003.cpp
   branches/release/libs/spirit/test/lex/regression003_generate.cpp
      - copied unchanged from r56184, /trunk/libs/spirit/test/lex/regression003_generate.cpp
   branches/release/libs/spirit/test/lex/set_token_value.cpp
      - copied unchanged from r56184, /trunk/libs/spirit/test/lex/set_token_value.cpp
   branches/release/libs/spirit/test/lex/set_token_value_phoenix.cpp
      - copied unchanged from r56184, /trunk/libs/spirit/test/lex/set_token_value_phoenix.cpp
   branches/release/libs/spirit/test/qi/attr.cpp
      - copied unchanged from r56184, /trunk/libs/spirit/test/qi/attr.cpp
   branches/release/libs/spirit/test/qi/match_manip_attr.cpp
      - copied unchanged from r56184, /trunk/libs/spirit/test/qi/match_manip_attr.cpp
   branches/release/libs/spirit/test/qi/omit.cpp
      - copied unchanged from r56184, /trunk/libs/spirit/test/qi/omit.cpp
   branches/release/libs/spirit/test/qi/parse_attr.cpp
      - copied unchanged from r56184, /trunk/libs/spirit/test/qi/parse_attr.cpp
   branches/release/libs/spirit/test/qi/repeat.cpp
      - copied unchanged from r56184, /trunk/libs/spirit/test/qi/repeat.cpp
   branches/release/libs/spirit/test/qi/skip.cpp
      - copied unchanged from r56184, /trunk/libs/spirit/test/qi/skip.cpp
   branches/release/libs/spirit/test/qi/terminal_ex.cpp
      - copied unchanged from r56184, /trunk/libs/spirit/test/qi/terminal_ex.cpp
   branches/release/libs/spirit/test/qi/test_attr.hpp
      - copied unchanged from r56184, /trunk/libs/spirit/test/qi/test_attr.hpp
   branches/release/libs/spirit/test/qi/test_manip_attr.hpp
      - copied unchanged from r56184, /trunk/libs/spirit/test/qi/test_manip_attr.hpp
   branches/release/libs/spirit/test/test_headers/
      - copied from r56184, /trunk/libs/spirit/test/test_headers/
   branches/release/libs/spirit/test/test_headers/Jamfile
      - copied unchanged from r56184, /trunk/libs/spirit/test/test_headers/Jamfile
   branches/release/libs/spirit/test/test_headers/main.cpp
      - copied unchanged from r56184, /trunk/libs/spirit/test/test_headers/main.cpp
   branches/release/libs/spirit/test/test_headers/test.cpp
      - copied unchanged from r56184, /trunk/libs/spirit/test/test_headers/test.cpp
Removed:
   branches/release/libs/spirit/doc/qi_and_karma/
   branches/release/libs/spirit/doc/qi_and_karma.qbk
   branches/release/libs/spirit/doc/reference/
   branches/release/libs/spirit/example/karma/functor_facilities.cpp
   branches/release/libs/spirit/example/qi/calc3_lexer.cpp
   branches/release/libs/spirit/test/karma/confix.cpp
   branches/release/libs/spirit/test/karma/none.cpp
   branches/release/libs/spirit/test/qi/confix.cpp
   branches/release/libs/spirit/test/qi/functor.cpp
   branches/release/libs/spirit/test/qi/none.cpp
   branches/release/libs/spirit/test/support/detail/
   branches/release/libs/spirit/test/support/hold_any.cpp
   branches/release/libs/spirit/test/support/multi_pass.cpp
   branches/release/libs/spirit/test/support/multi_pass_compile.cpp
Properties modified:
   branches/release/libs/spirit/ (props changed)
   branches/release/libs/spirit/classic/doc/theme/ (props changed)
Text files modified:
   branches/release/libs/spirit/classic/doc/dynamic_parsers.html | 68 ++++----
   branches/release/libs/spirit/classic/doc/primitives.html | 131 ++++++----------
   branches/release/libs/spirit/classic/example/fundamental/comments.cpp | 8
   branches/release/libs/spirit/classic/example/fundamental/more_calculators/calc_with_variables.cpp | 2
   branches/release/libs/spirit/doc/Jamfile | 15 +
   branches/release/libs/spirit/doc/acknowledgments.qbk | 2
   branches/release/libs/spirit/doc/concepts_template.qbk | 34 ++-
   branches/release/libs/spirit/doc/faq.qbk | 165 ++++++++++++++++++++
   branches/release/libs/spirit/doc/introduction.qbk | 63 ++++---
   branches/release/libs/spirit/doc/lex.qbk | 24 +-
   branches/release/libs/spirit/doc/lex/introduction.qbk | 4
   branches/release/libs/spirit/doc/lex/lexer_attributes.qbk | 2
   branches/release/libs/spirit/doc/lex/lexer_primitives.qbk | 4
   branches/release/libs/spirit/doc/lex/lexer_quickstart1.qbk | 10
   branches/release/libs/spirit/doc/lex/lexer_quickstart2.qbk | 72 ++------
   branches/release/libs/spirit/doc/lex/lexer_quickstart3.qbk | 20 -
   branches/release/libs/spirit/doc/lex/lexer_semantic_actions.qbk | 174 +++++++++++++++++++++
   branches/release/libs/spirit/doc/lex/lexer_states.qbk | 2
   branches/release/libs/spirit/doc/lex/lexer_static_model.qbk | 24 ++
   branches/release/libs/spirit/doc/lex/lexer_tutorials.qbk | 4
   branches/release/libs/spirit/doc/lex/parsing_using_a_lexer.qbk | 2
   branches/release/libs/spirit/doc/lex/token_definition.qbk | 2
   branches/release/libs/spirit/doc/lex/tokenizing.qbk | 87 ++++++++++
   branches/release/libs/spirit/doc/lex/tokens_values.qbk | 21 +-
   branches/release/libs/spirit/doc/notes.qbk | 18 -
   branches/release/libs/spirit/doc/notes/style_guide.qbk | 14 +
   branches/release/libs/spirit/doc/preface.qbk | 261 +++++++++++++++-----------------
   branches/release/libs/spirit/doc/rationale.qbk | 2
   branches/release/libs/spirit/doc/reference_template.qbk | 55 ++++--
   branches/release/libs/spirit/doc/references.qbk | 2
   branches/release/libs/spirit/doc/spirit2.qbk | 284 +++++++++++++++++++++++++++++++----
   branches/release/libs/spirit/doc/what_s_new.qbk | 170 ++++++++++++++++++---
   branches/release/libs/spirit/example/karma/Jamfile | 24 +-
   branches/release/libs/spirit/example/karma/actions.cpp | 106 +++++++++---
   branches/release/libs/spirit/example/karma/basic_facilities.cpp | 90 +++++++----
   branches/release/libs/spirit/example/karma/calc2_ast.hpp | 101 +++---------
   branches/release/libs/spirit/example/karma/calc2_ast_vm.cpp | 64 ++++---
   branches/release/libs/spirit/example/karma/calc2_ast_vm.hpp | 97 +++--------
   branches/release/libs/spirit/example/karma/mini_xml_karma.cpp | 32 ++-
   branches/release/libs/spirit/example/karma/quick_start1.cpp | 16 +-
   branches/release/libs/spirit/example/lex/Jamfile | 29 +-
   branches/release/libs/spirit/example/lex/example1.cpp | 51 +++---
   branches/release/libs/spirit/example/lex/example2.cpp | 51 +++---
   branches/release/libs/spirit/example/lex/example3.cpp | 52 ++---
   branches/release/libs/spirit/example/lex/example4.cpp | 98 +++++------
   branches/release/libs/spirit/example/lex/example5.cpp | 138 ++++++++---------
   branches/release/libs/spirit/example/lex/example6.cpp | 110 ++++++-------
   branches/release/libs/spirit/example/lex/print_numbers.cpp | 44 ++--
   branches/release/libs/spirit/example/lex/static_lexer/Jamfile | 6
   branches/release/libs/spirit/example/lex/static_lexer/word_count_generate.cpp | 15 +
   branches/release/libs/spirit/example/lex/static_lexer/word_count_static.cpp | 45 +++--
   branches/release/libs/spirit/example/lex/static_lexer/word_count_static.hpp | 97 ++++++++---
   branches/release/libs/spirit/example/lex/static_lexer/word_count_tokens.hpp | 11
   branches/release/libs/spirit/example/lex/strip_comments.cpp | 43 ++--
   branches/release/libs/spirit/example/lex/strip_comments.input | 82 ++++++----
   branches/release/libs/spirit/example/lex/strip_comments_lexer.cpp | 96 +++++++++--
   branches/release/libs/spirit/example/lex/word_count.cpp | 60 +++----
   branches/release/libs/spirit/example/lex/word_count_functor.cpp | 26 +-
   branches/release/libs/spirit/example/lex/word_count_lexer.cpp | 91 ++++++----
   branches/release/libs/spirit/example/qi/Jamfile | 7
   branches/release/libs/spirit/example/qi/actions.cpp | 58 ++++---
   branches/release/libs/spirit/example/qi/calc1.cpp | 75 +++++----
   branches/release/libs/spirit/example/qi/calc2.cpp | 97 ++++++-----
   branches/release/libs/spirit/example/qi/calc2_ast.cpp | 296 +++++++++++++++++++++---------------
   branches/release/libs/spirit/example/qi/calc3.cpp | 80 +++++----
   branches/release/libs/spirit/example/qi/calc4.cpp | 121 ++++++++-------
   branches/release/libs/spirit/example/qi/calc5.cpp | 305 +++++++++++++++++++------------------
   branches/release/libs/spirit/example/qi/calc6/calc6.cpp | 4
   branches/release/libs/spirit/example/qi/calc6/calc6.hpp | 40 ++--
   branches/release/libs/spirit/example/qi/calc6/calc6a.cpp | 2
   branches/release/libs/spirit/example/qi/calc6/calc6b.cpp | 4
   branches/release/libs/spirit/example/qi/calc6/calc6b.hpp | 11 +
   branches/release/libs/spirit/example/qi/calc6/calc6c.cpp | 2
   branches/release/libs/spirit/example/qi/calc6/calc6c.hpp | 15 +
   branches/release/libs/spirit/example/qi/calc7/calc7.cpp | 4
   branches/release/libs/spirit/example/qi/calc7/calc7.hpp | 44 ++--
   branches/release/libs/spirit/example/qi/calc7/calc7a.cpp | 2
   branches/release/libs/spirit/example/qi/calc7/calc7b.cpp | 4
   branches/release/libs/spirit/example/qi/calc7/calc7b.hpp | 12 +
   branches/release/libs/spirit/example/qi/calc7/calc7c.cpp | 2
   branches/release/libs/spirit/example/qi/calc7/calc7c.hpp | 13 +
   branches/release/libs/spirit/example/qi/complex_number.cpp | 59 +++---
   branches/release/libs/spirit/example/qi/employee.cpp | 104 +++++++-----
   branches/release/libs/spirit/example/qi/mini_c/mini_c.cpp | 4
   branches/release/libs/spirit/example/qi/mini_c/mini_c.hpp | 45 ++--
   branches/release/libs/spirit/example/qi/mini_c/mini_ca.cpp | 2
   branches/release/libs/spirit/example/qi/mini_c/mini_cb.cpp | 2
   branches/release/libs/spirit/example/qi/mini_c/mini_cb.hpp | 6
   branches/release/libs/spirit/example/qi/mini_c/mini_cc.cpp | 2
   branches/release/libs/spirit/example/qi/mini_c/mini_cc.hpp | 6
   branches/release/libs/spirit/example/qi/mini_c/mini_cd.cpp | 2
   branches/release/libs/spirit/example/qi/mini_c/mini_cd.hpp | 20 +-
   branches/release/libs/spirit/example/qi/mini_xml1.cpp | 276 ++++++++++++++++++----------------
   branches/release/libs/spirit/example/qi/mini_xml2.cpp | 273 +++++++++++++++++----------------
   branches/release/libs/spirit/example/qi/mini_xml3.cpp | 316 ++++++++++++++++++++-------------------
   branches/release/libs/spirit/example/qi/num_list1.cpp | 52 +++---
   branches/release/libs/spirit/example/qi/num_list2.cpp | 68 ++++---
   branches/release/libs/spirit/example/qi/num_list3.cpp | 66 ++++---
   branches/release/libs/spirit/example/qi/num_list4.cpp | 61 ++++---
   branches/release/libs/spirit/example/qi/roman.cpp | 200 +++++++++++++------------
   branches/release/libs/spirit/example/qi/sum.cpp | 68 ++++---
   branches/release/libs/spirit/index.html | 8
   branches/release/libs/spirit/phoenix/test/algorithm/querying.cpp | 29 +++
   branches/release/libs/spirit/repository/doc/html/index.html | 4
   branches/release/libs/spirit/repository/doc/html/spirit_repository/karma_components/directives/karma_confix_generator.html | 18 +-
   branches/release/libs/spirit/repository/doc/html/spirit_repository/karma_components/nonterminal/subrule.html | 24 +-
   branches/release/libs/spirit/repository/doc/html/spirit_repository/preface.html | 8
   branches/release/libs/spirit/repository/doc/html/spirit_repository/qi_components/directives/confix.html | 18 +-
   branches/release/libs/spirit/repository/doc/html/spirit_repository/qi_components/directives/distinct.html | 16 +-
   branches/release/libs/spirit/repository/doc/html/spirit_repository/qi_components/nonterminal/subrule.html | 26 +-
   branches/release/libs/spirit/repository/doc/html/spirit_repository/qi_components/primitive/flush_multi_pass.html | 16 +-
   branches/release/libs/spirit/test/Jamfile | 72 +++++---
   branches/release/libs/spirit/test/karma/actions.cpp | 73 +++++++-
   branches/release/libs/spirit/test/karma/alternative.cpp | 151 +++++++++++-------
   branches/release/libs/spirit/test/karma/binary.cpp | 22 +-
   branches/release/libs/spirit/test/karma/case_handling.cpp | 186 +++++++++++++++++------
   branches/release/libs/spirit/test/karma/center_alignment.cpp | 25 +-
   branches/release/libs/spirit/test/karma/char.cpp | 250 ++++++++++++++++++++++---------
   branches/release/libs/spirit/test/karma/delimiter.cpp | 16 +
   branches/release/libs/spirit/test/karma/eps.cpp | 33 +++
   branches/release/libs/spirit/test/karma/format_manip.cpp | 55 ++----
   branches/release/libs/spirit/test/karma/grammar.cpp | 4
   branches/release/libs/spirit/test/karma/grammar_fail.cpp | 23 +-
   branches/release/libs/spirit/test/karma/int_numerics.cpp | 117 ++++++++++----
   branches/release/libs/spirit/test/karma/kleene.cpp | 79 +++------
   branches/release/libs/spirit/test/karma/lazy.cpp | 30 +-
   branches/release/libs/spirit/test/karma/left_alignment.cpp | 16 +-
   branches/release/libs/spirit/test/karma/list.cpp | 6
   branches/release/libs/spirit/test/karma/lit.cpp | 111 ++++++++-----
   branches/release/libs/spirit/test/karma/optional.cpp | 12 -
   branches/release/libs/spirit/test/karma/pattern.cpp | 133 ++++++++++------
   branches/release/libs/spirit/test/karma/pattern2.cpp | 102 ++++++++++++
   branches/release/libs/spirit/test/karma/real_numerics.cpp | 205 +++++++++++++++++--------
   branches/release/libs/spirit/test/karma/right_alignment.cpp | 12
   branches/release/libs/spirit/test/karma/rule_fail.cpp | 19 +-
   branches/release/libs/spirit/test/karma/sequence.cpp | 59 ++++--
   branches/release/libs/spirit/test/karma/test.hpp | 85 +++++++---
   branches/release/libs/spirit/test/lex/lexertl1.cpp | 47 ++---
   branches/release/libs/spirit/test/lex/lexertl2.cpp | 67 +++----
   branches/release/libs/spirit/test/lex/lexertl3.cpp | 47 ++---
   branches/release/libs/spirit/test/lex/lexertl4.cpp | 49 ++---
   branches/release/libs/spirit/test/lex/lexertl5.cpp | 55 +++---
   branches/release/libs/spirit/test/lex/state_switcher_test.cpp | 85 +++++-----
   branches/release/libs/spirit/test/lex/test.hpp | 22 +-
   branches/release/libs/spirit/test/lex/test_parser.hpp | 26 +--
   branches/release/libs/spirit/test/qi/actions.cpp | 28 ++-
   branches/release/libs/spirit/test/qi/alternative.cpp | 141 +++++++++++++++--
   branches/release/libs/spirit/test/qi/and_predicate.cpp | 4
   branches/release/libs/spirit/test/qi/binary.cpp | 43 +++--
   branches/release/libs/spirit/test/qi/char.cpp | 144 ++++++++++++-----
   branches/release/libs/spirit/test/qi/char_class.cpp | 45 ++++-
   branches/release/libs/spirit/test/qi/debug.cpp | 179 +++------------------
   branches/release/libs/spirit/test/qi/difference.cpp | 17 +-
   branches/release/libs/spirit/test/qi/end.cpp | 67 +++----
   branches/release/libs/spirit/test/qi/eps.cpp | 19 +
   branches/release/libs/spirit/test/qi/expect.cpp | 33 ++-
   branches/release/libs/spirit/test/qi/grammar.cpp | 20 +
   branches/release/libs/spirit/test/qi/int.cpp | 73 ++++++++-
   branches/release/libs/spirit/test/qi/kleene.cpp | 57 ++++---
   branches/release/libs/spirit/test/qi/lazy.cpp | 33 +++-
   branches/release/libs/spirit/test/qi/lexeme.cpp | 11
   branches/release/libs/spirit/test/qi/list.cpp | 71 ++++++++
   branches/release/libs/spirit/test/qi/lit.cpp | 59 ++++--
   branches/release/libs/spirit/test/qi/match_manip.cpp | 108 ++++++------
   branches/release/libs/spirit/test/qi/no_case.cpp | 85 +++++++++
   branches/release/libs/spirit/test/qi/not_predicate.cpp | 5
   branches/release/libs/spirit/test/qi/optional.cpp | 19 +-
   branches/release/libs/spirit/test/qi/permutation.cpp | 11
   branches/release/libs/spirit/test/qi/plus.cpp | 35 ++-
   branches/release/libs/spirit/test/qi/range_run.cpp | 18 +-
   branches/release/libs/spirit/test/qi/raw.cpp | 18 +
   branches/release/libs/spirit/test/qi/real.cpp | 98 ++++++++---
   branches/release/libs/spirit/test/qi/rule.cpp | 271 +++++++++++++++++++++++++++------
   branches/release/libs/spirit/test/qi/sequence.cpp | 136 +++++++----------
   branches/release/libs/spirit/test/qi/sequential_or.cpp | 29 ++
   branches/release/libs/spirit/test/qi/symbols.cpp | 114 +++++++++++++-
   branches/release/libs/spirit/test/qi/test.hpp | 36 ++++
   branches/release/libs/spirit/test/qi/tst.cpp | 8
   branches/release/libs/spirit/test/qi/uint.cpp | 103 +++++++++---
   179 files changed, 6608 insertions(+), 4242 deletions(-)

Modified: branches/release/libs/spirit/classic/doc/dynamic_parsers.html
==============================================================================
--- branches/release/libs/spirit/classic/doc/dynamic_parsers.html (original)
+++ branches/release/libs/spirit/classic/doc/dynamic_parsers.html 2009-09-14 12:45:39 EDT (Mon, 14 Sep 2009)
@@ -1,30 +1,35 @@
-<html>
-<head>
-<title>Dynamic Parsers</title>
-<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1">
-<link rel="stylesheet" href="theme/style.css" type="text/css">
-</head>
+<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
+<html><head>
 
+<title>Dynamic Parsers</title><meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1">
+<link rel="stylesheet" href="theme/style.css" type="text/css"></head>
 <body>
-<table width="100%" border="0" background="theme/bkd2.gif" cellspacing="2">
- <tr>
+<table background="theme/bkd2.gif" border="0" cellspacing="2" width="100%">
+ <tbody><tr>
     <td width="10">
     </td>
- <td width="85%"> <font size="6" face="Verdana, Arial, Helvetica, sans-serif"><b>Dynamic
+ <td width="85%"> <font face="Verdana, Arial, Helvetica, sans-serif" size="6"><b>Dynamic
       Parsers </b></font></td>
- <td width="112"></td>
+ <td width="112"></td>
   </tr>
-</table>
+</tbody></table>
 <br>
 <table border="0">
- <tr>
+ <tbody><tr>
     <td width="10"></td>
     <td width="30"></td>
     <td width="30"></td>
     <td width="30"></td>
   </tr>
-</table>
-<p>We see dynamic parsing everywhere in Spirit. A special group of parsers, aptly named dynamic parsers, form the most basic building blocks to dynamic parsing. This chapter focuses on these critters. You'll notice the similarity of these parsers with C++'s control structures. The similarity is not a coincidence. These parsers give an imperative flavor to parsing, and, since imperative constructs are not native to declarative EBNF, mimicking the host language, C++, should make their use immediately familiar. </p>
+</tbody></table>
+<p>We see dynamic parsing everywhere in Spirit. A special group of
+parsers, aptly named dynamic parsers, form the most basic building
+blocks to dynamic parsing. This chapter focuses on these critters.
+You'll notice the similarity of these parsers with C++'s control
+structures. The similarity is not a coincidence. These parsers give an
+imperative flavor to parsing, and, since imperative constructs are not
+native to declarative EBNF, mimicking the host language, C++, should
+make their use immediately familiar. </p>
 <p>Dynamic parsers modify the parsing behavior according to conditions. Constructing
     dynamic parsers requires a condition argument and a body parser argument. Additional
     arguments are required by some parsers.</p>
@@ -38,58 +43,57 @@
 <p>A failure to meet the condition will not result in a parse error.</p>
 <h2>if_p</h2>
 <p><tt>if_p</tt> can be used with or without an else-part. The syntax is:</p>
-<pre> <span class=identifier>if_p</span><span class=special>(</span><span class=identifier>condition</span><span class=special>)[</span><span class=identifier>then</span><span class=special>-</span><span class=identifier>parser</span><span class=special>]</span></pre>
-<p><span class=special></span>or</p>
-<pre><span class=identifier> if_p</span><span class=special>(</span><span class=identifier>condition</span><span class=special>)[</span><span class=identifier>then</span><span class=special>-</span><span class=identifier>parser</span><span class=special>].</span><span class=identifier>else_p</span><span class=special>[</span><span class="identifier">else</span><span class=special>-</span><span class=identifier>parser</span><span class=special>]</span></pre>
+<pre> <span class="identifier">if_p</span><span class="special">(</span><span class="identifier">condition</span><span class="special">)[</span><span class="identifier">then</span><span class="special">-</span><span class="identifier">parser</span><span class="special">]</span></pre>
+<p><span class="special"></span>or</p>
+<pre><span class="identifier"> if_p</span><span class="special">(</span><span class="identifier">condition</span><span class="special">)[</span><span class="identifier">then</span><span class="special">-</span><span class="identifier">parser</span><span class="special">].</span><span class="identifier">else_p</span><span class="special">[</span><span class="identifier">else</span><span class="special">-</span><span class="identifier">parser</span><span class="special">]</span></pre>
 <p>When the condition is met the then-parser is used next in the parsing process.
   When the condition is not met and an else-parser is available the else-parser
   is used next. When the condition isn't met and no else-parser is available then
- the whole parser matches the empty sequence. (<img src="theme/alert.gif" width="16" height="16">
+ the whole parser matches the empty sequence. (<img src="theme/alert.gif" height="16" width="16">
   Note: older versions of <tt>if_p</tt> report a failure when the condition isn't
   met and no else-parser is available.)</p>
 <p>Example:</p>
-<pre> <span class=special></span><span class=identifier>if_p</span><span class=special>(</span><span class=string>&quot;0x&quot;</span><span class=special>)[</span><span class=identifier>hex_p</span><span class=special>].</span><span class=identifier>else_p</span><span class=special>[</span><span class=identifier>uint_p</span><span class=special>]</span></pre>
+<pre> <span class="special"></span><span class="identifier">if_p</span><span class="special">(</span><span class="string">"0x"</span><span class="special">)[</span><span class="identifier">hex_p</span><span class="special">].</span><span class="identifier">else_p</span><span class="special">[</span><span class="identifier">uint_p</span><span class="special">]</span></pre>
 <h2>while_p, do_p</h2>
 <p><tt>while_p</tt>/<tt>do_p</tt> syntax is:</p>
-<pre> <span class=identifier>while_p</span><span class=special>(</span><span class=identifier>condition</span><span class=special>)[</span><span class=identifier>body</span><span class=special>-</span><span class=identifier>parser</span><span class=special>]
- </span><span class=identifier>do_p</span><span class=special>[</span><span class=identifier>body</span><span class=special>-</span><span class=identifier>parser</span><span class=special>].</span><span class=identifier>while_p</span><span class=special>(</span><span class=identifier>condition</span><span class=special>)</span></pre>
+<pre> <span class="identifier">while_p</span><span class="special">(</span><span class="identifier">condition</span><span class="special">)[</span><span class="identifier">body</span><span class="special">-</span><span class="identifier">parser</span><span class="special">]<br> </span><span class="identifier">do_p</span><span class="special">[</span><span class="identifier">body</span><span class="special">-</span><span class="identifier">parser</span><span class="special">].</span><span class="identifier">while_p</span><span class="special">(</span><span class="identifier">condition</span><span class="special">)</span></pre>
 <p>As long as the condition is met the dynamic parser constructed by <tt>while_p</tt>
   will try to match the body-parser. <tt>do_p</tt> returns a parser that tries
   to match the body-parser and then behaves just like the parser returned by <tt>while_p</tt>.
   A failure to match the body-parser will cause a failure to be reported by the
   while/do-parser.</p>
 <p>Example:</p>
-<pre><span class=special> </span><span class=identifier>uint_p</span><span class=special>[</span><span class=identifier>assign_a</span><span class=special>(</span><span class=identifier>sum</span><span class=special>)] &gt;&gt; </span><span class=identifier>while_p</span><span class=special>(</span><span class=literal>'+'</span><span class=special>)[</span><span class=identifier>uint_p</span><span class=special>(</span><span class=identifier>add</span><span class=special>(</span><span class=identifier>sum</span><span class=special>)]
- </span><span class=literal>'&quot;' </span><span class=special>&gt;&gt; </span><span class="identifier">while_p</span><span class=special>(~</span><span class=identifier>eps_p</span><span class=special>(</span><span class=literal>'&quot;'</span><span class=special>))[</span><span class=identifier>c_escape_ch_p</span><span class=special>[</span><span class=identifier>push_back_a</span><span class=special>(</span><span class=identifier>result</span><span class=special>)]] &gt;&gt; </span><span class=literal>'&quot;'</span>
+<pre><span class="special"> </span><span class="identifier">uint_p</span><span class="special">[</span><span class="identifier">assign_a</span><span class="special">(</span><span class="identifier">sum</span><span class="special">)] &gt;&gt; </span><span class="identifier">while_p</span><span class="special">(</span><span class="literal">'+'</span><span class="special">)[</span><span class="identifier">uint_p</span><span class="special">[</span><span class="identifier">add</span><span class="special">(</span><span class="identifier">sum</span><span class="special">)]]<br> </span><span class="literal">'"' </span><span class="special">&gt;&gt; </span><span class="identifier">while_p</span><span class="special">(~</span><span class="identifier">eps_p</span><span class="special">(</span><span class="literal">'"'</span><span class="special">))[</span><span class="identifier">c_escape_ch_p</span><span class="special">[</span><span class="identifier">push_back_a</span><span class="special">(</span><span clas
s="identifier">result</span><span class="special">)]] &gt;&gt; </span><span class="literal">'"'</span>
 </pre>
-<h2>for_p</h2>
+<p>Assuming <span style="font-family: monospace;">add</span> is a user defined function object.<br></p><h2>for_p</h2>
 <p><tt>for_p</tt> requires four arguments. The syntax is:</p>
-<pre> <span class=literal></span><span class=identifier>for_p</span><span class=special>(</span><span class=identifier>init</span><span class=special>, </span><span class=identifier>condition</span><span class=special>, </span><span class=identifier>step</span><span class=special>)[</span><span class=identifier>body</span><span class=special>-</span><span class=identifier>parser</span><span class=special>]</span></pre>
+<pre> <span class="literal"></span><span class="identifier">for_p</span><span class="special">(</span><span class="identifier">init</span><span class="special">, </span><span class="identifier">condition</span><span class="special">, </span><span class="identifier">step</span><span class="special">)[</span><span class="identifier">body</span><span class="special">-</span><span class="identifier">parser</span><span class="special">]</span></pre>
 <p>init and step have to be 0-ary functions/functors. for_p returns a parser that
   will:</p>
 <ol>
   <li> call init</li>
- <li>check the condition, if the condition isn't met then a match is returned. The match will cover everything that has been matched successfully up to this point.</li>
+ <li>check the condition, if the
+condition isn't met then a match is returned. The match will cover
+everything that has been matched successfully up to this point.</li>
   <li> tries to match the body-parser. A failure to match the body-parser will cause a failure to be reported by the for-parser</li>
   <li> calls step</li>
   <li> goes to 2.</li>
 </ol>
 <table border="0">
- <tr>
+ <tbody><tr>
     <td width="10"></td>
     <td width="30"></td>
     <td width="30"></td>
     <td width="30"></td>
   </tr>
-</table>
+</tbody></table>
 <br>
 <hr size="1">
-<p class="copyright">Copyright &copy; 2002-2003 Joel de Guzman<br>
- Copyright &copy; 2002-2003 Martin Wille<br>
+<p class="copyright">Copyright © 2002-2003 Joel de Guzman<br>
+ Copyright © 2002-2003 Martin Wille<br>
   <br>
 <font size="2">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)</font></p>
 <p class="copyright">&nbsp;</p>
-</body>
-</html>
+</body></html>
\ No newline at end of file

Modified: branches/release/libs/spirit/classic/doc/primitives.html
==============================================================================
--- branches/release/libs/spirit/classic/doc/primitives.html (original)
+++ branches/release/libs/spirit/classic/doc/primitives.html 2009-09-14 12:45:39 EDT (Mon, 14 Sep 2009)
@@ -1,30 +1,28 @@
-<html>
-<head>
-<title>Primitives</title>
-<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1">
-<link rel="stylesheet" href="theme/style.css" type="text/css">
-</head>
+<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
+<html><head>
 
+<title>Primitives</title><meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1">
+<link rel="stylesheet" href="theme/style.css" type="text/css"></head>
 <body>
-<table width="100%" border="0" background="theme/bkd2.gif" cellspacing="2">
- <tr>
+<table background="theme/bkd2.gif" border="0" cellspacing="2" width="100%">
+ <tbody><tr>
     <td width="10">
     </td>
     <td width="85%">
- <font size="6" face="Verdana, Arial, Helvetica, sans-serif"><b>Primitives</b></font>
+ <font face="Verdana, Arial, Helvetica, sans-serif" size="6"><b>Primitives</b></font>
     </td>
- <td width="112"></td>
+ <td width="112"></td>
   </tr>
-</table>
+</tbody></table>
 <br>
 <table border="0">
- <tr>
+ <tbody><tr>
     <td width="10"></td>
     <td width="30"></td>
     <td width="30"></td>
     <td width="30"></td>
    </tr>
-</table>
+</tbody></table>
 <p>The framework predefines some parser primitives. These are the most basic building
   blocks that the client uses to build more complex parsers. These primitive parsers
   are template classes, making them very flexible.</p>
@@ -39,17 +37,17 @@
   the type of the character. This type typically corresponds to the input type,
   usually <tt>char</tt> or <tt>wchar_t</tt>. The following expression creates
   a temporary parser object which will recognize the single letter <span class="quotes">'X'</span>.</p>
-<pre><code><font color="#000000"><span class=identifier> </span><span class=identifier>chlit</span><span class=special>&lt;</span><span class=keyword>char</span><span class=special>&gt;(</span><span class=literal>'X'</span><span class=special>);</span></font></code></pre>
+<pre><code><font color="#000000"><span class="identifier"> </span><span class="identifier">chlit</span><span class="special">&lt;</span><span class="keyword">char</span><span class="special">&gt;(</span><span class="literal">'X'</span><span class="special">);</span></font></code></pre>
 <p>Using <tt>chlit</tt>'s generator function <tt>ch_p</tt> simplifies the usage
   of the <tt>chlit&lt;&gt;</tt> class (this is true of most Spirit parser classes
   since most have corresponding generator functions). It is convenient to call
   the function because the compiler will deduce the template type through argument
   deduction for us. The example above could be expressed less verbosely using
   the <tt>ch_p </tt>helper function. </p>
-<pre><code><font color="#000000"><span class=special> </span><span class=identifier>ch_p</span><span class=special>(</span><span class=literal>'X'</span><span class=special>) </span><span class=comment>// equivalent to chlit&lt;char&gt;('X') object</span></font></code></pre>
-<table width="80%" border="0" align="center">
- <tr>
- <td class="note_box"><img src="theme/lens.gif" width="15" height="16"> <b>Parser
+<pre><code><font color="#000000"><span class="special"> </span><span class="identifier">ch_p</span><span class="special">(</span><span class="literal">'X'</span><span class="special">) </span><span class="comment">// equivalent to chlit&lt;char&gt;('X') object</span></font></code></pre>
+<table align="center" border="0" width="80%">
+ <tbody><tr>
+ <td class="note_box"><img src="theme/lens.gif" height="16" width="15"> <b>Parser
       generators</b><br>
       <br>
       Whenever you see an invocation of the parser generator function, it is equivalent
@@ -57,17 +55,9 @@
       parser, even if, technically speaking, it is a function that generates a
       character parser.</td>
   </tr>
-</table>
+</tbody></table>
 <p>The following grammar snippet shows these forms in action:</p>
-<pre><code><span class=comment> </span><span class=comment>// a rule can "store" a parser object. They're covered
- </span><span class=comment>// later, but for now just consider a rule as an opaque type
- </span><span class=identifier>rule</span><span class=special>&lt;&gt; </span><span class=identifier>r1</span><span class=special>, </span><span class=identifier>r2</span><span class=special>, </span><span class=identifier>r3</span><span class=special>;
-
- </span><span class=identifier>chlit</span><span class=special>&lt;</span><span class=keyword>char</span><span class=special>&gt; </span><span class=identifier>x</span><span class=special>(</span><span class=literal>'X'</span><span class=special>); </span><span class=comment>// declare a parser named x
-
- </span><span class=identifier>r1 </span><span class=special>= </span><span class=identifier>chlit</span><span class=special>&lt;</span><span class=keyword>char</span><span class=special>&gt;(</span><span class=literal>'X'</span><span class=special>); </span><span class=comment>// explicit declaration
- </span><span class=identifier>r2 </span><span class=special>= </span><span class=identifier>x</span><span class=special>; </span><span class=comment>// using x
- </span><span class=identifier>r3 </span><span class=special>= </span><span class=identifier>ch_p</span><span class=special>(</span><span class=literal>'X'</span><span class=special>) </span><span class=comment>// using the generator</span></code></pre>
+<pre><code><span class="comment"> </span><span class="comment">// a rule can "store" a parser object. They're covered<br> </span><span class="comment">// later, but for now just consider a rule as an opaque type<br> </span><span class="identifier">rule</span><span class="special">&lt;&gt; </span><span class="identifier">r1</span><span class="special">, </span><span class="identifier">r2</span><span class="special">, </span><span class="identifier">r3</span><span class="special">;<br><br> </span><span class="identifier">chlit</span><span class="special">&lt;</span><span class="keyword">char</span><span class="special">&gt; </span><span class="identifier">x</span><span class="special">(</span><span class="literal">'X'</span><span class="special">); </span><span class="comment">// declare a parser named x<br><br> </span><span class="identifier">r1 </span><span class="special">= </span><span class="identifier">chlit</span><span class="special">&lt;</span><span class="keyword">char</span><spa
n class="special">&gt;(</span><span class="literal">'X'</span><span class="special">); </span><span class="comment">// explicit declaration<br> </span><span class="identifier">r2 </span><span class="special">= </span><span class="identifier">x</span><span class="special">; </span><span class="comment">// using x<br> </span><span class="identifier">r3 </span><span class="special">= </span><span class="identifier">ch_p</span><span class="special">(</span><span class="literal">'X'</span><span class="special">) </span><span class="comment">// using the generator</span></code></pre>
 <h2> chlit and ch_p</h2>
 <p>Matches a single character literal. <tt>chlit</tt> has a single template type
   parameter which defaults to <tt>char</tt> (i.e. <tt>chlit&lt;&gt;</tt> is equivalent
@@ -76,52 +66,41 @@
   the template type parameters from the actual function arguments. The <tt>chlit</tt>
   class constructor accepts a single parameter: the character it will match the
   input against. Examples:</p>
-<pre><code><span class=comment> </span><span class=identifier>r1 </span><span class=special>= </span><span class=identifier>chlit</span><span class=special>&lt;&gt;(</span><span class=literal>'X'</span><span class=special>);
- </span><span class=identifier>r2 </span><span class=special>= </span><span class=identifier>chlit</span><span class=special>&lt;</span><span class=keyword>wchar_t</span><span class=special>&gt;(</span><span class=identifier>L</span><span class=literal>'X'</span><span class=special>);
- </span><span class=identifier>r3 </span><span class=special>= </span><span class=identifier>ch_p</span><span class=special>(</span><span class=literal>'X'</span><span class=special>);</span></code></pre>
+<pre><code><span class="comment"> </span><span class="identifier">r1 </span><span class="special">= </span><span class="identifier">chlit</span><span class="special">&lt;&gt;(</span><span class="literal">'X'</span><span class="special">);<br> </span><span class="identifier">r2 </span><span class="special">= </span><span class="identifier">chlit</span><span class="special">&lt;</span><span class="keyword">wchar_t</span><span class="special">&gt;(</span><span class="identifier">L</span><span class="literal">'X'</span><span class="special">);<br> </span><span class="identifier">r3 </span><span class="special">= </span><span class="identifier">ch_p</span><span class="special">(</span><span class="literal">'X'</span><span class="special">);</span></code></pre>
 <p>Going back to our original example:</p>
-<pre><code><span class=special> </span><span class=identifier>group </span><span class=special>= </span><span class=literal>'(' </span><span class=special>&gt;&gt; </span><span class=identifier>expr </span><span class=special>&gt;&gt; </span><span class=literal>')'</span><span class=special>;
- </span><span class=identifier>expr1 </span><span class=special>= </span><span class=identifier>integer </span><span class=special>| </span><span class=identifier>group</span><span class=special>;
- </span><span class=identifier>expr2 </span><span class=special>= </span><span class=identifier>expr1 </span><span class=special>&gt;&gt; </span><span class=special>*((</span><span class=literal>'*' </span><span class=special>&gt;&gt; </span><span class=identifier>expr1</span><span class=special>) </span><span class=special>| </span><span class=special>(</span><span class=literal>'/' </span><span class=special>&gt;&gt; </span><span class=identifier>expr1</span><span class=special>));
- </span><span class=identifier>expr </span><span class=special>= </span><span class=identifier>expr2 </span><span class=special>&gt;&gt; </span><span class=special>*((</span><span class=literal>'+' </span><span class=special>&gt;&gt; </span><span class=identifier>expr2</span><span class=special>) </span><span class=special>| </span><span class=special>(</span><span class=literal>'-' </span><span class=special>&gt;&gt; </span><span class=identifier>expr2</span><span class=special>));</span></code></pre>
+<pre><code><span class="special"> </span><span class="identifier">group </span><span class="special">= </span><span class="literal">'(' </span><span class="special">&gt;&gt; </span><span class="identifier">expr </span><span class="special">&gt;&gt; </span><span class="literal">')'</span><span class="special">;<br> </span><span class="identifier">expr1 </span><span class="special">= </span><span class="identifier">integer </span><span class="special">| </span><span class="identifier">group</span><span class="special">;<br> </span><span class="identifier">expr2 </span><span class="special">= </span><span class="identifier">expr1 </span><span class="special">&gt;&gt; </span><span class="special">*((</span><span class="literal">'*' </span><span class="special">&gt;&gt; </span><span class="identifier">expr1</span><span class="special">) </span><span class="special">| </span><span class="special">(</span><span class="literal">'/' </span><span class="special">&gt;&gt; </span><span class="identifier">expr1
</span><span class="special">));<br> </span><span class="identifier">expr </span><span class="special">= </span><span class="identifier">expr2 </span><span class="special">&gt;&gt; </span><span class="special">*((</span><span class="literal">'+' </span><span class="special">&gt;&gt; </span><span class="identifier">expr2</span><span class="special">) </span><span class="special">| </span><span class="special">(</span><span class="literal">'-' </span><span class="special">&gt;&gt; </span><span class="identifier">expr2</span><span class="special">));</span></code></pre>
 <p></p>
 <p>the character literals <tt class="quotes">'('</tt>, <tt class="quotes">')'</tt>,
   <tt class="quotes">'+'</tt>, <tt class="quotes">'-'</tt>, <tt class="quotes">'*'</tt>
   and <tt class="quotes">'/'</tt> in the grammar declaration are <tt>chlit</tt>
   objects that are implicitly created behind the scenes.</p>
-<table width="80%" border="0" align="center">
- <tr>
- <td class="note_box"><img src="theme/lens.gif" width="15" height="16"> <b>char
+<table align="center" border="0" width="80%">
+ <tbody><tr>
+ <td class="note_box"><img src="theme/lens.gif" height="16" width="15"> <b>char
       operands</b> <br>
       <br>
       The reason this works is from two special templatized overloads of <tt>operator<span class="operators">&gt;&gt;</span></tt>
       that takes a (<tt>char</tt>, <tt> ParserT</tt>), or (<tt>ParserT</tt>, <tt>char</tt>).
       These functions convert the character into a <tt>chlit</tt> object.</td>
   </tr>
-</table>
+</tbody></table>
 <p> One may prefer to declare these explicitly as:</p>
-<pre><code><span class=special> </span><span class=identifier>chlit</span><span class=special>&lt;&gt; </span><span class=identifier>plus</span><span class=special>(</span><span class=literal>'+'</span><span class=special>);
- </span><span class=identifier>chlit</span><span class=special>&lt;&gt; </span><span class=identifier>minus</span><span class=special>(</span><span class=literal>'-'</span><span class=special>);
- </span><span class=identifier>chlit</span><span class=special>&lt;&gt; </span><span class=identifier>times</span><span class=special>(</span><span class=literal>'*'</span><span class=special>);
- </span><span class=identifier>chlit</span><span class=special>&lt;&gt; </span><span class=identifier>divide</span><span class=special>(</span><span class=literal>'/'</span><span class=special>);
- </span><span class=identifier>chlit</span><span class=special>&lt;&gt; </span><span class=identifier>oppar</span><span class=special>(</span><span class=literal>'('</span><span class=special>);
- </span><span class=identifier>chlit</span><span class=special>&lt;&gt; </span><span class=identifier>clpar</span><span class=special>(</span><span class=literal>')'</span><span class=special>);</span></code></pre>
+<pre><code><span class="special"> </span><span class="identifier">chlit</span><span class="special">&lt;&gt; </span><span class="identifier">plus</span><span class="special">(</span><span class="literal">'+'</span><span class="special">);<br> </span><span class="identifier">chlit</span><span class="special">&lt;&gt; </span><span class="identifier">minus</span><span class="special">(</span><span class="literal">'-'</span><span class="special">);<br> </span><span class="identifier">chlit</span><span class="special">&lt;&gt; </span><span class="identifier">times</span><span class="special">(</span><span class="literal">'*'</span><span class="special">);<br> </span><span class="identifier">chlit</span><span class="special">&lt;&gt; </span><span class="identifier">divide</span><span class="special">(</span><span class="literal">'/'</span><span class="special">);<br> </span><span class="identifier">chlit</span><span class="special">&lt;&gt; </span><span class="identifier">oppar</span><span class="s
pecial">(</span><span class="literal">'('</span><span class="special">);<br> </span><span class="identifier">chlit</span><span class="special">&lt;&gt; </span><span class="identifier">clpar</span><span class="special">(</span><span class="literal">')'</span><span class="special">);</span></code></pre>
 <h2>range and range_p</h2>
 <p>A <tt>range</tt> of characters is created from a low/high character pair. Such
   a parser matches a single character that is in the <tt>range</tt>, including
   both endpoints. Like <tt>chlit</tt>, <tt>range</tt> has a single template type
   parameter which defaults to <tt>char</tt>. The <tt>range</tt> class constructor
- accepts two parameters: the character range (<I>from</I> and <I>to</I>, inclusive)
+ accepts two parameters: the character range (<i>from</i> and <i>to</i>, inclusive)
   it will match the input against. The function generator version is <tt>range_p</tt>.
   Examples:</p>
-<pre><code><span class=special> </span><span class=identifier>range</span><span class=special>&lt;&gt;(</span><span class=literal>'A'</span><span class=special>,</span><span class=literal>'Z'</span><span class=special>) </span><span class=comment>// matches 'A'..'Z'
- </span><span class=identifier>range_p</span><span class=special>(</span><span class=literal>'a'</span><span class=special>,</span><span class=literal>'z'</span><span class=special>) </span><span class=comment>// matches 'a'..'z'</span></code></pre>
-<p>Note, the first character must be &quot;before&quot; the second, according
+<pre><code><span class="special"> </span><span class="identifier">range</span><span class="special">&lt;&gt;(</span><span class="literal">'A'</span><span class="special">,</span><span class="literal">'Z'</span><span class="special">) </span><span class="comment">// matches 'A'..'Z'<br> </span><span class="identifier">range_p</span><span class="special">(</span><span class="literal">'a'</span><span class="special">,</span><span class="literal">'z'</span><span class="special">) </span><span class="comment">// matches 'a'..'z'</span></code></pre>
+<p>Note, the first character must be "before" the second, according
   to the underlying character encoding characters. The range, like chlit is a
   single character parser.</p>
-<table border="0" align="center" width="80%">
- <tr>
- <td class="note_box"><img src="theme/alert.gif" width="16" height="16"><b>
+<table align="center" border="0" width="80%">
+ <tbody><tr>
+ <td class="note_box"><img src="theme/alert.gif" height="16" width="16"><b>
       Character mapping</b><br>
       <br>
       Character mapping to is inherently platform dependent. It is not guaranteed
@@ -129,7 +108,7 @@
       we are well aware of the character set we are using such as ASCII, ISO-8859-1
       or Unicode. Take care though when porting to another platform.</td>
   </tr>
-</table>
+</tbody></table>
 <h2> strlit and str_p</h2>
 <p>This parser matches a string literal. <tt>strlit</tt> has a single template
   type parameter: an iterator type. Internally, <tt>strlit</tt> holds a begin/end
@@ -140,14 +119,10 @@
   This constructor may be used to build <tt>strlits</tt> from quoted string literals.
   The second constructor takes in a first/last iterator pair. The function generator
   version is <tt>str_p</tt>. Examples:</p>
-<pre><code><span class=comment> </span><span class=identifier>strlit</span><span class=special>&lt;&gt;(</span><span class=string>"Hello World"</span><span class=special>)
- </span><span class=identifier>str_p</span><span class=special>(</span><span class=string>"Hello World"</span><span class=special>)
-
- </span><span class=identifier>std</span><span class=special>::</span><span class=identifier>string </span><span class=identifier>msg</span><span class=special>(</span><span class=string>"Hello World"</span><span class=special>);
- </span><span class=identifier>strlit</span><span class=special>&lt;</span><span class=identifier>std</span><span class=special>::</span><span class=identifier>string</span><span class=special>::</span><span class=identifier>const_iterator</span><span class=special>&gt;(</span><span class=identifier>msg</span><span class=special>.</span><span class=identifier>begin</span><span class=special>(), </span><span class=identifier>msg</span><span class=special>.</span><span class=identifier>end</span><span class=special>());</span></code></pre>
-<table width="80%" border="0" align="center">
- <tr>
- <td class="note_box"><img src="theme/note.gif" width="16" height="16"> <b>Character
+<pre><code><span class="comment"> </span><span class="identifier">strlit</span><span class="special">&lt;&gt;(</span><span class="string">"Hello World"</span><span class="special">)<br> </span><span class="identifier">str_p</span><span class="special">(</span><span class="string">"Hello World"</span><span class="special">)<br><br> </span><span class="identifier">std</span><span class="special">::</span><span class="identifier">string </span><span class="identifier">msg</span><span class="special">(</span><span class="string">"Hello World"</span><span class="special">);<br> </span><span class="identifier">strlit</span><span class="special">&lt;</span><span class="identifier">std</span><span class="special">::</span><span class="identifier">string</span><span class="special">::</span><span class="identifier">const_iterator</span><span class="special">&gt;(</span><span class="identifier">msg</span><span class="special">.</span><span class="identifier">begin</span><span class="special">(), </span><s
pan class="identifier">msg</span><span class="special">.</span><span class="identifier">end</span><span class="special">());</span></code></pre>
+<table align="center" border="0" width="80%">
+ <tbody><tr>
+ <td class="note_box"><img src="theme/note.gif" height="16" width="16"> <b>Character
       and phrase level parsing</b><br>
       <br>
       Typical parsers regard the processing of characters (symbols that form words
@@ -167,26 +142,23 @@
       layers as needed. In theory, one may create a preprocessor, a lexical analyzer
       and a parser proper, all using the same framework.</td>
   </tr>
-</table>
+</tbody></table>
 <h2>chseq and chseq_p</h2>
 <p>Matches a character sequence. <tt>chseq</tt> has the same template type parameters
   and constructor parameters as strlit. The function generator version is <tt>chseq_p</tt>.
   Examples:</p>
-<pre><code><span class=special> </span><span class=identifier>chseq</span><span class=special>&lt;&gt;(</span><span class=string>"ABCDEFG"</span><span class=special>)
- </span><span class=identifier>chseq_p</span><span class=special>(</span><span class=string>"ABCDEFG"</span><span class=special>)</span></code></pre>
+<pre><code><span class="special"> </span><span class="identifier">chseq</span><span class="special">&lt;&gt;(</span><span class="string">"ABCDEFG"</span><span class="special">)<br> </span><span class="identifier">chseq_p</span><span class="special">(</span><span class="string">"ABCDEFG"</span><span class="special">)</span></code></pre>
 <p><tt>strlit</tt> is an implicit lexeme. That is, it works solely on the character
   level. <tt>chseq</tt>, <tt>strlit</tt>'s twin, on the other hand, can work on
   both the character and phrase levels. What this simply means is that it can
   ignore white spaces in between the string characters. For example:</p>
-<pre><code><span class=special> </span><span class=identifier>chseq</span><span class=special>&lt;&gt;(</span><span class=string>"ABCDEFG"</span><span class=special>)</span></code></pre>
+<pre><code><span class="special"> </span><span class="identifier">chseq</span><span class="special">&lt;&gt;(</span><span class="string">"ABCDEFG"</span><span class="special">)</span></code></pre>
 <p>can parse:</p>
-<pre><span class=special> </span><span class=identifier>ABCDEFG
- </span><span class=identifier>A </span><span class=identifier>B </span><span class=identifier>C </span><span class=identifier>D </span><span class=identifier>E </span><span class=identifier>F </span><span class=identifier>G
- </span><span class=identifier>AB </span><span class=identifier>CD </span><span class=identifier>EFG</span></pre>
+<pre><span class="special"> </span><span class="identifier">ABCDEFG<br> </span><span class="identifier">A </span><span class="identifier">B </span><span class="identifier">C </span><span class="identifier">D </span><span class="identifier">E </span><span class="identifier">F </span><span class="identifier">G<br> </span><span class="identifier">AB </span><span class="identifier">CD </span><span class="identifier">EFG</span></pre>
 <h2>More character parsers</h2>
 <p>The framework also predefines the full repertoire of single character parsers:</p>
-<table width="90%" border="0" align="center">
- <tr>
+<table align="center" border="0" width="90%">
+ <tbody><tr>
     <td class="table_title" colspan="2">Single character parsers</td>
   </tr>
   <tr>
@@ -242,11 +214,11 @@
     <td class="table_cells" width="30%"><b>xdigit_p</b></td>
     <td class="table_cells" width="70%">Matches hexadecimal digits</td>
   </tr>
-</table>
+</tbody></table>
 <h2><a name="negation"></a>negation ~</h2>
 <p>Single character parsers such as the <tt>chlit</tt>, <tt>range</tt>, <tt>anychar_p</tt>,
   <tt>alnum_p</tt> etc. can be negated. For example:</p>
-<pre><code><span class=special> ~</span><span class=identifier>ch_p</span><span class="special">(</span><span class="literal">'x'</span><span class="special">)</span></code></pre>
+<pre><code><span class="special"> ~</span><span class="identifier">ch_p</span><span class="special">(</span><span class="literal">'x'</span><span class="special">)</span></code></pre>
 <p>matches any character except <tt>'x'</tt>. Double negation of a character parser
   cancels out the negation. <tt>~~alpha_p</tt> is equivalent to <tt>alpha_p</tt>.</p>
 <h2>eol_p</h2>
@@ -255,23 +227,24 @@
 <p>Never matches anything and always fails.</p>
 <h2>end_p</h2>
 <p>Matches the end of input (returns a sucessful match with 0 length when the
- input is exhausted)</p>
+ input is exhausted)</p><h2>eps_p</h2>
+<p>The <strong>Epsilon</strong> (<tt>epsilon_p</tt> and <tt>eps_p</tt>) is a multi-purpose
+ parser that returns a zero length match. See Epsilon for details.</p><p></p>
 <table border="0">
- <tr>
+ <tbody><tr>
     <td width="10"></td>
     <td width="30"></td>
     <td width="30"></td>
     <td width="30"></td>
   </tr>
-</table>
+</tbody></table>
 <br>
 <hr size="1">
-<p class="copyright">Copyright &copy; 1998-2003 Joel de Guzman<br>
- Copyright &copy; 2003 Martin Wille<br>
+<p class="copyright">Copyright © 1998-2003 Joel de Guzman<br>
+ Copyright © 2003 Martin Wille<br>
   <br>
   <font size="2">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) </font> </p>
 <p>&nbsp;</p>
-</body>
-</html>
+</body></html>
\ No newline at end of file

Modified: branches/release/libs/spirit/classic/example/fundamental/comments.cpp
==============================================================================
--- branches/release/libs/spirit/classic/example/fundamental/comments.cpp (original)
+++ branches/release/libs/spirit/classic/example/fundamental/comments.cpp 2009-09-14 12:45:39 EDT (Mon, 14 Sep 2009)
@@ -58,13 +58,7 @@
 {
     cout << "Parsing C++-comment" <<endl;
     cout << "Matched (" << plast-pfirst << ") characters: ";
-
- char cbbuffer[128];
-
- strncpy(cbbuffer, pfirst, plast-pfirst);
- cbbuffer[plast-pfirst] = '\0';
-
- cout << "\"" << cbbuffer << "\"" << endl;
+ cout << "\"" << std::string(pfirst, plast) << "\"" << endl;
 }
 
 ///////////////////////////////////////////////////////////////////////////////

Modified: branches/release/libs/spirit/classic/example/fundamental/more_calculators/calc_with_variables.cpp
==============================================================================
--- branches/release/libs/spirit/classic/example/fundamental/more_calculators/calc_with_variables.cpp (original)
+++ branches/release/libs/spirit/classic/example/fundamental/more_calculators/calc_with_variables.cpp 2009-09-14 12:45:39 EDT (Mon, 14 Sep 2009)
@@ -192,7 +192,7 @@
                 ;
 
             declaration =
- "var" >> var_decl >> *(',' >> var_decl)
+ lexeme_d["var" >> space_p] >> var_decl >> *(',' >> var_decl)
                 ;
 
             statement =

Modified: branches/release/libs/spirit/doc/Jamfile
==============================================================================
--- branches/release/libs/spirit/doc/Jamfile (original)
+++ branches/release/libs/spirit/doc/Jamfile 2009-09-14 12:45:39 EDT (Mon, 14 Sep 2009)
@@ -1,6 +1,6 @@
 #==============================================================================
-# Copyright (c) 2001-2007 Joel de Guzman
-# Copyright (c) 2001-2007 Hartmut Kaiser
+# Copyright (c) 2001-2009 Joel de Guzman
+# Copyright (c) 2001-2009 Hartmut Kaiser
 #
 # Use, modification and distribution is subject to the Boost Software
 # License, Version 1.0. (See accompanying file LICENSE_1_0.txt or copy at
@@ -12,6 +12,8 @@
 import boostbook ;
 import quickbook ;
 
+path-constant images_location : html ;
+
 boostbook spirit2
     :
         spirit2.qbk
@@ -20,9 +22,14 @@
         <xsl:param>boost.libraries=../../../libraries.htm
         <xsl:param>html.stylesheet=../../../../doc/html/boostbook.css
         <xsl:param>chunk.section.depth=4
- #<xsl:param>chunk.first.sections=1
+ <xsl:param>chunk.first.sections=1
         <xsl:param>toc.section.depth=3
         <xsl:param>toc.max.depth=3
         <xsl:param>generate.section.toc.level=4
- <xsl:param>admon.graphics.path=images/
+ <format>html:<xsl:param>admon.graphics.path=images/
+
+ <include>.
+ <format>pdf:<xsl:param>img.src.path=$(images_location)/
+ <format>pdf:<xsl:param>draft.mode="no"
+ <format>pdf:<xsl:param>boost.url.prefix=http://www.boost.org/doc/libs/release/libs/spirit/doc/html
     ;

Modified: branches/release/libs/spirit/doc/acknowledgments.qbk
==============================================================================
--- branches/release/libs/spirit/doc/acknowledgments.qbk (original)
+++ branches/release/libs/spirit/doc/acknowledgments.qbk 2009-09-14 12:45:39 EDT (Mon, 14 Sep 2009)
@@ -1,5 +1,5 @@
 [/==============================================================================
- Copyright (C) 2001-2008 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

Modified: branches/release/libs/spirit/doc/concepts_template.qbk
==============================================================================
--- branches/release/libs/spirit/doc/concepts_template.qbk (original)
+++ branches/release/libs/spirit/doc/concepts_template.qbk 2009-09-14 12:45:39 EDT (Mon, 14 Sep 2009)
@@ -1,46 +1,52 @@
-[/==============================================================================
- Copyright (C) 2001-2008 Joel de Guzman
- Copyright (C) 2001-2008 Hartmut Kaiser
-
- Distributed under the Boost Software License, Version 1.0. (See accompanying
- file LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt)
-===============================================================================/]
 
+[/------------------------------------------------------------------------------]
 [section XXX]
 
 [heading Description]
 
 Description of XXX concept
 
+[heading Refinement of]
+
+[:Link to base concept]
+
 [variablelist Notation
     [[`xxx`] [An XXX]]
 ]
 
 [heading Valid Expressions]
 
-(For any Forward Sequence the following expressions must be valid:)
+(For any XXX the following expressions must be valid:)
 
 In addition to the requirements defined in _XXX-Basic_concept_, for any
 XXX the following must be met:
 
 [table
- [[Expression] [Semantics] [Return type] [Complexity]]
- [[`xxx`] [Semantics of `xxx`] [XXX] [Constant]]
+ [[Expression] [Semantics] [Return type]]
+ [[`xxx`] [Semantics of `xxx`] [XXX]]
 ]
 
-[heading Type Requirements]
+[heading Type Expressions]
 
 [table
- [[Expression] [Requirements]]
- [[`xxx`] [Requirements for `xxx`]]
+ [[Expression] [Description]]
+ [[`XXX`] [Description of `XXX`]]
 ]
 
 [heading Invariants]
 
 For any XXX xxx the following invariants always hold:
 
+[heading Precondition]
+
+Prior to calling FOO the following preconditions should hold:
+
+[heading Precondition]
+
+Upon return from FOO the following postconditions should hold:
+
 [heading Models]
 
 Links to models of XXX concept
 
-[endsect]
+[endsect] [/ XXX Concept]

Modified: branches/release/libs/spirit/doc/faq.qbk
==============================================================================
--- branches/release/libs/spirit/doc/faq.qbk (original)
+++ branches/release/libs/spirit/doc/faq.qbk 2009-09-14 12:45:39 EDT (Mon, 14 Sep 2009)
@@ -1,10 +1,171 @@
 [/==============================================================================
- Copyright (C) 2001-2008 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)
 ===============================================================================/]
 
-[section FAQ]
+[section:faq Spirit FAQ]
+
+[heading I'm getting multiple symbol definition errors while using Visual C++. Anything I could do about that?]
+
+Do you see strange multiple symbol definition linker errors mentioning
+`boost::mpl::failed` and `boost::spirit::qi::rule`? Then this FAQ entry might
+be for you.
+
+__mpl__ implements a macro `BOOST_MPL_ASSERT_MSG()` which essentially is a
+more powerfull version of static_assert. Unfortunately under certain
+circumstances using this macro may lead to the aformentioned linker errors.
+
+__spirit__ allows you to define a preprocessor constant disabling the usage
+of `BOOST_MPL_ASSERT_MSG()`, while switching to `BOOST_STATIC_ASSERT()` instead.
+For that you need define BOOST_SPIRIT_DONT_USE_MPL_ASSERT_MSG=1 (either by
+adding
+
+ -DBOOST_SPIRIT_DONT_USE_MPL_ASSERT_MSG=1
+
+on the compiler command line or by inserting a
+
+ #define BOOST_SPIRIT_DONT_USE_MPL_ASSERT_MSG 1
+
+into your code before any spirit headers get included).
+
+Using this trick has no adverse effects on any of the functionality of
+__spirit__. The only change you might see while using this workaround are less
+verbose error messages generated from static_assert.
+
+
+[heading I'm very confused about the header hell in my boost/spirit directory. What's all this about?]
+
+The boost/spirit directory currently holds two versions of the Spirit library:
+__classic__ (former V1.8.x) and SpiritV2. Both are completely independent
+and usually not used at the same time. Do not mix these two in the same grammar.
+
+__classic__ evolved over years in a fairly complex directory structure:
+
+ boost/spirit/actor
+ boost/spirit/attribute
+ boost/spirit/core
+ boost/spirit/debug
+ boost/spirit/dynamic
+ boost/spirit/error_handling
+ boost/spirit/iterator
+ boost/spirit/meta
+ boost/spirit/symbols
+ boost/spirit/tree
+ boost/spirit/utility
+
+While introducing Spirit V2 we restructured the directory structure in order to
+accommodate two versions at the same time. All of __classic__ now lives in
+the directory
+
+ boost/spirit/home/classic
+
+where the directories above contain forwarding headers to the new location
+allowing to maintain application compatibility. The forwarding headers issue a
+warning (starting with Boost V1.38) telling the user to change their include
+paths. Please expect the above directories/forwarding headers to go away soon.
+
+This explains the need for the directory
+
+ boost/spirit/include
+
+which contains forwarding headers as well. But this time the headers won't go
+away. We encourage application writers to use only the includes contained in
+this directory. This allows us to restructure the directories underneath if
+needed without worrying application compatibility. Please use those files in
+your application only. If it turns out that some forwarding file is missing,
+please report this as a bug.
+
+Spirit V2 is not about parsing only anymore (as __classic__). It now consists
+out of 3 parts (sub-libraries): __qi__, __karma__, and __lex__. The header
+files for those live in
+
+ boost/spirit/home/qi
+ boost/spirit/home/karma
+ boost/spirit/home/lex
+
+and have forwarding headers in
+
+ boost/spirit/include
+
+__qi__ is the direct successor to __classic__ as it implements a DSEL (domain
+specific embedded language) allowing to write parsers using the syntax of C++
+itself (parsers in the sense turning a sequence of bytes into an internal data
+structure). It is not compatible with __classic__, the main concepts are
+similar, though.
+
+__karma__ is the counterpart to __qi__. It implements a similar DSEL but for
+writing generators (i.e. the things turning internal data structures into a
+sequence of bytes, most of the time - strings). __karma__ is the Yang to
+__qi__'s Yin, it's almost like a mirrored picture.
+
+__lex__ is (as the name implies) a library allowing to write lexical analyzers.
+These are either usable standalone or can be used as a frontend for __qi__
+parsers. If you know flex you shouldn't have problems understanding __lex__.
+This library actually doesn't implement the lexer itself. All it does is to
+provide an interface to pre-existing lexical analyzers. Currently it's using
+Ben Hansons excellent __lexertl__ library (proposed for a Boost review, BTW) as
+its underlying workhorse.
+
+Again, don't use any of the header files underneath the boost/spirit/home
+directory directly, always include files from the boost/spirit/include
+directory.
+
+The last bit missing is __boost_phoenix__ (which currently still lives under the
+Spirit umbrella, but already has been accepted as a Boost library, so it will
+move away). __boost_phoenix__ is a library allowing to write functional style C++,
+which is interesting on itself, but as it initially has been developed for
+Spirit, it is nicely integrated and very useful when it comes to writing
+semantic actions. I think using the boost/spirit/include/phoenix_... headers
+will be safe in the future as well, as we will probably redirect to the
+Boost.Phoenix headers as soon as these are available.
+
+
+[heading Why doesn't my symbol table work in a `no_case` directive?]
+
+In order to perform case-insensitive parsing (using __qi_no_case__) with a
+symbol table (i.e. use a __qi_symbols__
+parser in a `no_case` directive), that symbol table needs to be filled with
+all-lowercase contents. Entries containing one or more uppercase characters
+will not match any input.
+
+
+[heading I'm getting a compilation error mentioning `boost::function` and/or
+ `boost::function4`. What does this mean?]
+
+If you are using Visual C++ and have an error like:
+
+[pre
+error C2664: \'bool boost::function4<R,T0,T1,T2,T3>::operator ()(T0,T1,T2,T3) const\' :
+ cannot convert parameter 4 from '...' to '...'
+]
+
+or you are using GCC and have an error like:
+
+[pre
+error: no match for call to '(const boost::function<bool ()(...)>) (...)'
+note: candidates are: ... boost::function4<R,T1,T2,T3,T4>::operator()(T0,T1,T2,T3) const [with ...\]
+]
+
+then this FAQ entry may help you.
+
+The definition of a __rule__ or __grammar__ may contain a skip parser type. If
+it does, it means that non-terminal can only be used with a skip parser of a
+compatible type. The error above arises when this is not the case, i.e.:
+
+* a non-terminal defined with a skip parser type is used without a skip parser
+ (for example, a rule with a skip parser type is used inside a `lexeme`
+ directive, or a grammar with a skip parser type is used in `parse` instead of
+ `phrase_parse`),
+* or a non-terminal is used with a skip parser of an incompatible type
+ (for example, a rule defined with one skip parser type calls a second rule
+ defined with another, incompatible skip parser type).
+
+[note The same applies to __karma__, replacing 'skip parser' and `lexeme`
+ by 'delimit generator' and `verbatim`. Similarily, corresponding error
+ messages in __karma__ reference `boost::function3` and the 3rd
+ parameter (instead of the 4th).]
+
 [endsect]

Modified: branches/release/libs/spirit/doc/introduction.qbk
==============================================================================
--- branches/release/libs/spirit/doc/introduction.qbk (original)
+++ branches/release/libs/spirit/doc/introduction.qbk 2009-09-14 12:45:39 EDT (Mon, 14 Sep 2009)
@@ -1,5 +1,5 @@
 [/==============================================================================
- Copyright (C) 2001-2008 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
@@ -8,14 +8,16 @@
 
 [section Introduction]
 
-Boost Spirit is an object-oriented, recursive-descent parser and output generation
-library for C++. It allows you to write grammars and format descriptions using a
-format similar to EBNF (Extended Backus Naur Form, see [4]) directly in
-C++. These inline grammar specifications can mix freely with other C++ code and,
-thanks to the generative power of C++ templates, are immediately executable.
-In retrospect, conventional compiler-compilers or parser-generators have to
-perform an additional translation step from the source EBNF code to C or C++
-code.
+Boost Spirit is an object-oriented, recursive-descent parser and
+output generation library for C++. It allows you to write grammars and
+format descriptions using a format similar to Extended Backus Naur
+Form (EBNF)[footnote [@http://www.cl.cam.ac.uk/%7Emgk25/iso-14977.pdf
+ISO-EBNF]] directly in C++. These inline grammar
+specifications can mix freely with other C++ code and, thanks to the
+generative power of C++ templates, are immediately executable. In
+retrospect, conventional compiler-compilers or parser-generators have
+to perform an additional translation step from the source EBNF code to
+C or C++ code.
 
 The syntax and semantics of the libraries' API directly form domain-specific
 embedded languages (DSEL). In fact, Spirit exposes 3 different DSELs to the
@@ -28,13 +30,14 @@
 Since the target input grammars and output formats are written entirely in C++
 we do not need any separate tools to compile, preprocess or integrate those
 into the build process. __spirit__ allows seamless integration of the parsing
-and output generation process with other C++ code. Often this allows for
+and output generation process with other C++ code. This often allows for
 simpler and more efficient code.
 
-Both the created parsers and generators are fully attributed which allows you to
-easily build and handle hierarchical data structures in memory. These data
-structures resemble the structure of the input data and can directly be used to
-generate arbitrarily-formatted output.
+Both the created parsers and generators are fully attributed (more on
+that later) which allows you to easily build and handle hierarchical
+data structures in memory. These data structures resemble the
+structure of the input data and can directly be used to generate
+arbitrarily-formatted output.
 
 The [link spirit.spiritstructure figure] below depicts the overall structure
 of the Boost Spirit library. The library consists of 4 major parts:
@@ -42,19 +45,22 @@
 * __classic__: This is the almost-unchanged code base taken from the
   former Boost Spirit V1.8 distribution. It has been moved into the namespace
   boost::spirit::classic. A special compatibility layer has been added to
- ensure complete compatibility with existing code using Spirit V1.8.
+ ensure complete compatibility with existing code using Spirit V1.8.
 * __qi__: This is the parser library allowing you to build recursive
   descent parsers. The exposed domain-specific language can be used to describe
   the grammars to implement, and the rules for storing the parsed information.
 * __lex__: This is the library usable to create tokenizers (lexers). The
- domain-specific language exposed by __lex__
+ domain-specific language exposed by __lex__ allows to define regular
+ expressions used to match tokens (create token definitions), associate these
+ regular expressions with code to be executed whenever they are matched, and
+ to add the token definitions to the lexical analyzer.
 * __karma__: This is the generator library allowing you to create code for
   recursive descent, data type-driven output formatting. The exposed
   domain-specific language is almost equivalent to the parser description language
   used in __qi__, except that it is used to describe the required output
   format to generate from a given data structure.
 
-[fig ./images/spiritstructure.png..The overall structure of the Boost Spirit library..spirit.spiritstructure]
+[fig spiritstructure.png..The overall structure of the Boost Spirit library..spirit.spiritstructure]
 
 The separate sublibraries __qi__, __karma__ and __lex__ are well integrated
 with any of the other parts. Because of their similar structure and identical
@@ -71,7 +77,7 @@
 external representation. The picture highlights Spirit's place in this data
 transformation flow.
 
-[fig ./images/spiritkarmaflow.png..The place of __qi__ and __karma__ in a data transformation flow of a typical application..spirit.spiritkarmaflow]
+[fig spiritkarmaflow.png..The place of __qi__ and __karma__ in a data transformation flow of a typical application..spirit.spiritkarmaflow]
 
 [heading A Quick Overview of Parsing with __qi__]
 
@@ -115,15 +121,15 @@
     1 + ((6 * 200) - 20) / 6
     (1 + (2 + (3 + (4 + 5))))
 
-Certainly we have done some modifications to the original EBNF syntax. This is
-done to conform to C++ syntax rules. Most notably we see the abundance of
-shift >> operators. Since there are no 'empty' operators in C++, it is simply
-not possible to write something like:
+Certainly we have modified the original EBNF syntax. This is done to
+conform to C++ syntax rules. Most notably we see the abundance of
+shift >> operators. Since there are no 'empty' operators in C++, it is
+simply not possible to write something like:
 
     a b
 
 as seen in math syntax, for example, to mean multiplication or, in our case,
-as seen in EBNF syntax to mean sequencing (b should follow a). Spirit
+as seen in EBNF syntax to mean sequencing (b should follow a). __qi__
 uses the shift `>>` operator instead for this purpose. We take the `>>` operator,
 with arrows pointing to the right, to mean "is followed by". Thus we write:
 
@@ -172,22 +178,25 @@
 [table Different output formats for `std::vector<int>`
     [ [Format] [Example] [Description] ]
     [ [`'[' << *(int_ << ',') << ']'`] [`[1,8,10,]`] [Comma separated list of integers] ]
- [ [`*('(' << int_ << ')' << ',')`] [`(1),(8),(10),]`] [Comma separated list of integers in parenthesis] ]
+ [ [`*('(' << int_ << ')' << ',')`] [`(1),(8),(10),`] [Comma separated list of integers in parenthesis] ]
     [ [`*hex`] [`18a`] [A list of hexadecimal numbers] ]
     [ [`*(double_ << ',')`] [`1.0,8.0,10.0,`] [A list of floating point numbers] ]
 ]
 
-The syntax is similar to /Qi/ with the exception that we use the `<<`
+We will see later in this documentation how it is possible to avoid printing
+the trailing `','`.
+
+Overall, the syntax is similar to __qi__ with the exception that we use the `<<`
 operator for output concatenation. This should be easy to understand as it
 follows the conventions used in the Standard's I/O streams.
 
-Another important feature of /karma/ allows you to fully decouple the data
+Another important feature of __karma__ allows you to fully decouple the data
 type from the output format. You can use the same output format with different
 data types as long as these conform conceptually. The next table gives some
 related examples.
 
 [table Different data types usable with the output format `*(int_ << eol)`
- [ [Data type] ]
+ [ [Data type] [Description] ]
     [ [`int i[4]`] [C style arrays] ]
     [ [`std::vector<int>`] [Standard vector] ]
     [ [`std::list<int>`] [Standard list] ]

Modified: branches/release/libs/spirit/doc/lex.qbk
==============================================================================
--- branches/release/libs/spirit/doc/lex.qbk (original)
+++ branches/release/libs/spirit/doc/lex.qbk 2009-09-14 12:45:39 EDT (Mon, 14 Sep 2009)
@@ -1,12 +1,12 @@
 [/==============================================================================
- Copyright (C) 2001-2008 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)
 ===============================================================================/]
 
-[section:lex __lex__]
+[section:lex Lex - Writing Lexical Analyzers]
 
 [include lex/introduction.qbk]
 
@@ -32,19 +32,19 @@
 [endsect]
 
 [section:quick_reference Quick Reference]
+[include lex/quick_reference.qbk]
 [endsect]
 
 [section:reference Reference]
-[section:concepts Concepts]
-[include reference/lex/lexer.qbk]
-[include reference/lex/token.qbk]
-[include reference/lex/tokendef.qbk]
-[include reference/lex/tokenset.qbk]
-[endsect]
-[include reference/lex/lexer_class.qbk]
-[include reference/lex/token_class.qbk]
-[include reference/lex/tokendef_class.qbk]
-[include reference/lex/tokenset_class.qbk]
+[import ../example/lex/reference.cpp]
+[include lex/concepts.qbk]
+[include lex/basics.qbk]
+[include lex/token_primitives.qbk]
+[/include lex/token.qbk]
+[/include lex/tokendef.qbk]
+[include lex/lexer_class.qbk]
+[include lex/token_class.qbk]
+[include lex/tokendef_class.qbk]
 [endsect]
 
 [endsect]

Modified: branches/release/libs/spirit/doc/lex/introduction.qbk
==============================================================================
--- branches/release/libs/spirit/doc/lex/introduction.qbk (original)
+++ branches/release/libs/spirit/doc/lex/introduction.qbk 2009-09-14 12:45:39 EDT (Mon, 14 Sep 2009)
@@ -1,5 +1,5 @@
 [/==============================================================================
- Copyright (C) 2001-2008 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
@@ -148,7 +148,7 @@
 the fly by analyzing the underlying character sequence and
 matching this to the patterns as defined by the application.
 
-[fig ./images/lexerflow.png..The Library structure and Common Flow of Information while using __lex__ in an application..spirit.lexerflow]
+[fig lexerflow.png..The Library structure and Common Flow of Information while using __lex__ in an application..spirit.lexerflow]
 
 
 [endsect]

Modified: branches/release/libs/spirit/doc/lex/lexer_attributes.qbk
==============================================================================
--- branches/release/libs/spirit/doc/lex/lexer_attributes.qbk (original)
+++ branches/release/libs/spirit/doc/lex/lexer_attributes.qbk 2009-09-14 12:45:39 EDT (Mon, 14 Sep 2009)
@@ -1,5 +1,5 @@
 [/==============================================================================
- Copyright (C) 2001-2008 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

Modified: branches/release/libs/spirit/doc/lex/lexer_primitives.qbk
==============================================================================
--- branches/release/libs/spirit/doc/lex/lexer_primitives.qbk (original)
+++ branches/release/libs/spirit/doc/lex/lexer_primitives.qbk 2009-09-14 12:45:39 EDT (Mon, 14 Sep 2009)
@@ -1,5 +1,5 @@
 [/==============================================================================
- Copyright (C) 2001-2008 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
@@ -8,7 +8,7 @@
 
 [section:lexer_primitives Lexer Primitives]
 
-[/ Describe the primitive lexer constructs, such as token_def, token_set? ]
+[/ Describe the primitive lexer constructs, such as token_def, lexer ]
 
 [/ Describe the primitive lexer constructs usable in parsers, such as
    in_state[], set_state(), token(), etc. ]

Modified: branches/release/libs/spirit/doc/lex/lexer_quickstart1.qbk
==============================================================================
--- branches/release/libs/spirit/doc/lex/lexer_quickstart1.qbk (original)
+++ branches/release/libs/spirit/doc/lex/lexer_quickstart1.qbk 2009-09-14 12:45:39 EDT (Mon, 14 Sep 2009)
@@ -1,5 +1,5 @@
 [/==============================================================================
- Copyright (C) 2001-2008 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
@@ -13,7 +13,7 @@
 integrated with the other parts of __spirit__ but nevertheless can be used
 separately to build standalone lexical analyzers.
 The first quick start example describes a standalone application:
-counting characters, words and lines in a file, very similar to what the well
+counting characters, words, and lines in a file, very similar to what the well
 known Unix command `wc` is doing (for the full example code see here:
 [@../../example/lex/word_count_functor.cpp word_count_functor.cpp]).
 
@@ -53,8 +53,8 @@
 we need to implement a functor taking at least the generated token as an
 argument and returning a boolean value allowing to stop the tokenization
 process. The default token type used in this example carries a token value of
-the type `iterator_range<BaseIterator>` pointing to the matched range in the
-underlying input sequence.
+the type __boost_iterator_range__`<BaseIterator>` pointing to the matched
+range in the underlying input sequence.
 
 [wcf_functor]
 
@@ -72,7 +72,7 @@
 
 [heading Comparing __lex__ with __flex__]
 
-This example was deliberately chosen to be similar as much as possible to the
+This example was deliberately chosen to be as much as possible similar to the
 equivalent __flex__ program (see below), which isn't too different from what
 has to be written when using __lex__.
 

Modified: branches/release/libs/spirit/doc/lex/lexer_quickstart2.qbk
==============================================================================
--- branches/release/libs/spirit/doc/lex/lexer_quickstart2.qbk (original)
+++ branches/release/libs/spirit/doc/lex/lexer_quickstart2.qbk 2009-09-14 12:45:39 EDT (Mon, 14 Sep 2009)
@@ -1,5 +1,5 @@
 [/==============================================================================
- Copyright (C) 2001-2008 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
@@ -12,7 +12,7 @@
 section __sec_lex_quickstart_1__ as being overly complex and not being
 written to leverage the possibilities provided by this tool. In particular the
 previous example did not directly use the lexer actions to count the lines,
-words and characters. So the example provided in this step of the tutorial will
+words, and characters. So the example provided in this step of the tutorial will
 show how to use semantic actions in __lex__. Even if it still
 will allow to count text elements only it introduces other new concepts and
 configuration options along the lines (for the full example code
@@ -24,11 +24,11 @@
 [heading Prerequisites]
 
 In addition to the only required `#include` specific to /Spirit.Lex/ this
-example needs to include a couple of header files from the __phoenix2__
+example needs to include a couple of header files from the __boost_phoenix__
 library. This example shows how to attach functors to token definitions, which
 could be done using any type of C++ technique resulting in a callable object.
-Using __phoenix2__ for this task simplifies things and avoids adding
-dependencies to other libraries (__phoenix2__ is already in use for
+Using __boost_phoenix__ for this task simplifies things and avoids adding
+dependencies to other libraries (__boost_phoenix__ is already in use for
 __spirit__ anyway).
 
 [wcl_includes]
@@ -59,54 +59,16 @@
 the lexical analyzer. This is very similar to __flex__, where the action code
 associated with a token definition gets executed after the recognition of a
 matching input sequence. The code above uses function objects constructed using
-__phoenix2__, but it is possible to insert any C++ function or function object
-as long as it exposes the interface:
-
- void f (Range r, Idtype id, bool& matched, Context& ctx);
-
-[variablelist where:
- [[`Range r`] [This is a `boost::iterator_range` holding two
- iterators pointing to the matched range in the
- underlying input sequence. The type of the
- held iterators is the same as specified while
- defining the type of the `lexertl_lexer<...>`
- (its first template parameter).]]
- [[`Idtype id`] [This is the token id of the type `std::size_t`
- for the matched token.]]
- [[`bool& matched`] [This boolean value is pre/initialized to `true`.
- If the functor sets it to `false` the lexer
- stops calling any semantic actions attached to
- this token and behaves as if the token have not
- been matched in the first place.]]
- [[`Context& ctx`] [This is a reference to a lexer specific,
- unspecified type, providing the context for the
- current lexer state. It can be used to access
- different internal data items and is needed for
- lexer state control from inside a semantic
- action.]]
-]
-
-When using a C++ function as the semantic action the following prototypes are
-allowed as well:
-
- void f (Range r, Idtype id, bool& matched);
- void f (Range r, Idtype id);
- void f (Range r);
-
-Even if it is possible to write your own function object implementations (i.e.
-using Boost.Lambda or Boost.Bind), the preferred way of defining lexer semantic
-actions is to use __phoenix2__. In this case you can access the four parameters
-described in the table above by using the predefined __spirit__ placeholders:
-`_1` for the iterator range, `_2` for the token id, `_3` for the reference
-to the boolean value signaling the outcome of the semantic action, and `_4` for
-the reference to the internal lexer context.
+__boost_phoenix__, but it is possible to insert any C++ function or function object
+as long as it exposes the proper interface. For more details on please refer
+to the section __sec_lex_semactions__.
 
 [heading Associating Token Definitions with the Lexer]
 
-If you compare the with the code from __sec_lex_quickstart_1__ with regard to
-the way how token definitions are associated with the lexer, you will notice
-a different syntax being used here. If in the previous example we have been
-using the `self.add()` style of the API, then here we directly assign the token
+If you compare this code to the code from __sec_lex_quickstart_1__ with regard
+to the way how token definitions are associated with the lexer, you will notice
+a different syntax being used here. In the previous example we have been
+using the `self.add()` style of the API, while we here directly assign the token
 definitions to `self`, combining the different token definitions using the `|`
 operator. Here is the code snippet again:
 
@@ -122,11 +84,19 @@
 
 A second difference to the previous example is that we do not explicitly
 specify any token ids to use for the separate tokens. Using semantic actions to
-trigger some useful work free'd us from the need to define these. To ensure
+trigger some useful work has freed us from the need to define those. To ensure
 every token gets assigned a id the __lex__ library internally assigns unique
 numbers to the token definitions, starting with the constant defined by
 `boost::spirit::lex::min_token_id`.
 
+[heading Pulling everything together]
+
+In order to execute the code defined above we still need to instantiate an
+instance of the lexer type, feed it from some input sequence and create a pair
+of iterators allowing to iterate over the token sequence as created by the
+lexer. This code shows how to achieve these steps:
+
+[wcl_main]
 
 
 [endsect]

Modified: branches/release/libs/spirit/doc/lex/lexer_quickstart3.qbk
==============================================================================
--- branches/release/libs/spirit/doc/lex/lexer_quickstart3.qbk (original)
+++ branches/release/libs/spirit/doc/lex/lexer_quickstart3.qbk 2009-09-14 12:45:39 EDT (Mon, 14 Sep 2009)
@@ -1,5 +1,5 @@
 [/==============================================================================
- Copyright (C) 2001-2008 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
@@ -20,7 +20,7 @@
 library. The [link spirit.lex.flowcontrol picture] below shows the common
 flow control implemented while parsing combined with lexical analysis.
 
-[fig ./images/flowofcontrol.png..The common flow control implemented while parsing combined with lexical analysis..spirit.lex.flowcontrol]
+[fig flowofcontrol.png..The common flow control implemented while parsing combined with lexical analysis..spirit.lex.flowcontrol]
 
 Another problem related to the integration of the lexical analyzer with the
 parser was to find a way how the defined tokens syntactically could be blended
@@ -41,11 +41,11 @@
 
 This example uses two of the __spirit__ library components: __lex__ and __qi__,
 consequently we have to `#include` the corresponding header files. Again, we
-need to include a couple of header files from the __phoenix2__ library. This
+need to include a couple of header files from the __boost_phoenix__ library. This
 example shows how to attach functors to parser components, which
 could be done using any type of C++ technique resulting in a callable object.
-Using __phoenix2__ for this task simplifies things and avoids adding
-dependencies to other libraries (__phoenix2__ is already in use for
+Using __boost_phoenix__ for this task simplifies things and avoids adding
+dependencies to other libraries (__boost_phoenix__ is already in use for
 __spirit__ anyway).
 
 [wcp_includes]
@@ -126,16 +126,6 @@
 the `_1` placeholder) and uses it to calculate the number of matched
 characters: `ref(c) += size(_1)`.
 
-[important All placeholders (`_1`, `_2`, etc.) used in /parser/ semantic
- actions in conjunction with functors created based on __phoenix2__
- need to be imported from the `namespace boost::spirit::arg_names`
- (and *not* `namespace boost::phoenix::arg_names`, which is
- different from using placeholders in __lex__).
- Using the wrong placeholders leads to subtle compilation errors
- which are difficult to backtrack to their cause.
-]
-
-
 [heading Pulling Everything Together]
 
 The main function needs to implement a bit more logic now as we have to

Modified: branches/release/libs/spirit/doc/lex/lexer_semantic_actions.qbk
==============================================================================
--- branches/release/libs/spirit/doc/lex/lexer_semantic_actions.qbk (original)
+++ branches/release/libs/spirit/doc/lex/lexer_semantic_actions.qbk 2009-09-14 12:45:39 EDT (Mon, 14 Sep 2009)
@@ -1,5 +1,5 @@
 [/==============================================================================
- Copyright (C) 2001-2008 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,4 +7,176 @@
 ===============================================================================/]
 
 [section:lexer_semantic_actions Lexer Semantic Actions]
+
+The main task of a lexer normally is to recognize tokens in the input.
+Traditionally this has been complemented with the possibility to execute
+arbitrary code whenever a certain token has been detected. __lex__ has been
+designed to support this mode of operation as well. We borrow from the concept
+of semantic actions for parsers (__qi__) and generators (__karma__). Lexer
+semantic actions may be attached to any token definition. These are C++
+functions or function objects that are called whenever a token definition
+successfully recognizes a portion of the input. Say you have a token definition
+`D`, and a C++ function `f`, you can make the lexer call `f` whenever it matches
+an input by attaching `f`:
+
+ D[f]
+
+The expression above links `f` to the token definition, `D`. The required
+prototype of `f` is:
+
+ void f (Iterator& start, Iterator& end, pass_flag& matched, Idtype& id, Context& ctx);
+
+[variablelist where:
+ [[`Iterator& start`] [This is a the iterator pointing to the begin of the
+ matched range in the underlying input sequence. The
+ type of the iterator is the same as specified while
+ defining the type of the `lexertl_lexer<...>`
+ (its first template parameter). The semantic action
+ is allowed to change the value of this iterator
+ influencing, the matched input sequence.]]
+ [[`Iterator& end`] [This is a the iterator pointing to the end of the
+ matched range in the underlying input sequence. The
+ type of the iterator is the same as specified while
+ defining the type of the `lexertl_lexer<...>`
+ (its first template parameter). The semantic action
+ is allowed to change the value of this iterator
+ influencing, the matched input sequence.]]
+ [[`pass_flag& matched`] [This value is pre/initialized to `pass_normal`.
+ If the semantic action sets it to `pass_fail` the
+ behaves as if the token has not been matched in
+ the first place. If the semantic action sets this
+ to `pass_ignore` the lexer ignores the current
+ token and tries to match a next token from the
+ input.]]
+ [[`Idtype& id`] [This is the token id of the type Idtype (most of
+ the time this will be a `std::size_t`) for the
+ matched token. The semantic action is allowed to
+ change the value of this token id, influencing the
+ if of the created token.]]
+ [[`Context& ctx`] [This is a reference to a lexer specific,
+ unspecified type, providing the context for the
+ current lexer state. It can be used to access
+ different internal data items and is needed for
+ lexer state control from inside a semantic
+ action.]]
+]
+
+When using a C++ function as the semantic action the following prototypes are
+allowed as well:
+
+ void f (Iterator& start, Iterator& end, pass_flag& matched, Idtype& id);
+ void f (Iterator& start, Iterator& end, pass_flag& matched);
+ void f (Iterator& start, Iterator& end);
+ void f ();
+
+[heading The context of a lexer semantic action]
+
+The last parameter passed to any lexer semantic action is a reference to an
+unspecified type (see the `Context` type in the table above). This type is
+unspecified because it depends on the token type returned by the lexer. It is
+implemented in the internals of the iterator type exposed by the lexer.
+Nevertheless, any context type is expected to expose a couple of
+functions allowing to influence the behavior of the lexer. The following table
+gives an overview and a short description of the available functionality.
+
+[table Functions exposed by any context passed to a lexer semantic action
+ [[Name] [Description]]
+ [[`Iterator const& get_eoi() const`]
+ [The function `get_eoi()` may be used by to access the end iterator of
+ the input stream the lexer has been initialized with]]
+ [[`void more()`]
+ [The function `more()` tells the lexer that the next time it matches a
+ rule, the corresponding token should be appended onto the current token
+ value rather than replacing it.]]
+ [[`Iterator const& less(Iterator const& it, int n)`]
+ [The function `less()` returns an iterator positioned to the nth input
+ character beyond the current token start iterator (i.e. by passing the
+ return value to the parameter `end` it is possible to return all but the
+ first n characters of the current token back to the input stream.]]
+ [[`bool lookahead(std::size_t id)`]
+ [The function `lookahead()` can be for instance used to implement
+ lookahead for lexer engines not supporting constructs like flex' `a/b`
+ (match `a`, but only when followed by `b`). It invokes the lexer on the
+ input following the current token without actually moving forward in the
+ input stream. The function returns whether the lexer was able to match a
+ token with the given token-id `id`.]]
+ [[`std::size_t get_state() const` and `void set_state(std::size_t state)`]
+ [The functions `get_state()` and `set_state()` may be used to introspect
+ and change the current lexer state.]]
+ [[`token_value_type get_value() const` and `void set_value(Value const&)`]
+ [The functions `get_value()` and `set_value()` may be used to introspect
+ and change the current token value.]]
+]
+
+[heading Lexer Semantic Actions Using Phoenix]
+
+Even if it is possible to write your own function object implementations (i.e.
+using Boost.Lambda or Boost.Bind), the preferred way of defining lexer semantic
+actions is to use __boost_phoenix__. In this case you can access the parameters
+described above by using the predefined __spirit__ placeholders:
+
+[table Predefined Phoenix placeholders for lexer semantic actions
+ [[Placeholder] [Description]]
+ [[`_start`]
+ [Refers to the iterator pointing to the begin of the matched input
+ sequence. Any modifications to this iterator value will be reflected in
+ the generated token.]]
+ [[`_end`]
+ [Refers to the iterator pointing past the end of the matched input
+ sequence. Any modifications to this iterator value will be reflected in
+ the generated token.]]
+ [[`_pass`]
+ [References the value signaling the outcome of the semantic action. This
+ is pre-initialized to `lex::pass_flags::pass_normal`. If this is set to
+ `lex::pass_flags::pass_fail`, the lexer will behave as if no token has
+ been matched, if is set to `lex::pass_flags::pass_ignore`, the lexer will
+ ignore the current match and proceed trying to match tokens from the
+ input.]]
+ [[`_tokenid`]
+ [Refers to the token id of the token to be generated. Any modifications
+ to this value will be reflected in the generated token.]]
+ [[`_val`]
+ [Refers to the value the next token will be initialized from. Any
+ modifications to this value will be reflected in the generated token.]]
+ [[`_state`]
+ [Refers to the lexer state the input has been match in. Any modifications
+ to this value will be reflected in the lexer itself (the next match will
+ start in the new state). The currently generated token is not affected
+ by changes to this variable.]]
+ [[`_eoi`]
+ [References the end iterator of the overall lexer input. This value
+ cannot be changed.]]
+]
+
+The context object passed as the last parameter to any lexer semantic action is
+not directly accessible while using __boost_phoenix__ expressions. We rather provide
+predefine Phoenix functions allowing to invoke the different support functions
+as mentioned above. The following table lists the available support functions
+and describes their functionality:
+
+[table Support functions usable from Phoenix expressions inside lexer semantic actions
+ [[Plain function] [Phoenix function] [Description]]
+ [[`ctx.more()`]
+ [`more()`]
+ [The function `more()` tells the lexer that the next time it matches a
+ rule, the corresponding token should be appended onto the current token
+ value rather than replacing it.]]
+ [[`ctx.less()`]
+ [`less(n)`]
+ [The function `less()` takes a single integer parameter `n` and returns an
+ iterator positioned to the nth input character beyond the current token
+ start iterator (i.e. by assigning the return value to the placeholder
+ `_end` it is possible to return all but the first `n` characters of the
+ current token back to the input stream.]]
+ [[`ctx.lookahead()`]
+ [`lookahead(std::size_t)` or `lookahead(token_def)`]
+ [The function `lookahead()` takes a single parameter specifying the token
+ to match in the input. The function can be used for instance to implement
+ lookahead for lexer engines not supporting constructs like flex' `a/b`
+ (match `a`, but only when followed by `b`). It invokes the lexer on the
+ input following the current token without actually moving forward in the
+ input stream. The function returns whether the lexer was able to match
+ the specified token.]]
+]
+
 [endsect]

Modified: branches/release/libs/spirit/doc/lex/lexer_states.qbk
==============================================================================
--- branches/release/libs/spirit/doc/lex/lexer_states.qbk (original)
+++ branches/release/libs/spirit/doc/lex/lexer_states.qbk 2009-09-14 12:45:39 EDT (Mon, 14 Sep 2009)
@@ -1,5 +1,5 @@
 [/==============================================================================
- Copyright (C) 2001-2008 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

Modified: branches/release/libs/spirit/doc/lex/lexer_static_model.qbk
==============================================================================
--- branches/release/libs/spirit/doc/lex/lexer_static_model.qbk (original)
+++ branches/release/libs/spirit/doc/lex/lexer_static_model.qbk 2009-09-14 12:45:39 EDT (Mon, 14 Sep 2009)
@@ -1,5 +1,5 @@
 [/==============================================================================
- Copyright (C) 2001-2008 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
@@ -63,7 +63,7 @@
 __class_lexertl_static_lexer__ type as the template parameter.
 
 This example not only shows how to build a static lexer, but it additionally
-demonstrates, how such a lexer can be used for parsing in conjunction with a
+demonstrates how such a lexer can be used for parsing in conjunction with a
 __qi__ grammar. For completeness we provide the simple grammar used in this
 example. As you can see, this grammar does not have any dependencies on the
 static lexical analyzer, and for this reason it is not different from a grammar
@@ -82,7 +82,7 @@
 implements the whole code generator, no further code is needed. All what it
 takes to invoke this function is to supply a token definition instance, an
 output stream to use to generate the code to, and an optional string to be used
-as a prefix for the name of the generated function. All in all just a couple
+as a suffix for the name of the generated function. All in all just a couple
 lines of code.
 
 [wc_static_generate_main]
@@ -92,6 +92,13 @@
 topic (the full generated code can be viewed
 [@../../example/lex/static_lexer/word_count_static.hpp here]).
 
+[note The generated code will have compiled in the version number of the
+ current __lex__ library. This version number is used at compilation time
+ of your static lexer object to ensure this is compiled using exactly the
+ same version of the __lex__ library as the lexer tables have been
+ generated with. If the versions do not match you will see an compilation
+ error mentioning an `incompatible_static_lexer_version`.
+]
 
 [heading Modifying the Dynamic Analyzer]
 
@@ -115,5 +122,16 @@
 
 [wc_static_main]
 
+[important The generated code for the static lexer contains the token ids as
+ these have been assigned either explicitly by the programmer or
+ implicitely during lexer construction. It is your responsibility
+ to make sure that all instances of a particular static lexer
+ type use exactly the same token ids. This is ensured by default
+ as long as no `first_id` is specified during construction of the
+ static lexer instances (the constructor of the lexer object has
+ a seocnd default parameter allowing to designate a starting token
+ id to be used while assigning the ids to the token definitions).
+]
+
 
 [endsect]

Modified: branches/release/libs/spirit/doc/lex/lexer_tutorials.qbk
==============================================================================
--- branches/release/libs/spirit/doc/lex/lexer_tutorials.qbk (original)
+++ branches/release/libs/spirit/doc/lex/lexer_tutorials.qbk 2009-09-14 12:45:39 EDT (Mon, 14 Sep 2009)
@@ -1,5 +1,5 @@
 [/==============================================================================
- Copyright (C) 2001-2008 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
@@ -53,7 +53,7 @@
 introduce the __lex__ library while building two standalone applications, not
 being connected to or depending on any other part of __spirit__. The section
 __sec_lex_quickstart_3__ demonstrates how to use a lexer in conjunction with a
-parser (where certainly the parser is built using __qi__).
+parser (where obviously the parser is built using __qi__).
 
 [endsect]
 

Modified: branches/release/libs/spirit/doc/lex/parsing_using_a_lexer.qbk
==============================================================================
--- branches/release/libs/spirit/doc/lex/parsing_using_a_lexer.qbk (original)
+++ branches/release/libs/spirit/doc/lex/parsing_using_a_lexer.qbk 2009-09-14 12:45:39 EDT (Mon, 14 Sep 2009)
@@ -1,5 +1,5 @@
 [/==============================================================================
- Copyright (C) 2001-2008 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

Modified: branches/release/libs/spirit/doc/lex/token_definition.qbk
==============================================================================
--- branches/release/libs/spirit/doc/lex/token_definition.qbk (original)
+++ branches/release/libs/spirit/doc/lex/token_definition.qbk 2009-09-14 12:45:39 EDT (Mon, 14 Sep 2009)
@@ -1,5 +1,5 @@
 [/==============================================================================
- Copyright (C) 2001-2008 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

Modified: branches/release/libs/spirit/doc/lex/tokenizing.qbk
==============================================================================
--- branches/release/libs/spirit/doc/lex/tokenizing.qbk (original)
+++ branches/release/libs/spirit/doc/lex/tokenizing.qbk 2009-09-14 12:45:39 EDT (Mon, 14 Sep 2009)
@@ -1,5 +1,5 @@
 [/==============================================================================
- Copyright (C) 2001-2008 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
@@ -8,8 +8,89 @@
 
 [section:lexer_tokenizing Tokenizing Input Data]
 
-[heading The tokenize() function]
+[heading The tokenize function]
 
-[heading The generate_static() function]
+The `tokenize()` function is a helper function simplifying the usage of a lexer
+in a standalone fashion. Consider you have a standalone lexer where all the
+required functionality is implemented inside of lexer semantic actions. A good
+example for this is the [@../../example/lex/word_count_lexer.cpp word_count_lexer]
+described in more detail in the section __sec_lex_quickstart_2__.
+As a reminder, here is the token definition class:
+
+[wcl_token_definition]
+
+The construct used to tokenize the given input, while discarding all generated
+tokens is a common application of the lexer. For this reason __lex__ exposes an
+API function `tokenize()` minimizing the code required:
+
+ // Read input from the given file
+ std::string str (read_from_file(1 == argc ? "word_count.input" : argv[1]));
+
+ word_count_tokens<lexer_type> word_count_lexer;
+ std::string::iterator first = str.begin();
+
+ // Tokenize all the input, while discarding all generated tokens
+ bool r = tokenize(first, str.end(), word_count_lexer);
+
+This code is completely equivalent to the more verbose version as shown in the
+section __sec_lex_quickstart_2__. The function `tokenize()` will return either
+if the end of the input has been reached (in this case the return value will
+be `true`), or if the lexer couldn't match any of the token definitions in the
+input (in this case the return value will be `false` and the iterator `first`
+will point to the first not matched character in the input sequence).
+
+The prototype of this function is:
+
+ template <typename Iterator, typename Lexer>
+ bool tokenize(Iterator& first, Iterator last, Lexer const& lex
+ , typename Lexer::char_type const* initial_state = 0);
+
+[variablelist where:
+ [[Iterator& first] [The begin of the input sequence to tokenize. The
+ value of this iterator will be updated by the
+ lexer, pointing to the first not matched
+ character of the input after the function
+ returns.]]
+ [[Iterator last] [The end of the input sequence to tokenize.]]
+ [[Lexer const& lex] [The lexer instance to use for tokenization.]]
+ [[Lexer::char_type const* initial_state]
+ [This optional parameter can be used to specify
+ the initial lexer state fo rthe tokenization.]]
+]
+
+A second overload of the `tokenize()` function allows to specify any arbitrary
+function or function object to be called for each of the generated tokens. For
+some applications this is very useful, as it might avoid having lexer semantic
+actions. For an example of how to use this function, please have a look at
+[@../../example/lex/word_count_lexer.cpp word_count_functor.cpp]:
+
+[wcf_main]
+
+Here is the prototype of this `tokenize()` function overload:
+
+ template <typename Iterator, typename Lexer, typename F>
+ bool tokenize(Iterator& first, Iterator last, Lexer const& lex, F f
+ , typename Lexer::char_type const* initial_state = 0);
+
+[variablelist where:
+ [[Iterator& first] [The begin of the input sequence to tokenize. The
+ value of this iterator will be updated by the
+ lexer, pointing to the first not matched
+ character of the input after the function
+ returns.]]
+ [[Iterator last] [The end of the input sequence to tokenize.]]
+ [[Lexer const& lex] [The lexer instance to use for tokenization.]]
+ [[F f] [A function or function object to be called for
+ each matched token. This function is expected to
+ have the prototype: `bool f(Lexer::token_type);`
+ and should return `false` if the supplied token
+ instance is invald (the `tokenize()` function will
+ return immediatly).]]
+ [[Lexer::char_type const* initial_state]
+ [This optional parameter can be used to specify
+ the initial lexer state fo rthe tokenization.]]
+]
+
+[heading The generate_static function]
 
 [endsect]

Modified: branches/release/libs/spirit/doc/lex/tokens_values.qbk
==============================================================================
--- branches/release/libs/spirit/doc/lex/tokens_values.qbk (original)
+++ branches/release/libs/spirit/doc/lex/tokens_values.qbk 2009-09-14 12:45:39 EDT (Mon, 14 Sep 2009)
@@ -1,5 +1,5 @@
 [/==============================================================================
- Copyright (C) 2001-2008 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
@@ -56,9 +56,10 @@
 was matched in. The following [link spirit.lex.tokenstructure figure] shows the
 schematic structure of a token.
 
-[fig ./images/tokenstructure.png..The structure of a token..spirit.lex.tokenstructure]
+[fig tokenstructure.png..The structure of a token..spirit.lex.tokenstructure]
 
-The token value and the token state may be omitted for optimization reasons,
+The token value and the lexer state the token has been recogniyed in may be
+omitted for optimization reasons,
 avoiding the token to carry more data than actually required. This
 configuration can be achieved by supplying appropriate template parameters
 for the __class_lexertl_token__ template while defining the token type.
@@ -97,11 +98,11 @@
                        `char const*`.]]
     [[AttributeTypes] [This is either a mpl sequence containing all
                        attribute types used for the token definitions or the
- type `omitted`. If the mpl sequence is empty (which is
+ type `omit`. If the mpl sequence is empty (which is
                        the default), all token instances will store a
- `boost::iterator_range<Iterator>` pointing to the start
+ __boost_iterator_range__`<Iterator>` pointing to the start
                        and the end of the matched section in the input stream.
- If the type is `omitted`, the generated tokens will
+ If the type is `omit`, the generated tokens will
                        contain no token value (attribute) at all.]]
     [[HasState] [This is either `mpl::true_` or `mpl::false_`, allowing
                        to control whether the generated token instances will
@@ -112,7 +113,7 @@
 
 Normally, during its construction, a token instance always holds the
 __boost_iterator_range__ as its token value (except, if it has been defined
-using the `omitted` token value type). This iterator range then is
+using the `omit` token value type). This iterator range then is
 converted in place to the requested token value type (attribute) when it is
 requested for the first time.
 
@@ -140,7 +141,7 @@
                        `unused_type`, which means the token instance holds a
                        __boost_iterator_range__ pointing to the start
                        and the end of the matched section in the input stream.
- If the attribute is `omitted` the token instance will
+ If the attribute is `omit` the token instance will
                        expose no token type at all. Any other type will be
                        used directly as the token value type.]]
     [[Char] [This is the value type of the iterator for the
@@ -196,8 +197,8 @@
 
 [example4_token]
 
-To avoid the token to have a token value at all, the special tag `omitted` can
-be used: `token_def<omitted>` and `lexertl_token<base_iterator_type, omitted>`.
+To avoid the token to have a token value at all, the special tag `omit` can
+be used: `token_def<omit>` and `lexertl_token<base_iterator_type, omit>`.
 
 
 

Modified: branches/release/libs/spirit/doc/notes.qbk
==============================================================================
--- branches/release/libs/spirit/doc/notes.qbk (original)
+++ branches/release/libs/spirit/doc/notes.qbk 2009-09-14 12:45:39 EDT (Mon, 14 Sep 2009)
@@ -1,5 +1,5 @@
 [/==============================================================================
- Copyright (C) 2001-2008 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
@@ -8,17 +8,13 @@
 
 [section Notes]
 
-[section Portability]
-[endsect]
+[/section Portability]
+[/endsect]
 
-[section Porting from Spirit 1.8.x]
-[endsect]
+[include notes/porting_from_1_8.qbk]
+[include notes/style_guide.qbk]
 
-[section Style Guide]
-[include notes/style_guide.qbk]
-[endsect]
-
-[section Techniques]
-[endsect]
+[/section Techniques]
+[/endsect]
 
 [endsect]

Modified: branches/release/libs/spirit/doc/notes/style_guide.qbk
==============================================================================
--- branches/release/libs/spirit/doc/notes/style_guide.qbk (original)
+++ branches/release/libs/spirit/doc/notes/style_guide.qbk 2009-09-14 12:45:39 EDT (Mon, 14 Sep 2009)
@@ -1,20 +1,22 @@
 [/==============================================================================
- Copyright (C) 2001-2008 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)
 ===============================================================================/]
 
+[section Style Guide]
+
 At some point, especially when there are lots of semantic actions attached to
 various points, the grammar tends to be quite difficult to follow. In order to
 keep an easy-to-read, consistent en aesthetically pleasing look to the Spirit
 code, the following coding styleguide is advised.
 
-This coding style is adapted and extended from the ANTLR\/PCCTS style (Terrence
-Parr) and [@http://groups.yahoo.com/group/boost/files/coding_guidelines.html
-Boost coding guidelines] (David Abrahams and Nathan Myers) and is the
-combined work of Joel de Guzman, Chris Uzdavinis and Hartmut Kaiser.
+This coding style is adapted and extended from the ANTLR\/PCCTS style and
+[@http://www.boost.org/development/requirements.html Boost Library Requirements
+and Guidelines] and is the combined work of Joel de Guzman, Chris Uzdavinis,
+and Hartmut Kaiser.
 
 * Rule names use std C++ (Boost) convention. The rule name may be very long.
 * The '=' is neatly indented 4 spaces below. Like in Boost, use spaces instead
@@ -85,3 +87,5 @@
            )
>> statement_part
        ;
+
+[endsect]

Modified: branches/release/libs/spirit/doc/preface.qbk
==============================================================================
--- branches/release/libs/spirit/doc/preface.qbk (original)
+++ branches/release/libs/spirit/doc/preface.qbk 2009-09-14 12:45:39 EDT (Mon, 14 Sep 2009)
@@ -1,5 +1,5 @@
 [/==============================================================================
- Copyright (C) 2001-2008 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
@@ -9,165 +9,156 @@
 [section Preface]
 
 [:['["Examples of designs that meet most of the criteria for
-"goodness" (easy to understand, flexible, efficient) are a recursive-
-descent parser, which is traditional procedural code. Another example
-is the STL, which is a generic library of containers and algorithms
-depending crucially on both traditional procedural code and on
-parametric polymorphism.]] [*--Bjarne Stroustrup]]
+"goodness" (easy to understand, flexible, efficient) are a
+recursive-descent parser, which is traditional procedural
+code. Another example is the STL, which is a generic library of
+containers and algorithms depending crucially on both traditional
+procedural code and on parametric polymorphism.]] [*--Bjarne
+Stroustrup]]
 
 [heading History]
 
 [heading /80s/]
 
-In the Mid 80s, Joel wrote his first calculator in Pascal. It has been
-an unforgettable coding experience. He was amazed how a mutually
+In the mid-80s, Joel wrote his first calculator in Pascal. Such an
+unforgettable coding experience, he was amazed at how a mutually
 recursive set of functions can model a grammar specification. In time,
 the skills he acquired from that academic experience became very
-practical. Periodically Joel was tasked to do some parsing. For
-instance, whenever he needs to perform any form of I/O, even in
-binary, he tries to approach the task somewhat formally by writing a
-grammar using Pascal- like syntax diagrams and then write a
-corresponding recursive-descent parser. This worked very well.
+practical as he was tasked to do some parsing. For instance, whenever he
+needed to perform any form of binary or text I/O, he tried to approach
+each task somewhat formally by writing a grammar using Pascal-like
+syntax diagrams and then a corresponding recursive-descent parser. This
+process worked very well.
 
 [heading /90s/]
 
-The arrival of the Internet and the World Wide Web magnified this
-thousand-fold. At one point Joel had to write an HTML parser for a Web
-browser project. He got a recursive-descent HTML parser working based
-on the W3C formal specifications easily. He was certainly glad that
-HTML had a formal grammar specification. Because of the influence of
-the Internet, Joel then had to do more parsing. RFC specifications
-were everywhere. SGML, HTML, XML, even email addresses and those
-seemingly trivial URLs were all formally specified using small EBNF-
-style grammar specifications. This made him wish for a tool similar to
-big- time parser generators such as YACC and ANTLR, where a parser is
-built automatically from a grammar specification. Yet, he wants it to
-be extremely small; small enough to fit in my pocket, yet scalable.
-
-It must be able to practically parse simple grammars such as email
-addresses to moderately complex grammars such as XML and perhaps some
-small to medium-sized scripting languages. Scalability is a prime
-goal. You should be able to use it for small tasks such as parsing
-command lines without incurring a heavy payload, as you do when you
-are using YACC or PCCTS. Even now that it has evolved and matured to
-become a multi-module library, true to its original intent, Spirit can
-still be used for extreme micro-parsing tasks. You only pay for
-features that you need. The power of Spirit comes from its modularity
-and extensibility. Instead of giving you a sledgehammer, it gives you
-the right ingredients to create a sledgehammer easily.
-
-The result was Spirit. Spirit was a personal project that was
-conceived when Joel was doing R&D in Japan. Inspired by the GoF's
-composite and interpreter patterns, he realized that he can model a
-recursive-descent parser with hierarchical-object composition of
-primitives (terminals) and composites (productions). The original
-version was implemented with run-time polymorphic classes. A parser is
-generated at run time by feeding in production rule strings such as:
+The arrival of the Internet and the World Wide Web magnified the need
+for parsing a thousand-fold. At one point Joel had to write an HTML
+parser for a Web browser project. Using the W3C formal specifications,
+he easily wrote a recursive-descent HTML parser. With the influence of
+the Internet, RFC specifications were abundent. SGML, HTML, XML, email
+addresses and even those seemingly trivial URLs were all formally
+specified using small EBNF-style grammar specifications. Joel had more
+parsing to do, and he wished for a tool similar to larger parser
+generators such as YACC and ANTLR, where a parser is built automatically
+from a grammar specification.
+
+This ideal tool would be able to parse anything from email addresses and
+command lines, to XML and scripting languages. Scalability was a primary
+goal. The tool would be able to do this without incurring a heavy
+development load, which was not possible with the above mentioned parser
+generators. The result was Spirit.
+
+Spirit was a personal project that was conceived when Joel was involved
+in R&D in Japan. Inspired by the GoF's composite and interpreter
+patterns, he realized that he can model a recursive-descent parser with
+hierarchical-object composition of primitives (terminals) and composites
+(productions). The original version was implemented with run-time
+polymorphic classes. A parser was generated at run time by feeding in
+production rule strings such as:
 
     "prod ::= {'A' | 'B'} 'C';"
 
-A compile function compiled the parser, dynamically creating a
-hierarchy of objects and linking semantic actions on the fly. A very
-early text can be found here: __early_spirit__.
+A compile function compiled the parser, dynamically creating a hierarchy
+of objects and linking semantic actions on the fly. A very early text
+can be found here: __early_spirit__.
 
 [heading /2001 to 2006/]
 
-Version 1.0 to 1.8 was a complete rewrite of the original Spirit
-parser using expression templates and static polymorphism, inspired by
-the works of Todd Veldhuizen (__todd__exprtemplates__, C++ Report,
-June 1995). Initially, the static-Spirit version was meant only to
-replace the core of the original dynamic-Spirit. Dynamic-spirit
-needed a parser to implement itself anyway. The original employed a
-hand-coded recursive-descent parser to parse the input grammar
-specification strings. Incidentially it was the time, when Hartmut
-joined the Spirit development.
-
-After its initial "open-source" debut in May 2001, static-Spirit
-became a success. At around November 2001, the Spirit website had an
-activity percentile of 98%, making it the number one parser tool at
-Source Forge at the time. Not bad for such a niche project such as a
-parser library. The "static" portion of Spirit was forgotten and
-static-Spirit simply became Spirit. The library soon evolved to
-acquire more dynamic features.
-
-Spirit was formally accepted into __boost__ in October 2002. Boost is
-a peer-reviewed, open collaborative development effort that is a
-collection of free Open Source C++ libraries covering a wide range of
-domains. The Boost Libraries have become widely known as an industry
-standard for design and implementation quality, robustness, and
-reusability.
+Version 1.0 to 1.8 was a complete rewrite of the original Spirit parser
+using expression templates and static polymorphism, inspired by the
+works of Todd Veldhuizen (__todd__exprtemplates__, C++ Report, June
+1995). Initially, the static-Spirit version was meant only to replace
+the core of the original dynamic-Spirit. Dynamic-Spirit needed a parser
+to implement itself anyway. The original employed a hand-coded
+recursive-descent parser to parse the input grammar specification
+strings. It was at this time when Hartmut Kaiser joined the Spirit
+development.
+
+After its initial "open-source" debut in May 2001, static-Spirit became
+a success. At around November 2001, the Spirit website had an activity
+percentile of 98%, making it the number one parser tool at Source Forge
+at the time. Not bad for a niche project like a parser library. The
+"static" portion of Spirit was forgotten and static-Spirit simply became
+Spirit. The library soon evolved to acquire more dynamic features.
+
+Spirit was formally accepted into __boost__ in October 2002. Boost is a
+peer-reviewed, open collaborative development effort around a collection
+of free Open Source C++ libraries covering a wide range of domains. The
+Boost Libraries have become widely known as an industry standard for
+design and implementation quality, robustness, and reusability.
 
 [heading /2007/]
 
-Over the years, especially after Spirit was accepted into Boost,
-Spirit has served its purpose quite admirably. The focus of what we'll
-now call [*/Classic-Spirit/] (versions prior to 2.0) was on
-transduction parsing where the input string is merely translated to an
-output string. A lot of parsers are of the transduction type. When the
-time came to add attributes to the parser library, it was done rather
-in an ad-hoc manner, with the goal being 100% backward compatible with
-classic Spirit. Some parsers have attributes, some don't.
+Over the years, especially after Spirit was accepted into Boost, Spirit
+has served its purpose quite admirably. [*/Classic-Spirit/] (versions
+prior to 2.0) focused on transduction parsing, where the input string is
+merely translated to an output string. Many parsers fall into the
+transduction type. When the time came to add attributes to the parser
+library, it was done in a rather ad-hoc manner, with the goal being 100%
+backward compatible with Classic Spirit. As a result, some parsers have
+attributes, some don't.
 
 Spirit V2 is another major rewrite. Spirit V2 grammars are fully
-attributed (see __attr_grammar__). All parser components have
-attributes. To do this efficiently and ellegantly, we had to use a
-couple of infrastructure libraries. Some of which haven't been written
-yet at the time, some were quite new when Spirit debuted, and some
-needed work. __mpl__ is an important infrastructure library, yet is
-not sufficient to implement Spirit V2. Another library had to be
-written: __fusion__. Fusion sits between MPL and STL --between compile
-time and runtime -- mapping types to values. Fusion is a direct
-descendant of both MPL and __boost_tuples__ (Fusion is now a full
-fledged __boost__ library). __phoenix__ also had to be beefed up to
-support Spirit V2. The result is __phoenix2__. Last but not least,
-Spirit V2 uses an __todd__exprtemplates__ library called
+attributed (see __attr_grammar__) which means that all parser components
+have attributes. To do this efficiently and elegantly, we had to use a
+couple of infrastructure libraries. Some did not exist, some were quite
+new when Spirit debuted, and some needed work. __mpl__ is an important
+infrastructure library, yet is not sufficient to implement Spirit V2.
+Another library had to be written: __fusion__. Fusion sits between MPL
+and STL --between compile time and runtime -- mapping types to values.
+Fusion is a direct descendant of both MPL and __boost_tuples__. Fusion
+is now a full-fledged __boost__ library. __phoenix__ also had to be
+beefed up to support Spirit V2. The result is __boost_phoenix__. Last
+but not least, Spirit V2 uses an __todd__exprtemplates__ library called
 __boost_proto__.
 
+Even though it has evolved and matured to become a multi-module library,
+Spirit is still used for micro-parsing tasks as well as scripting
+languages. Like C++, you only pay for features that you need. The power
+of Spirit comes from its modularity and extensibility. Instead of giving
+you a sledgehammer, it gives you the right ingredients to easily create
+a sledgehammer.
+
 [heading New Ideas: Spirit V2]
 
-Just before the development of Spirit V2 began, Hartmut came across
-the __string_template__ library which is a part of the ANTLR parser
-framework. It is a Java template engine (with ports for C# and Python)
-for generating source code, web pages, emails, or any other formatted
-text output. With it, he got the the idea of using a formal notation
-(a grammar) to describe the expected structure of an input character
-sequence. The same grammar may be used to formalize the structure of a
-corresponding output character sequence. This is possible because
-parsing, most of the time, is implemented by comparing the input with
-the patterns defined by the grammar. If we use the same patterns to
-format a matching output, the generated sequence will follow the rules
-of the grammar as well.
-
-This insight lead to the implementation of a grammar driven output generation
-library compatibile with the Spirit parser library. As it turned out, parsing
-and generation are tightly connected and have very similar concepts. The
-duality of these two sides of the same medal is ubiquitous, which
-allowed us to build the parser library __qi__ and the generator library
-__karma__ using the same component infastructure.
-
-The idea of creating a lexer library well integrated with the Spirit parsers is
-not new. This has been discussed almost for the whole time of the existence of
-Classic-Spirit (pre V2) now. Several attempts to integrate existing lexer
-libraries and frameworks with Spirit have been made and served as a proof of
-concept and usability (for example see __wave__: The Boost C/C++ Preprocessor
-Library, and __slex__: a fully dynamic C++ lexer implemented with Spirit).
-Based on these experiences we added __lex__: a fully integrated lexer library
-to the mix, allowing to take advantage of the power of regular expressions for
-token matching, removing pressure from the parser components, simplifying
-parser grammars. Again, Spirit's modular structure allowed us to reuse the same
+Just before the development of Spirit V2 began, Hartmut came across the
+__string_template__ library that is a part of the ANTLR parser
+framework. ['attribute quote to http://www.stringtemplate.org/] It is a
+Java template engine (with ports for C# and Python) for generating
+source code, web pages, emails, or any other formatted text output.
+['end of quote!] The concepts presented in that library lead Hartmut to
+the next step in the evolution of Spirit. Parsing and generation are
+tightly connected to a formal notation, or a grammar. The grammar
+describes both input and output, and therefore, a parser library should
+have a grammar driven output. This duality is expressed in Spirit by the
+parser library __qi__ and the generator library __karma__ using the same
+component infastructure.
+
+The idea of creating a lexer library well integrated with the Spirit
+parsers is not new. This has been discussed almost since Classic-Spirit
+(pre V2) initially debuted. Several attempts to integrate existing lexer
+libraries and frameworks with Spirit have been made and served as a
+proof of concept and usability (for example see __wave__: The Boost
+C/C++ Preprocessor Library, and __slex__: a fully dynamic C++ lexer
+implemented with Spirit). Based on these experiences we added __lex__: a
+fully integrated lexer library to the mix, allowing the user to take
+advantage of the power of regular expressions for token matching,
+removing pressure from the parser components, simplifying parser
+grammars. Again, Spirit's modular structure allowed us to reuse the same
 underlying component library as for the parser and generator libraries.
 
-
 [heading How to use this manual]
 
-Each major section (there are two: __sec_qi_and_karma__, and __sec_lex__) is
-roughly divided into 3 parts:
+Each major section (there are 3: __sec_qi__, __sec_karma__, and
+__sec_lex__) is roughly divided into 3 parts:
 
 # Tutorials: A step by step guide with heavily annotated code. These
   are meant to get the user acquainted with the library as quickly as
   possible. The objective is to build the confidence of the user in
- using the library using abundant examples and detailed instructions.
- Examples speak volumes.
+ using the library through abundant examples and detailed
+ instructions. Examples speak volumes and we have volumes of
+ examples!
 
 # Abstracts: A high level summary of key topics. The objective is to
   give the user a high level view of the library, the key concepts,
@@ -202,16 +193,16 @@
                                         trouble if ignored]]
 ]
 
-This documentation is automatically generated by Boost QuickBook documentation
-tool. QuickBook can be found in the __boost_tools__.
+This documentation is automatically generated by Boost QuickBook
+documentation tool. QuickBook can be found in the __boost_tools__.
 
 [heading Support]
 
-Please direct all questions to Spirit's mailing list. You can subscribe to the
-__spirit_list__. The mailing list has a searchable archive. A search link to
-this archive is provided in __spirit__'s home page. You may also read and post
-messages to the mailing list through __spirit_general__ (thanks to __gmane__).
-The news group mirrors the mailing list. Here is a link to the archives:
-__mlist_archive__.
+Please direct all questions to Spirit's mailing list. You can subscribe
+to the __spirit_list__. The mailing list has a searchable archive. A
+search link to this archive is provided in __spirit__'s home page. You
+may also read and post messages to the mailing list through
+__spirit_general__ (thanks to __gmane__). The news group mirrors the
+mailing list. Here is a link to the archives: __mlist_archive__.
 
 [endsect] [/ Preface]

Deleted: branches/release/libs/spirit/doc/qi_and_karma.qbk
==============================================================================
--- branches/release/libs/spirit/doc/qi_and_karma.qbk 2009-09-14 12:45:39 EDT (Mon, 14 Sep 2009)
+++ (empty file)
@@ -1,65 +0,0 @@
-[/==============================================================================
- Copyright (C) 2001-2008 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)
-===============================================================================/]
-
-[section Qi and Karma]
-
-[section Tutorials]
-[include qi_and_karma/tutorial_intro.qbk]
-[include qi_and_karma/warming_up.qbk]
-[include qi_and_karma/actions.qbk]
-[include qi_and_karma/complex.qbk]
-[include qi_and_karma/sum_tutorial.qbk]
-[include qi_and_karma/num_list2.qbk]
-[include qi_and_karma/num_list3.qbk]
-[include qi_and_karma/num_list4.qbk]
-[include qi_and_karma/roman.qbk]
-[include qi_and_karma/employee.qbk]
-[include qi_and_karma/mini_xml.qbk]
-[include qi_and_karma/error_handling.qbk]
-[endsect]
-
-[section Abstracts]
-[include qi_and_karma/peg.qbk]
-[include qi_and_karma/parsing.qbk]
-[include qi_and_karma/generating.qbk]
-[include qi_and_karma/primitives.qbk]
-[include qi_and_karma/operators.qbk]
-[include qi_and_karma/attributes.qbk]
-[include qi_and_karma/semantic_actions.qbk]
-[include qi_and_karma/directives.qbk]
-[include qi_and_karma/rules.qbk]
-[include qi_and_karma/grammars.qbk]
-[include qi_and_karma/debugging.qbk]
-[include qi_and_karma/error_handling.qbk]
-[include qi_and_karma/parse_trees_and_asts.qbk]
-[endsect]
-
-[/section Quick Reference]
-[include qi_and_karma/quick_reference.qbk]
-[/endsect]
-
-[section Reference]
-[section Concepts]
-[include reference/qi_and_karma/parser.qbk]
-[include reference/qi_and_karma/generator.qbk]
-[endsect]
-[include reference/qi_and_karma/char.qbk]
-[include reference/qi_and_karma/string.qbk]
-[include reference/qi_and_karma/numeric.qbk]
-[include reference/qi_and_karma/binary.qbk]
-[include reference/qi_and_karma/directive.qbk]
-[include reference/qi_and_karma/action.qbk]
-[include reference/qi_and_karma/nonterminal.qbk]
-[include reference/qi_and_karma/operator.qbk]
-[include reference/qi_and_karma/stream.qbk]
-[include reference/qi_and_karma/auxiliary.qbk]
-[include reference/qi_and_karma/debug.qbk]
-[endsect]
-
-[endsect]
-

Modified: branches/release/libs/spirit/doc/rationale.qbk
==============================================================================
--- branches/release/libs/spirit/doc/rationale.qbk (original)
+++ branches/release/libs/spirit/doc/rationale.qbk 2009-09-14 12:45:39 EDT (Mon, 14 Sep 2009)
@@ -1,5 +1,5 @@
 [/==============================================================================
- Copyright (C) 2001-2008 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

Modified: branches/release/libs/spirit/doc/reference_template.qbk
==============================================================================
--- branches/release/libs/spirit/doc/reference_template.qbk (original)
+++ branches/release/libs/spirit/doc/reference_template.qbk 2009-09-14 12:45:39 EDT (Mon, 14 Sep 2009)
@@ -1,11 +1,12 @@
-[/==============================================================================
- Copyright (C) 2001-2008 Joel de Guzman
- Copyright (C) 2001-2008 Hartmut Kaiser
-
- Distributed under the Boost Software License, Version 1.0. (See accompanying
- file LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt)
-===============================================================================/]
+[section Module]
 
+[heading Module Headers]
+
+ #include <boost/spirit/xxx.hpp>
+
+Also, see __include_structure__.
+
+[/------------------------------------------------------------------------------]
 [section XXX]
 
 [heading Description]
@@ -16,6 +17,17 @@
 
     #include <boost/spirit/xxx.hpp>
 
+ ...
+
+Also, see __include_structure__.
+
+[heading Namespace]
+
+[table
+ [[Name]]
+ [[`boost::spirit::xx`]]
+]
+
 [heading Synopsis]
 
     template <typename T>
@@ -30,27 +42,38 @@
 
 [heading Model of]
 
-Link to concept
-
-[heading Objects]
-
-Objects provided by the library
-
 [variablelist Notation
     [[`xxx`] [An XXX]]
 ]
 
+[heading Expression Semantics]
+
 Semantics of an expression is defined only where it differs from, or is not
 defined in _concept-of_XXX_.
 
 [table
- [[Expression] [Semantics] [Return type] [Complexity]]
- [[`xxx`] [Semantics of `xxx`] [XXX] [Constant]]
+ [[Expression] [Semantics]]
+ [[`xxx`] [Semantics of `xxx`]]
 ]
 
+[heading Attributes]
+
+See __qi_comp_attr_notation__.
+
+[table
+ [[Expression] [Attribute]]
+ [[`xxx`] [Attribute of `xxx`]]
+]
+
+[heading Complexity]
+
+Big-O complexity of the parser
+
 [heading Example]
 
 Real example code. Use Quickbook import mechanism to link to actual
 working code snippets here.
 
-[endsect]
+[endsect] [/ XXX]
+
+[endsect] [/ Module]

Modified: branches/release/libs/spirit/doc/references.qbk
==============================================================================
--- branches/release/libs/spirit/doc/references.qbk (original)
+++ branches/release/libs/spirit/doc/references.qbk 2009-09-14 12:45:39 EDT (Mon, 14 Sep 2009)
@@ -1,5 +1,5 @@
 [/==============================================================================
- Copyright (C) 2001-2008 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

Modified: branches/release/libs/spirit/doc/spirit2.qbk
==============================================================================
--- branches/release/libs/spirit/doc/spirit2.qbk (original)
+++ branches/release/libs/spirit/doc/spirit2.qbk 2009-09-14 12:45:39 EDT (Mon, 14 Sep 2009)
@@ -1,5 +1,5 @@
 [/==============================================================================
- Copyright (C) 2001-2008 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
@@ -8,9 +8,9 @@
 
 [article Spirit
     [quickbook 1.4]
- [version 2.0]
+ [version 2.1]
     [authors [de Guzman, Joel], [Kaiser, Hartmut]]
- [copyright 2001 2002 2003 2004 2005 2006 2007 2008 Joel de Guzman, Hartmut Kaiser]
+ [copyright 2001 2002 2003 2004 2005 2006 2007 2008 2009 Joel de Guzman, Hartmut Kaiser]
     [purpose Parser and Generator Library]
     [license
         Distributed under the Boost Software License, Version 1.0.
@@ -26,20 +26,23 @@
 [def __spirit__ [@http://spirit.sourceforge.net Spirit]]
 [def __spirit_list__ [@http://www.nabble.com/The-Spirit-Parser-Library-f3430.html Spirit General List]]
 [def __phoenix__ [@../../phoenix/doc/html/index.html Phoenix]]
-[def __phoenix2__ [@../../phoenix/doc/html/index.html Phoenix2]]
-[def __fusion__ [@http://spirit.sourceforge.net/dl_more/fusion_v2/libs/fusion/doc/html/index.html Fusion]]
-[def __mpl__ [@http://www.boost.org/libs/mpl/index.html MPL]]
-[def __boost_tuples__ [@http://www.boost.org/libs/tuple/index.html Boost.Tuples]]
-[def __boost_proto__ -Boost.Proto-]
+[def __boost_phoenix__ [@../../phoenix/doc/html/index.html Boost.Phoenix]]
+[def __fusion__ [@boost:/libs/fusion/doc/html/index.html Boost.Fusion]]
+[def __mpl__ [@http://www.boost.org/libs/mpl/index.html Boost.Mpl]]
+[def __stl__ [@http://www.sgi.com/tech/stl/ STL]]
 [def __boost__ [@http://www.boost.org/ Boost]]
 [def __boost_tools__ [@http://www.boost.org/tools/index.html Boost Tools]]
 [def __spirit_list__ [@https://lists.sourceforge.net/lists/listinfo/spirit-general Spirit Mailing List]]
 [def __spirit_general__ [@news://news.gmane.org/gmane.comp.spirit.general Spirit General NNTP news portal]]
 [def __gmane__ [@http://www.gmane.org Gmane]]
 [def __mlist_archive__ [@http://news.gmane.org/gmane.comp.parsers.spirit.general]]
+[def __repo__ [@../../repository/doc/html/index.html Repository]]
 
 [def __early_spirit__ [@http://spirit.sourceforge.net/dl_docs/pre-spirit.htm pre-Spirit]]
 [def __todd__exprtemplates__ [@http://ubiety.uwaterloo.ca/~tveldhui/papers/Expression-Templates/exprtmpl.html Expression Templates]]
+[/ Ideally, this would link to the references section but there doesn't seem to be
+ a way to do it!]
+[def __ebnf_intro__ [@http://www.csci.csusb.edu/dick/maths/intro_ebnf.html EBNF intro]]
 [def __cpp_concepts__ [@http://en.wikipedia.org/wiki/C%2B%2B0x#Concept Concepts]]
 [def __attr_grammar__ [@http://en.wikipedia.org/wiki/Attribute_grammar Attribute Grammar]]
 [def __string_template__ [@http://www.stringtemplate.org/ StringTemplate]]
@@ -50,25 +53,48 @@
 [def __re2c__ [@http://re2c.sourceforge.net/ re2c]]
 [def __ragel__ [@http://www.cs.queensu.ca/~thurston/ragel/ Ragel]]
 
-[def __boost_variant__ [@http://www.boost.org/doc/html/variant.html `boost.variant<>`]]
-[def __boost_iterator_range__ [@http://www.boost.org/libs/range/doc/utility_class.html#iter_range `boost::iterator_range<>`]]
-[def __boost_bind__ [@http://www.boost.org/libs/bind/index.html Boost.Bind]]
-[def __boost_lambda__ [@http://www.boost.org/libs/lambda/index.html Boost.Lambda]]
+[def __boost_variant__ [@http://www.boost.org/doc/html/variant.html Boost.Variant]]
+[def __boost_iterator_range__ [@boost:/libs/range/doc/utility_class.html#iter_range `boost::iterator_range`]]
+[def __boost_bind__ [@boost:/libs/bind/index.html Boost.Bind]]
+[def __boost_lambda__ [@boost:/libs/lambda/index.html Boost.Lambda]]
+[def __boost_tuples__ [@boost:/libs/tuple/index.html Boost.Tuples]]
+[def __boost_proto__ [@boost:/libs/proto/doc/html/proto.html Boost.Proto]]
+[def __boost_format__ [@boost:/libs/format/index.html Boost.Format]]
+[def __boost_any__ [@boost:/libs/any/index.html Boost.Any]]
 
-
-[def __classic__ /Spirit.Classic/]
+[def __classic__ [@boost:/libs/spirit/classic/index.html /Spirit.Classic/]]
 [def __qi__ /Spirit.Qi/]
 [def __karma__ /Spirit.Karma/]
 [def __lex__ /Spirit.Lex/]
 
+[def __mpl_boolean_constant__ [@boost:/libs/mpl/doc/refmanual/integral-constant.html MPL Boolean Constant]]
+[def __mpl_int_constant__ [@boost:/libs/mpl/doc/refmanual/integral-constant.html MPL Integral Constant]]
 
 [def __fixme__ *FIXME*]
 
+[def __scanner_business__ [@boost:/libs/spirit/classic/doc/faq.html#scanner_business The Scanner Business]]
 
 [/ Sections ]
 
-[def __sec_qi_and_karma__ [link spirit.qi_and_karma Qi and Karma]]
+[def __sec_qi__ [link spirit.qi Qi]]
+[def __sec_karma__ [link spirit.karma Karma]]
 [def __sec_qi_karma_attributes__ [link spirit.qi_and_karma.abstracts.attributes Attributes]]
+[def __sec_karma_numeric_performance__ [link spirit.karma.performance_measurements.numeric_performance Performance of Numeric Generators]]
+[def __sec_karma_primitive__ [link spirit.karma.quick_reference.primitive_generators Karma Generators]]
+[def __sec_karma_compound__ [link spirit.karma.quick_reference.compound_attribute_rules Compound Attribute Rules]]
+[def __karma_char_encoding_namespace__ [link spirit.karma.reference.karma_basics.character_encoding_namespace Character Encoding Namespace]]
+[def __sec_qi_reference__ [link spirit.qi.reference Qi Reference]]
+[def __sec_karma_reference__ [link spirit.karma.reference Karma Reference]]
+[def __sec_karma_quickref__ [link spirit.karma.quick_reference Karma Quick Reference]]
+
+[def __karma_auxiliary__ [link spirit.karma.reference.auxiliary Auxiliary Generators]]
+[def __karma_char__ [link spirit.karma.reference.char Character Generators]]
+[def __karma_string__ String Generators [/link spirit.karma.reference.string String Generators]]
+[def __karma_directive__ [link spirit.karma.reference.directive Generator Directives]]
+[def __karma_operator__ [link spirit.karma.reference.operator Generator Operators]]
+[def __karma_numeric__ [link spirit.karma.reference.numeric Numeric Generators]]
+[def __karma_binary__ [link spirit.karma.reference.binary Binary Generators]]
+[def __karma_stream__ [link spirit.karma.reference.stream Stream Generators]]
 
 [def __sec_lex__ [link spirit.lex Lex]]
 [def __sec_lex_quickstart_1__ [link spirit.lex.tutorials.lexer_quickstart1 Lex Quickstart 1 - A word counter using __lex__]]
@@ -79,34 +105,140 @@
 [def __sec_lex_primitives__ [link spirit.lex.abstracts.lexer_primitives Lexer Primitives]]
 [def __sec_lex_tokenvalues__ [link spirit.lex.abstracts.lexer_primitives.lexer_token_values About Tokens and Token Values]]
 [def __sec_lex_attributes__ [link spirit.lex.abstracts.lexer_attributes Lexer Attributes]]
+[def __sec_lex_semactions__ [link spirit.lex.abstracts.lexer_semantic_actions Lexer Semantic Actions]]
+
+[def __sec_ref_lex_token__ [link spirit.lex.reference.token Token Class]]
+[def __sec_ref_lex_token_def__ [link spirit.lex.reference.tokendef TokenDef Class]]
 
-[def __sec_ref_lex_token__ [link spirit.lex.reference.concepts.token Token Reference]]
-[def __sec_ref_lex_token_def__ [link spirit.lex.reference.concepts.tokendef TokenDef Reference]]
+[def __lex_char_encoding_namespace__ [link spirit.lex.reference.lex_basics.character_encoding_namespace Character Encoding Namespace]]
 
 [/ References to API descriptions ]
 
 [def __api_tokenize_and_parse__ [link spirit.qi_and_karma.abstracts.parsing_and_generating.the_tokenize_and_phrase_parse___function `tokenize_and_parse()`]]
-[def __api_generate_static__ [link spirit.lex.abstracts.tokenizing_input_data.the_generate_static___function `generate_static()`]]
+[def __api_tokenize__ [link spirit.lex.lexer_tokenizing.the_tokenize_function `tokenize()`]]
+[def __api_generate_static__ [link spirit.lex.lexer_tokenizing.the_generate_static_function `generate_static()`]]
 
+[template karma_format[str] [str] [/link spirit.karma.reference.format [str]]]
 
 [/ References to classes ]
 
-[def __class_token_def__ [link spirit.lex.reference.tokendef_class `token_def<>`]]
+[def __class_token_def__ [link spirit.lex.reference.tokendef `token_def<>`]]
 
-[def __class_lexertl_token__ [link spirit.lex.reference.token_class `lexertl_token<>`]]
-[def __class_lexertl_lexer__ [link spirit.lex.reference.lexer_class.the_lexertl_lexer_class_implementing_the_dynamic_model `lexertl_lexer<>`]]
-[def __class_lexertl_static_lexer__ [link spirit.lex.reference.lexer_class.the_lexertl_static_lexer_class_implementing_the_static_model `lexertl_static_lexer<>`]]
+[def __class_lexertl_token__ [link spirit.lex.reference.token `lexertl_token<>`]]
+[def __class_lexertl_lexer__ [link spirit.lex.reference.lexer.the_lexertl__lexer_class_implementing_the_dynamic_model `lexertl_lexer<>`]]
+[def __class_lexertl_static_lexer__ [link spirit.lex.reference.lexer.the_lexertl__static_lexer_class_implementing_the_static_model `lexertl_static_lexer<>`]]
+
+[/ References to support ]
+
+[def __unused_type__ `unused_type`] [/$$$ TODO: link me $$$]
+[def __unused__ `unused`] [/$$$ TODO: link me $$$]
+[def __info__ `info`] [/$$$ TODO: link me $$$]
+[def __char_class_types__ Character Class Types] [/$$$ TODO: link me $$$]
+
+[/ References to abstracts ]
+
+[def __rd__ Recursive Descent] [/$$$ TODO: link me $$$]
+[def __syntax_diagrams__ [link spirit.abstracts.syntax_diagrams Syntax Diagram]]
+[def __peg__ [link spirit.abstracts.parsing_expression_grammar Parsing Expression Grammar]]
+[def __ast__ Abstract Syntax Tree] [/$$$ TODO: link me $$$]
+
+[def __include_structure__ [link spirit.structure.include Include Structure]]
+[def __include_structure_faq__ [link spirit.faq.i_m_very_confused_about_the_header_hell_in_my_boost_spirit_directory__what_s_all_this_about_ Header Hell]]
+
+[/ References to reference ]
+
+[def __qi_attr__ [link spirit.qi.reference.auxiliary.attr `attr(attrib)`]]
+[def __qi_symbols__ [link spirit.qi.reference.string.symbols `symbols<Ch, T>`]]
+[template qi_lit_string[str] [link spirit.qi.reference.string.string [str]]]
+[template qi_lit_char[char] [link spirit.qi.reference.string.lit_char [char]]]
+[def __qi_kleene__ Kleene Star] [/$$$ TODO: link me $$$]
+[def __qi_plus__ Plus] [/$$$ TODO: link me $$$]
+
+[def __generator_concept__ [link spirit.karma.reference.generator_concepts.generator `Generator`]]
+[def __primitive_generator_concept__ [link spirit.karma.reference.generator_concepts.primitivegenerator `PrimitiveGenerator`]]
+[def __unary_generator_concept__ [link spirit.karma.reference.generator_concepts.unarygenerator `UnaryGenerator`]]
+[def __binary_generator_concept__ [link spirit.karma.reference.generator_concepts.binarygenerator `BinaryGenerator`]]
+[def __nary_generator_concept__ [link spirit.karma.reference.generator_concepts.narygenerator `NaryGenerator`]]
+[def __karma_lazy_argument__ [link spirit.karma.reference.karma_basics.lazy_argument Lazy Argument]]
+
+[/////////////////////////////////////////////////////////////////////////////]
+[def __karma_eol__ [link spirit.karma.reference.auxiliary.eol `eol`]]
+[def __karma_eps__ [link spirit.karma.reference.auxiliary.eps `eps`]]
+[def __karma_feps__ [link spirit.karma.reference.auxiliary.eps `eps(b)`]]
+[template karma_lazy[str] [link spirit.karma.reference.auxiliary.lazy [str]]]
+[def __karma_llazy__ [link spirit.karma.reference.auxiliary.lazy `fg`]]
+[def __karma_sequence__ [link spirit.karma.reference.operator.sequence sequence (`<<`)]]
+[def __karma_alternative__ [link spirit.karma.reference.operator.alternative alternative (`|`)]]
+[template karma_kleene[str] [link spirit.karma.reference.operator.kleene [str]]]
+[def __karma_plus__ [link spirit.karma.reference.operator.plus plus (unary `+`)]]
+[def __karma_list__ [link spirit.karma.reference.operator.list list (`%`)]]
+[def __karma_optional__ [link spirit.karma.reference.operator.optional optional (unary `-`)]]
+[def __karma_and_predicate__ [link spirit.karma.reference.operator.and_predicate and predicate (unary `&`)]]
+[def __karma_not_predicate__ [link spirit.karma.reference.operator.not_predicate not predicate (unary `!`)]]
+
+[template karma_align[str] [link spirit.karma.reference.directive.alignment [str]]]
+[def __karma_omit__ [link spirit.karma.reference.directive.omit `omit[a]`]]
+[def __karma_buffer__ [link spirit.karma.reference.directive.buffer `buffer[a]`]]
+[template karma_repeat[str] [link spirit.karma.reference.directive.repeat [str]]]
+[def __karma_verbatim__ [link spirit.karma.reference.directive.delimit `verbatim[a]`]]
+[template karma_delimit[str] [link spirit.karma.reference.directive.delimit [str]]]
+[template karma_upperlower[str] [link spirit.karma.reference.directive.upperlower [str]]]
+[template karma_maxwidth[str] [link spirit.karma.reference.directive.maxwidth [str]]]
+
+[def __karma_numerics__ [link spirit.karma.reference.numeric numeric generators]]
+[template signed_int[str] [link spirit.karma.reference.numeric.signed_int [str]]]
+[template unsigned_int[str] [link spirit.karma.reference.numeric.unsigned_int [str]]]
+[template real_number[str] [link spirit.karma.reference.numeric.real_number [str]]]
+
+[def __karma_char__ [link spirit.karma.reference.numeric character generators]]
+[template karma_char[str] [link spirit.karma.reference.char.char_generator [str]]]
+[template karma_char_class[str] [link spirit.karma.reference.char.char_class [str]]]
+
+[template karma_string[str] [link spirit.karma.reference.string [str]]]
+
+[template karma_stream[str] [link spirit.karma.reference.stream [str]]]
+
+[template karma_native_binary[str] [link spirit.karma.reference.binary.binary_native [str]]]
+[template karma_little_binary[str] [link spirit.karma.reference.binary.binary_little [str]]]
+[template karma_big_binary[str] [link spirit.karma.reference.binary.binary_big [str]]]
+
+[def __actions__ Semantic Actions] [/$$$ TODO: link me $$$]
+[def __context__ Context] [/$$$ TODO: link me $$$]
+[def __compatible__ Compatible] [/$$$ TODO: link me $$$]
+[def __attribute__ Attribute] [/$$$ TODO: link me $$$]
+[def __compatible_attribute__ Compatible Attribute] [/$$$ TODO: link me $$$]
+[def __rule__ Rule] [/$$$ TODO: link me $$$]
+[def __grammar__ Grammar] [/$$$ TODO: link me $$$]
+[def __parser_conversion__ Parser Conversion] [/$$$ TODO: link me $$$]
+[def __delegate_pattern__ Delegate Design Pattern] [/$$$ TODO: link me $$$]
+[def __composite_pattern__ Composite Design Pattern] [/$$$ TODO: link me $$$]
+
+[/////////////////////////////////////////////////////////////////////////////]
+[def __karma_actions__ [link spirit.karma.tutorials.semantic_actions Semantic Actions]]
+[def __karma_context__ Context] [/$$$ TODO: link me $$$]
+[def __karma_attribute__ Generator Attributes] [/$$$ TODO: link me $$$]
+[def __karma_compatible_attribute__ Compatible Attributes] [/$$$ TODO: link me $$$]
+[def __karma_rule__ Rule] [/$$$ TODO: link me $$$]
+[def __karma_grammar__ Grammar] [/$$$ TODO: link me $$$]
+[def __karma_comp_attr_notation__ [link spirit.karma.quick_reference.compound_attribute_rules.notation Compound Attribute Notation]]
+
+[/////////////////////////////////////////////////////////////////////////////]
+[def __lexer_concept__ [link spirit.lex.reference.lexer_concepts.lexer `Lexer`]]
+[def __primitive_lexer_concept__ [link spirit.lex.reference.lexer_concepts.primitivelexer `PrimitiveLexer`]]
+[def __unary_lexer_concept__ [link spirit.lex.reference.lexer_concepts.unarylexer `UnaryLexer`]]
+[def __nary_lexer_concept__ [link spirit.lex.reference.lexer_concepts.narylexer `NaryLexer`]]
 
+[def __lex_actions__ [link spirit.lex.abstracts.lexer_semantic_actions Lexer Semantic Actions]]
 
 [/ Some images ]
 
-[def __note__ [$images/note.png]]
-[def __tip__ [$images/tip.png]]
-[def __important__ [$images/important.png]]
-[def __caution__ [$images/caution.png]]
-[def __danger__ [$images/alert.png]]
-
+[def __note__ [$../images/note.png]]
+[def __tip__ [$../images/tip.png]]
+[def __important__ [$../images/important.png]]
+[def __caution__ [$../images/caution.png]]
+[def __danger__ [$../images/alert.png]]
 
+[/////////////////////////////////////////////////////////////////////////////]
 [/ some templates]
 
 [/ fig[ref title label]
@@ -121,7 +253,7 @@
         <title>'''[title]'''</title>
         <inlinemediaobject>
             <imageobject>
- <imagedata fileref="'''[ref]'''"></imagedata>
+ <imagedata fileref="./images/'''[ref]'''"></imagedata>
             </imageobject>
             <textobject>
                 <phrase role="alt">'''[title]'''</phrase>
@@ -130,18 +262,106 @@
     </figure>
 ''']
 
+[def __sd_start_stop__ [$../../images/start_stop.png]]
+[def __sd_terminals__ [$../../images/terminal.png]]
+[def __sd_non_terminals__ [$../../images/non-terminal.png]]
+[def __sd_sequence__ [$../../images/sequence.png]]
+[def __sd_choice__ [$../../images/alternative.png]]
+[def __sd_optional__ [$../../images/optional.png]]
+[def __sd_plus__ [$../../images/plus.png]]
+[def __sd_kleene__ [$../../images/kleene.png]]
+[def __sd_predicate__ [$../../images/predicate.png]]
+[def __sd_and_predicate__ [$../../images/and_predicate.png]]
+[def __sd_not_predicate__ [$../../images/not_predicate.png]]
+[def __pascal_string__ [$../../../../images/pascal_string.png]]
+
+
+[/ ----------------------------------------------------------------------------]
+[/ $$$ Now I'm confused with all this adhoc links. Let's fix this somehow.
+For now, I'll put my stuff here adhoc (JDG). $$$]
+
+[/ external]
+
+[def __fwditer__ [@http://www.sgi.com/tech/stl/ForwardIterator.html `ForwardIterator`]]
+[def __concepts__ [@http://www.boost.org/community/generic_programming.html#concept concepts]]
+[def __endianness__ [@http://en.wikipedia.org/wiki/Endianness endianness]]
+
+[/ support]
+[def __info__ `info`] [/ TODO Link Me]
+[def __qi_error_handler__ Error Handler] [/ TODO Link Me]
+
+[/ quick-ref]
+[def __qi_quickref__ [link spirit.qi.quick_reference Qi Quick Reference]]
+[def __qi_comp_attr_notation__ [link spirit.qi.quick_reference.compound_attribute_rules.notation Compound Attribute Notation]]
+
+[/ concepts]
+[def __parser_concept__ [link spirit.qi.reference.parser_concepts.parser `Parser`]]
+[def __primitive_parser_concept__ [link spirit.qi.reference.parser_concepts.primitiveparser `PrimitiveParser`]]
+[def __unary_parser_concept__ [link spirit.qi.reference.parser_concepts.unaryparser `UnaryParser`]]
+[def __binary_parser_concept__ [link spirit.qi.reference.parser_concepts.binaryparser `BinaryParser`]]
+[def __nary_parser_concept__ [link spirit.qi.reference.parser_concepts.naryparser `NaryParser`]]
+
+[/ basics]
+[def __qi_lazy_argument__ [link spirit.qi.reference.basics.lazy_argument Lazy Argument]]
+[def __char_encoding_namespace__ [link spirit.qi.reference.basics.character_encoding_namespace Character Encoding Namespace]]
+[def __string__ [link spirit.qi.reference.basics.string String]]
+
+[/ action]
+[def __qi_semantic_actions__ Semantic Actions] [/ TODO Link Me]
+
+[/ auxiliary]
+[def __qi_attr__ [link spirit.qi.reference.auxiliary.attr `attr`]]
+[def __qi_eol__ [link spirit.qi.reference.auxiliary.eol `eol`]]
+[def __qi_eoi__ [link spirit.qi.reference.auxiliary.eoi `eoi`]]
+[def __qi_eps__ [link spirit.qi.reference.auxiliary.eps `eps`]]
+[def __qi_lazy__ [link spirit.qi.reference.auxiliary.lazy `lazy`]]
+
+[/ directives]
+[def __qi_lexeme__ [link spirit.qi.reference.directive.lexeme `lexeme`]]
+[def __qi_no_case__ [link spirit.qi.reference.directive.no_case `no_case`]]
+[def __qi_omit__ [link spirit.qi.reference.directive.omit `omit`]]
+[def __qi_raw__ [link spirit.qi.reference.directive.raw `raw`]]
+[def __qi_repeat__ [link spirit.qi.reference.directive.repeat `repeat`]]
+[def __qi_skip__ [link spirit.qi.reference.directive.skip `skip`]]
+
+[/ operator]
+[def __qi_alternative__ [link spirit.qi.reference.operator.alternative Alternative]]
+[def __qi_and_predicate__ [link spirit.qi.reference.operator.and_predicate And Predicate]]
+[def __qi_difference__ [link spirit.qi.reference.operator.difference Difference]]
+[def __qi_expect__ [link spirit.qi.reference.operator.expect Expect]]
+[def __qi_expectation_failure__ [link spirit.qi.reference.operator.expect.expectation_failure `expectation_failure`]]
+[def __qi_kleene__ [link spirit.qi.reference.operator.kleene Kleene]]
+[def __qi_list__ [link spirit.qi.reference.operator.list List]]
+[def __qi_not_predicate__ [link spirit.qi.reference.operator.not_predicate Not Predicate]]
+[def __qi_optional__ [link spirit.qi.reference.operator.optional Optional]]
+[def __qi_permutation__ [link spirit.qi.reference.operator.permutation Permutation]]
+[def __qi_plus__ [link spirit.qi.reference.operator.plus Plus]]
+[def __qi_sequence__ [link spirit.qi.reference.operator.sequence Sequence]]
+[def __qi_sequential_or__ [link spirit.qi.reference.operator.sequential_or Sequential Or]]
+
+
+[/ $$$ End $$$ ]
+[/ ----------------------------------------------------------------------------]
 
 [/ Here we go ]
 
+This is the documentation of the newest version of __spirit__ (currently,
+V2.1). If you're looking for the documentation of Spirit's previous version
+(formerly Spirit V1.8), see __classic__.
+
 [include preface.qbk]
 [include what_s_new.qbk]
 [include introduction.qbk]
-[include qi_and_karma.qbk]
+[include structure.qbk]
+[include abstracts.qbk]
+[include qi.qbk]
+[include karma.qbk]
 [include lex.qbk]
+[include support.qbk]
 [include faq.qbk]
 [include notes.qbk]
-[include rationale.qbk]
+[/include rationale.qbk]
+[include repository.qbk]
 [include acknowledgments.qbk]
 [include references.qbk]
 
-

Modified: branches/release/libs/spirit/doc/what_s_new.qbk
==============================================================================
--- branches/release/libs/spirit/doc/what_s_new.qbk (original)
+++ branches/release/libs/spirit/doc/what_s_new.qbk 2009-09-14 12:45:39 EDT (Mon, 14 Sep 2009)
@@ -1,5 +1,5 @@
 [/==============================================================================
- Copyright (C) 2001-2008 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
@@ -10,18 +10,20 @@
 
 [heading Spirit Classic]
 
-The Spirit V1.8.x code base has been integrated with Spirit V2. It is now called
-__classic__. Even if the directory structure has changed (the Spirit Classic
-headers are now moved to the '''$BOOST_ROOT/boost/spirit/home/classic''' directory),
-we created forwarding headers allowing to compile existing applications without
-any change. These forwarding headers are deprecated, though, which will result
-in corresponding warnings generated for each of the headers starting with Boost
-V1.38. The forwarding headers are expected to be removed in the future.
-
-The recommended way of using Spirit Classic now is to include header files from
-the directory '''$BOOST_ROOT/boost/spirit/include'''. All files of Spirit Classic
-in this directory have a 'classic_' prefixed to their name. For example the
-include
+The Spirit V1.8.x code base has been integrated with Spirit V2. It is
+now called __classic__. Since the directory structure has changed (the
+Spirit Classic headers are now moved to the
+'''$BOOST_ROOT/boost/spirit/home/classic''' directory), we created
+forwarding headers allowing existing applications to compile without
+any change. However, these forwarding headers are deprecated, which
+will result in corresponding warnings generated for each of the
+headers starting with Boost V1.38. The forwarding headers are expected
+to be removed in the future.
+
+The recommended way of using Spirit Classic now is to include header
+files from the directory '''$BOOST_ROOT/boost/spirit/include'''. All
+Spirit Classic headers in this directory have a 'classic_' prefixed to
+their name. For example the include
 
     #include <boost/spirit/core/core.hpp>
 
@@ -29,17 +31,135 @@
 
     #include <boost/spirit/include/classic_core.hpp>
 
-To avoid namespace conflicts with the new Spirit V2 library we moved Spirit Classic
-into the namespace `boost::spirit::classic`. All references to the former
-namespace `boost::spirit` need to be adjusted as soon as the header names are
-corrected as described above. As an alternative you can define the preprocessor
-constant `BOOST_SPIRIT_USE_OLD_NAMESPACE`, which will force the Spirit Classic
-code to be in the namespace `boost::spirit` as before. This is not recommended,
-though, as it may result in naming clashes.
-
-The change of the namespace will be automatically deactivated whenever the
-deprecated include files are being used. This ensures full backwards
-compatibility for existing applications.
-
+To avoid namespace conflicts with the new Spirit V2 library we moved
+Spirit Classic into the namespace `boost::spirit::classic`. All
+references to the former namespace `boost::spirit` need to be adjusted
+as soon as the header names are corrected as described above. As an
+alternative you can define the preprocessor constant
+`BOOST_SPIRIT_USE_OLD_NAMESPACE`, which will force the Spirit Classic
+code to be in the namespace `boost::spirit` as before. This is not
+recommended, though, as it may result in naming clashes.
+
+The change of the namespace will be automatically deactivated whenever
+the deprecated include files are being used. This ensures full
+backwards compatibility for existing applications.
+
+[heading Spirit V2.1]
+
+[heading What's changed in __qi__ and __karma__ from V2.0 (Boost V1.37.0) to 2.x (Boost V1.41.0)]
+
+* __spirit__ is now based on the newest version of __boost_proto__
+* `qi::phrase_parse`, `qi::phrase_format` now post-skip by default.
+* `karma::generate_delimited` and `karma::format_delimited` now don't do pre-
+ delimiting by default.
+* Changed parameter sequence of `qi::phrase_parse`, `qi::phrase_match`,
+ `karma::generate_delimited`, and `match_delimited`. The attribute is now
+ always the last parameter.
+* Added new overloads of those functions allowing to explicitly specify the
+ post-skipping and pre-delimiting behavior.
+* Added multi attribute API functions
+* Removed `grammar_def<>`
+* Removed functions `make_parser()` and `make_generator()`
+* Removed `qi::none` and `karma::none`
+* Sequences and lists now accept a standard container as their attribute
+* The string placeholder terminal now can take other strings as its parameter
+ (i.e. std::string)
+* All terminals taking literals now accept a (lazy) function object as well
+* All placeholders for terminals and directives (such as `int_`, `double_`,
+ `verbatim`, etc.) were previously defined in the namespace `boost::spirit`
+ only. Now these are additionally imported into the namespaces
+ `spirit::qi`, `spirit::karma`, and `spirit::lex` (if they are supported by
+ the corresponding sub-library).
+* The terminal placeholders `char_` and `string` are not defined in the
+ namespace `boost::spirit` anymore as they have been moved to the
+ character set namespaces, allowing to do proper character set
+ handling based on the used namespace (as `spirit::ascii`, etc.)
+* The `uint`, `ushort`, `ulong`, and `byte` terminal placeholders have been
+ renamed to `uint_`, `ushort_`, `ulong_`, and `byte_`.
+* `qi::skip[]` now re-enables outer skipper if used inside `lexeme[]`
+* Added `karma::maxwidth[]` directive
+* Added `karma::omit[]` directive (see __karma_omit__)
+* Added `karma::buffer[]` directive (see __karma_buffer__)
+* `karma::delimit[]` now re-enables outer delimiter if used inside `verbatim[]`
+* karma: added and-predicate (`operator&()`) and not-predicate (`operator!()`)
+* karma: changed semantics of `char_()`, `string()`, `int_()` et.al., and
+ `double_()` et.al.: all of these generators now always expose an attribute.
+ If they do not have an associate attribute, they generate their immediate
+ literal. If they have an associated attribute, the generators first test if
+ the attribute value is equal to the immediate literal. They fail not
+ while generating anything if those are not equal. Otherwise they generate
+ their immediate literal. For more information see for instance
+ [signed_int `int_`].
+* `karma::lit()` can now be used to generate integer and floating point numbers
+* `qi::rule` and `karma::rule` now can be directly initialzed using their copy
+ constructor. I.e. this works now: `qi::rule<...> r = ...some parser...;`.The
+ semantics of this initalization are equivalent to initializing them using
+ `operator%=()` (auto attribute propagation is enabled).
+
+[heading What's changed in __lex__ from V2.0 (Boost V1.37.0) to 2.x (Boost V1.41.0)]
+
+Here is a list of changes in __lex__ since version 2.0. __lex__ 2.x is a
+complete rewrite of the __lex__ distributed with Boost V1.37. As all parts of
+the __spirit__ library it is usable either standalone or in conjunction with
+the other parts. __lex__ now uses the infrastructure provided by __spirit__
+version 2.1.
+
+* The lex::lexer_def class has been renamed to lex::lexer, while the original
+ class lex::lexer does not exist anymore. This simplifies the creation of
+ lexers.
+* The lex::lexer class does not have the function `def(Self& self)` anymore,
+ token definitions can be added to the lexer at any time, usually in the
+ constructor of the user defined lexer class:
+``
+ template <typename Lexer>
+ struct example_tokens : lex::lexer<Lexer>
+ {
+ example_lexer()
+ {
+ // your token definitions here
+ this->self = ...
+ }
+ };
+``
+* The new lexer class now can be directly used, their is no need anymore to
+ wrap it using the `make_lexer()` template as before. Therefore the function
+ `make_lexer()` has been removed.
+* The `lex::tokenize_and_parse()` and `lex::tokenize_and_phrase_parse()` functions
+ have been changed to match the parameter sequence as implemented by the
+ `qi::parse()` and `qi::phrase_parse()` functions.
+ Both take a possibly arbitrary number of attribute arguments as its last
+ parameters (well, the number of attributes is limited by the macro
+ `SPIRIT_ARGUMENTS_LIMIT`, which defaults to `PHOENIX_LIMIT`).
+* The `lex::lexertl_lexer`, and `lex::lexertl_token`
+ classes have been moved to the `lex::lexertl` namespace and the names have been
+ changed to `lex::lexertl::lexer`, `lex::lexertl::token` (the same applies to
+ the `lex::lexert_actor_lexer`, and the `static_lexertl_*` family of types).
+* The class `lex::lexertl_token_set` has been removed alltogether as its
+ complete functionality is available from the lexer class.
+* The __lex__ library has been updated to use the newest version of Ben
+ Hansons __lexertl__ lexer construction library (Boost review pending).
+* The `lex::lexer<Lexer>` template constructor now takes an optional parameter
+ specifying the `match_flags` to be used for table generation. Currently, there
+ are the following flags available:
+``
+ match_flags::match_default, // no flags
+ match_flags::match_not_dot_newline, // the regex '.' doesn't match newlines
+ match_flags::match_icase // all matching operations are case insensitive
+``
+ If no parameter is passed to the constructor, `match_flags::match_default` is
+ used, i.e. the `.` matches newlines and matching is case sensitive.
+* The `char_()` and `string()` placeholders can now be used for token
+ definitions as a replacement for `token_def`, although it is still
+ possible to use the latter.
+* Lexer semantic actions now have to conform to a changed interface (see
+ __sec_lex_semactions__ for details).
+* Added placeholder symbols usable from the inside of lexer semantic actions
+ while using Phoenix: _start, _end, _eoi, _state, _val, and _pass (see
+ __sec_lex_semactions__ for more details).
+* Added (lazy) support functions usable from the inside of lexer semantic
+ actions while using Phoenix: `lex::more()`, `lex::less()`, and
+ `lex::lookahead()` (see __sec_lex_semactions__ for more details).
+* Removed `lex::omitted` in favor of `lex::omit` to unify the overall
+ interface.
 
 [endsect]

Modified: branches/release/libs/spirit/example/karma/Jamfile
==============================================================================
--- branches/release/libs/spirit/example/karma/Jamfile (original)
+++ branches/release/libs/spirit/example/karma/Jamfile 2009-09-14 12:45:39 EDT (Mon, 14 Sep 2009)
@@ -1,17 +1,23 @@
 #==============================================================================
-# Copyright (c) 2001-2008 Joel de Guzman
-# Copyright (c) 2001-2008 Hartmut Kaiser
+# 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)
 #==============================================================================
 project spirit-karma-example ;
 
-exe quick_start1 : quick_start1.cpp ;
-exe actions_example : actions.cpp ;
-exe basic_facilities : basic_facilities.cpp ;
-exe functor_facilities : functor_facilities.cpp ;
-exe calc2_ast_dump : calc2_ast_dump.cpp ;
-exe calc2_ast_rpn : calc2_ast_rpn.cpp ;
-exe calc2_ast_vm : calc2_ast_vm.cpp ;
+exe actions_example : actions.cpp ;
+exe basic_facilities : basic_facilities.cpp /boost//date_time ;
+exe calc2_ast_dump : calc2_ast_dump.cpp ;
+exe calc2_ast_rpn : calc2_ast_rpn.cpp ;
+exe calc2_ast_vm : calc2_ast_vm.cpp ;
+exe classify_char : classify_char.cpp ;
+exe karma_complex_number : complex_number.cpp ;
+exe karma_num_list1 : num_list1.cpp ;
+exe key_value_sequence : key_value_sequence.cpp ;
+exe mini_xml_karma : mini_xml_karma.cpp ;
+exe printf_style_double_format : printf_style_double_format.cpp ;
+exe quick_start1 : quick_start1.cpp ;
+
 

Modified: branches/release/libs/spirit/example/karma/actions.cpp
==============================================================================
--- branches/release/libs/spirit/example/karma/actions.cpp (original)
+++ branches/release/libs/spirit/example/karma/actions.cpp 2009-09-14 12:45:39 EDT (Mon, 14 Sep 2009)
@@ -1,6 +1,6 @@
 /*=============================================================================
- Copyright (c) 2001-2008 Hartmut Kaiser
- Copyright (c) 2001-2008 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)
@@ -20,62 +20,110 @@
 // * Using boost.bind
 // * Using boost.lambda
 
-using namespace boost::spirit;
+using boost::spirit::unused_type;
 
-void read(int& i)
+//[karma_tutorial_semantic_action_functions
+namespace client
 {
- i = 42;
-}
+ namespace karma = boost::spirit::karma;
 
-struct read_action
-{
- void operator()(int& i, unused_type, unused_type) const
+ // A plain function
+ void read_function(int& i)
     {
         i = 42;
     }
-};
+
+ // A member function
+ struct reader
+ {
+ void print(int& i) const
+ {
+ i = 42;
+ }
+ };
+
+ // A function object
+ struct read_action
+ {
+ void operator()(int& i, unused_type, unused_type) const
+ {
+ i = 42;
+ }
+ };
+}
+//]
 
 ///////////////////////////////////////////////////////////////////////////////
 int main()
 {
+ using boost::spirit::karma::int_;
+ using boost::spirit::karma::generate;
+ using client::read_function;
+ using client::reader;
+ using client::read_action;
+
     { // example using plain functions
+ using namespace boost::spirit;
+
+ std::string generated;
+ std::back_insert_iterator<std::string> outiter(generated);
+
+ //[karma_tutorial_attach_actions1
+ generate(outiter, '{' << int_[&read_function] << '}');
+ //]
+
+ std::cout << "Simple function: " << generated << std::endl;
+ }
+
+ { // example using simple function object
+ using namespace boost::spirit;
+
         std::string generated;
- bool result = karma::generate(std::back_inserter(generated),
- '{' << int_[&read] << '}');
+ std::back_insert_iterator<std::string> outiter(generated);
 
- if (result)
- std::cout << "Simple function: " << generated << std::endl;
+ //[karma_tutorial_attach_actions2
+ generate(outiter, '{' << int_[read_action()] << '}');
+ //]
+
+ std::cout << "Simple function object: " << generated << std::endl;
     }
 
- { // example using simple function objects
+ { // example using plain function with boost.bind
         std::string generated;
- bool result = karma::generate(std::back_inserter(generated),
- '{' << int_[read_action()] << '}');
+ std::back_insert_iterator<std::string> outiter(generated);
+
+ //[karma_tutorial_attach_actions3
+ generate(outiter, '{' << int_[boost::bind(&read_function, _1)] << '}');
+ //]
 
- if (result)
- std::cout << "Simple function object: " << generated << std::endl;
+ std::cout << "Simple function with Boost.Bind: " << generated << std::endl;
     }
 
- { // example using boost.bind
+ { // example using member function with boost.bind
         std::string generated;
- bool result = karma::generate(std::back_inserter(generated),
- '{' << int_[boost::bind(&read, _1)] << '}');
+ std::back_insert_iterator<std::string> outiter(generated);
+
+ //[karma_tutorial_attach_actions4
+ reader r;
+ generate(outiter, '{' << int_[boost::bind(&reader::print, &r, _1)] << '}');
+ //]
 
- if (result)
- std::cout << "Boost.Bind: " << generated << std::endl;
+ std::cout << "Member function: " << generated << std::endl;
     }
 
     { // example using boost.lambda
         namespace lambda = boost::lambda;
+ using namespace boost::spirit;
 
         std::string generated;
- std::stringstream strm("42");
+ std::back_insert_iterator<std::string> outiter(generated);
 
- bool result = karma::generate(std::back_inserter(generated),
- '{' << int_[strm >> lambda::_1] << '}');
+ //[karma_tutorial_attach_actions5
+ std::stringstream strm("42");
+ generate(outiter, '{' << int_[strm >> lambda::_1] << '}');
+ //]
 
- if (result)
- std::cout << "Boost.Lambda: " << generated << std::endl;
+ std::cout << "Boost.Lambda: " << generated << std::endl;
     }
 
     return 0;

Modified: branches/release/libs/spirit/example/karma/basic_facilities.cpp
==============================================================================
--- branches/release/libs/spirit/example/karma/basic_facilities.cpp (original)
+++ branches/release/libs/spirit/example/karma/basic_facilities.cpp 2009-09-14 12:45:39 EDT (Mon, 14 Sep 2009)
@@ -26,6 +26,7 @@
 #include <cstdlib>
 
 #include <boost/range.hpp>
+#include <boost/array.hpp>
 #include <boost/date_time/gregorian/gregorian.hpp>
 #include <boost/fusion/include/std_pair.hpp>
 
@@ -59,17 +60,24 @@
 {
     // output the container as a space separated sequence
     os <<
+ karma::format(
+ *stream, // format description
+ c // data
+ ) << std::endl << std::endl;
+
+ // output the container as a space separated sequence
+ os <<
         karma::format_delimited(
             *stream, // format description
- c, // data
- space // delimiter
+ space, // delimiter
+ c // data
         ) << std::endl << std::endl;
 
     os <<
         karma::format_delimited(
             '[' << *stream << ']', // format description
- c, // data
- space // delimiter
+ space, // delimiter
+ c // data
         ) << std::endl << std::endl;
 
     // output the container as a comma separated list
@@ -91,6 +99,12 @@
             c // data
         ) << std::endl << std::endl;
 
+// os <<
+// karma::format(
+// '[' << (+stream | "empty") << ']', // format description
+// c // data
+// ) << std::endl << std::endl;
+
     // output the container as a comma separated list of items enclosed in '()'
     os <<
         karma::format(
@@ -105,15 +119,15 @@
              ) << ']', // format description
             c // data
         ) << std::endl << std::endl;
-
+
     // output the container as a HTML list
     os <<
         karma::format_delimited(
- "<ol>" <<
+ /*"<ol>" << */
                 *verbatim["<li>" << stream << "</li>"]
- << "</ol>", // format description
- c, // data
- '\n' // delimiter
+ /*<< "</ol>"*/, // format description
+ '\n', // delimiter
+ c // data
         ) << std::endl;
 
     // output the container as right aligned column
@@ -122,8 +136,8 @@
            *verbatim[
                 "|" << right_align[stream] << "|"
             ], // format description
- c, // data
- '\n' // delimiter
+ '\n', // delimiter
+ c // data
         ) << std::endl;
 
     os << std::endl;
@@ -132,15 +146,24 @@
 int main()
 {
     ///////////////////////////////////////////////////////////////////////////
+ // C-style array
+ int i[4] = { 3, 6, 9, 12 };
+
+ std::cout << "-------------------------------------------------------------"
+ << std::endl;
+ std::cout << "int i[]" << std::endl;
+ output_container(std::cout, boost::make_iterator_range(i, i+4));
+
+ ///////////////////////////////////////////////////////////////////////////
     // vector
- std::vector<int> v (8);
+ std::vector<int> v (5);
     std::generate(v.begin(), v.end(), std::rand); // randomly fill the vector
 
     std::cout << "-------------------------------------------------------------"
               << std::endl;
     std::cout << "std::vector<int>" << std::endl;
     output_container(std::cout, v);
-
+
     ///////////////////////////////////////////////////////////////////////////
     // list
     std::list<char> l;
@@ -154,15 +177,6 @@
     output_container(std::cout, l);
 
     ///////////////////////////////////////////////////////////////////////////
- // C-style array
- int i[4] = { 3, 6, 9, 12 };
-
- std::cout << "-------------------------------------------------------------"
- << std::endl;
- std::cout << "int i[]" << std::endl;
- output_container(std::cout, boost::make_iterator_range(i, i+4));
-
- ///////////////////////////////////////////////////////////////////////////
     // strings
     std::string str("Hello world!");
 
@@ -170,7 +184,17 @@
               << std::endl;
     std::cout << "std::string" << std::endl;
     output_container(std::cout, str);
-
+
+ ///////////////////////////////////////////////////////////////////////////
+ // boost::array
+ boost::array<long, 5> arr;
+ std::generate(arr.begin(), arr.end(), std::rand); // randomly fill the array
+
+ std::cout << "-------------------------------------------------------------"
+ << std::endl;
+ std::cout << "boost::array<long, 5>" << std::endl;
+ output_container(std::cout, arr);
+
     ///////////////////////////////////////////////////////////////////////////
     // vector of boost::date objects
     // Note: any registered facets get used!
@@ -187,18 +211,18 @@
               << std::endl;
     std::cout << "std::vector<boost::date>" << std::endl;
     output_container(std::cout, dates);
-
+
     ///////////////////////////////////////////////////////////////////////////
     // map of int --> string mappings
- std::map<int, std::string> mappings;
- mappings.insert(std::make_pair(0, "zero"));
- mappings.insert(std::make_pair(1, "one"));
- mappings.insert(std::make_pair(2, "two"));
-
- std::cout << "-------------------------------------------------------------"
- << std::endl;
- std::cout << "std::map<int, std::string>" << std::endl;
- output_container(std::cout, mappings);
+// std::map<int, std::string> mappings;
+// mappings.insert(std::make_pair(0, "zero"));
+// mappings.insert(std::make_pair(1, "one"));
+// mappings.insert(std::make_pair(2, "two"));
+//
+// std::cout << "-------------------------------------------------------------"
+// << std::endl;
+// std::cout << "std::map<int, std::string>" << std::endl;
+// output_container(std::cout, mappings);
 
     return 0;
 }

Modified: branches/release/libs/spirit/example/karma/calc2_ast.hpp
==============================================================================
--- branches/release/libs/spirit/example/karma/calc2_ast.hpp (original)
+++ branches/release/libs/spirit/example/karma/calc2_ast.hpp 2009-09-14 12:45:39 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
 
     Distributed under the Boost Software License, Version 1.0. (See accompanying
     file LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt)
@@ -18,7 +18,8 @@
 #if !defined(SPIRIT_EXAMPLE_CALC2_AST_APR_30_2008_1011AM)
 #define SPIRIT_EXAMPLE_CALC2_AST_APR_30_2008_1011AM
 
-#include <boost/variant/recursive_variant.hpp>
+#include <boost/variant.hpp>
+#include <boost/variant/get.hpp>
 #include <boost/spirit/include/phoenix_operator.hpp>
 #include <boost/spirit/include/phoenix_function.hpp>
 #include <boost/spirit/include/phoenix_statement.hpp>
@@ -43,10 +44,10 @@
 
     // expose variant types
     typedef type::types types;
-
+
     // expose variant functionality
     int which() const { return expr.which(); }
-
+
     // constructors
     expression_ast()
       : expr(nil()) {}
@@ -59,10 +60,10 @@
 
     expression_ast(unsigned int expr)
       : expr(expr) {}
-
+
     expression_ast(type const& expr)
       : expr(expr) {}
-
+
     expression_ast& operator+=(expression_ast const& rhs);
     expression_ast& operator-=(expression_ast const& rhs);
     expression_ast& operator*=(expression_ast const& rhs);
@@ -72,17 +73,33 @@
 };
 
 // expose variant functionality
-template <typename T>
-inline T get(expression_ast const& expr)
+namespace boost
 {
- return boost::get<T>(expr.expr);
+ // this function has to live in namespace boost for ADL to correctly find it
+ template <typename T>
+ inline T get(expression_ast const& expr)
+ {
+ return boost::get<T>(expr.expr);
+ }
+
+ // the specialization below tells Spirit to handle expression_ast as if it
+ // where a 'real' variant
+ namespace spirit { namespace traits
+ {
+ template <typename T>
+ struct not_is_variant;
+
+ template <>
+ struct not_is_variant<expression_ast>
+ : mpl::false_ {};
+ }}
 }
 
 ///////////////////////////////////////////////////////////////////////////////
 struct binary_op
 {
     binary_op() {}
-
+
     binary_op(
         char op
       , expression_ast const& left
@@ -148,66 +165,4 @@
 boost::phoenix::function<unary_expr<'+'> > pos;
 boost::phoenix::function<unary_expr<'-'> > neg;
 
-///////////////////////////////////////////////////////////////////////////////
-// A couple of phoenix functions helping to access the elements of the
-// generated AST
-///////////////////////////////////////////////////////////////////////////////
-template <typename T>
-struct get_element
-{
- template <typename T1>
- struct result { typedef T const& type; };
-
- T const& operator()(expression_ast const& expr) const
- {
- return boost::get<T>(expr.expr);
- }
-};
-
-boost::phoenix::function<get_element<int> > _int;
-boost::phoenix::function<get_element<binary_op> > _bin_op;
-boost::phoenix::function<get_element<unary_op> > _unary_op;
-
-///////////////////////////////////////////////////////////////////////////////
-struct get_left
-{
- template <typename T1>
- struct result { typedef expression_ast const& type; };
-
- expression_ast const& operator()(binary_op const& bin_op) const
- {
- return bin_op.left;
- }
-};
-
-boost::phoenix::function<get_left> _left;
-
-struct get_right
-{
- template <typename T1>
- struct result { typedef expression_ast const& type; };
-
- template <typename Node>
- expression_ast const& operator()(Node const& op) const
- {
- return op.right;
- }
-};
-
-boost::phoenix::function<get_right> _right;
-
-struct get_op
-{
- template <typename T1>
- struct result { typedef char type; };
-
- template <typename Node>
- char operator()(Node const& bin_op) const
- {
- return bin_op.op;
- }
-};
-
-boost::phoenix::function<get_op> _op;
-
 #endif

Modified: branches/release/libs/spirit/example/karma/calc2_ast_vm.cpp
==============================================================================
--- branches/release/libs/spirit/example/karma/calc2_ast_vm.cpp (original)
+++ branches/release/libs/spirit/example/karma/calc2_ast_vm.cpp 2009-09-14 12:45:39 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
 
     Distributed under the Boost Software License, Version 1.0. (See accompanying
     file LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt)
@@ -16,9 +16,6 @@
 //
 ///////////////////////////////////////////////////////////////////////////////
 #include <boost/config/warning_disable.hpp>
-#include <boost/spirit/include/qi.hpp>
-#include <boost/spirit/include/karma.hpp>
-#include <boost/spirit/home/karma/binary.hpp>
 
 #include <iostream>
 #include <vector>
@@ -26,15 +23,19 @@
 
 #include "calc2_ast_vm.hpp"
 
+#include <boost/spirit/include/qi.hpp>
+#include <boost/spirit/include/karma.hpp>
+#include <boost/fusion/include/adapt_struct.hpp>
+
 using namespace boost::spirit;
 using namespace boost::spirit::ascii;
-using namespace boost::spirit::arg_names;
 
 ///////////////////////////////////////////////////////////////////////////////
 // Our calculator parser grammar
 ///////////////////////////////////////////////////////////////////////////////
 template <typename Iterator>
-struct calculator : qi::grammar<Iterator, expression_ast(), space_type>
+struct calculator
+ : qi::grammar<Iterator, expression_ast(), space_type>
 {
     calculator() : calculator::base_type(expression)
     {
@@ -128,6 +129,24 @@
     }
 }
 
+// We need to tell fusion about our binary_op and unary_op structs
+// to make them a first-class fusion citizen
+//
+// Note: we register the members exactly in the same sequence as we need them
+// in the grammar
+BOOST_FUSION_ADAPT_STRUCT(
+ binary_op,
+ (expression_ast, left)
+ (expression_ast, right)
+ (int, op)
+)
+
+BOOST_FUSION_ADAPT_STRUCT(
+ unary_op,
+ (expression_ast, right)
+ (int, op)
+)
+
 ///////////////////////////////////////////////////////////////////////////////
 // Our AST grammar for the generator, this just dumps the AST as a expression
 ///////////////////////////////////////////////////////////////////////////////
@@ -137,28 +156,14 @@
 {
     generate_byte_code() : generate_byte_code::base_type(ast_node)
     {
- ast_node %=
- (dword(op_int) << dword) [_1 = _int(_val)]
- | binary_node [_1 = _bin_op(_val)]
- | unary_node [_1 = _unary_op(_val)]
- ;
-
- binary_node =
- (ast_node << ast_node << byte)
- [
- _1 = _left(_val), _2 = _right(_val), _3 = _op(_val)
- ]
- ;
-
- unary_node =
- (ast_node << byte)
- [
- _1 = _right(_val), _2 = _op(_val)
- ]
- ;
+ ast_node %= int_node | binary_node | unary_node;
+ int_node %= dword(op_int) << dword;
+ binary_node %= ast_node << ast_node << byte_;
+ unary_node %= ast_node << byte_;
     }
 
     karma::rule<OuputIterator, expression_ast(), Delimiter> ast_node;
+ karma::rule<OuputIterator, int(), Delimiter> int_node;
     karma::rule<OuputIterator, binary_op(), Delimiter> binary_node;
     karma::rule<OuputIterator, unary_op(), Delimiter> unary_node;
 };
@@ -173,8 +178,9 @@
     typedef char* output_iterator_type;
     typedef generate_byte_code<output_iterator_type, Delimiter> generate_byte_code;
 
+ char* outbuffer = (*code.begin()).bytes;
     generate_byte_code gen_vm;
- return karma::generate_delimited((*code.begin()).bytes, gen_vm, ast, d);
+ return karma::generate_delimited(outbuffer, gen_vm, d, ast);
 }
 
 ///////////////////////////////////////////////////////////////////////////////
@@ -203,14 +209,14 @@
         expression_ast ast;
         std::string::const_iterator iter = str.begin();
         std::string::const_iterator end = str.end();
- bool r = qi::phrase_parse(iter, end, calc, ast, space);
+ bool r = qi::phrase_parse(iter, end, calc, space, ast);
 
         if (r && iter == end)
         {
             // we assume a vm code size of 4096 is sufficient
             std::vector<vmachine::element> code (4096);
             r = generate_vm_code(ast, code, pad(4));
-
+
             if (r)
             {
                 vmachine vm;

Modified: branches/release/libs/spirit/example/karma/calc2_ast_vm.hpp
==============================================================================
--- branches/release/libs/spirit/example/karma/calc2_ast_vm.hpp (original)
+++ branches/release/libs/spirit/example/karma/calc2_ast_vm.hpp 2009-09-14 12:45:39 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
 
     Distributed under the Boost Software License, Version 1.0. (See accompanying
     file LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt)
@@ -19,6 +19,7 @@
 #define SPIRIT_EXAMPLE_CALC2_AST_APR_30_2008_1011AM
 
 #include <boost/variant/recursive_variant.hpp>
+#include <boost/variant/get.hpp>
 #include <boost/spirit/include/phoenix_operator.hpp>
 #include <boost/spirit/include/phoenix_function.hpp>
 #include <boost/spirit/include/phoenix_statement.hpp>
@@ -43,10 +44,10 @@
 
     // expose variant types
     typedef type::types types;
-
+
     // expose variant functionality
     int which() const { return expr.which(); }
-
+
     // constructors
     expression_ast()
       : expr(nil()) {}
@@ -59,10 +60,10 @@
 
     expression_ast(unsigned int expr)
       : expr(expr) {}
-
+
     expression_ast(type const& expr)
       : expr(expr) {}
-
+
     expression_ast& operator+=(expression_ast const& rhs);
     expression_ast& operator-=(expression_ast const& rhs);
     expression_ast& operator*=(expression_ast const& rhs);
@@ -72,10 +73,26 @@
 };
 
 // expose variant functionality
-template <typename T>
-inline T get(expression_ast const& expr)
+namespace boost
 {
- return boost::get<T>(expr.expr);
+ // this function has to live in namespace boost for ADL to correctly find it
+ template <typename T>
+ inline T get(expression_ast const& expr)
+ {
+ return boost::get<T>(expr.expr);
+ }
+
+ // the specialization below tells Spirit to handle expression_ast as if it
+ // where a 'real' variant
+ namespace spirit { namespace traits
+ {
+ template <typename T>
+ struct not_is_variant;
+
+ template <>
+ struct not_is_variant<expression_ast>
+ : mpl::false_ {};
+ }}
 }
 
 enum byte_code
@@ -159,66 +176,4 @@
 boost::phoenix::function<unary_expr<op_pos> > pos;
 boost::phoenix::function<unary_expr<op_neg> > neg;
 
-///////////////////////////////////////////////////////////////////////////////
-// A couple of phoenix functions helping to access the elements of the
-// generated AST
-///////////////////////////////////////////////////////////////////////////////
-template <typename T>
-struct get_element
-{
- template <typename T1>
- struct result { typedef T const& type; };
-
- T const& operator()(expression_ast const& expr) const
- {
- return boost::get<T>(expr.expr);
- }
-};
-
-boost::phoenix::function<get_element<int> > _int;
-boost::phoenix::function<get_element<binary_op> > _bin_op;
-boost::phoenix::function<get_element<unary_op> > _unary_op;
-
-///////////////////////////////////////////////////////////////////////////////
-struct get_left
-{
- template <typename T1>
- struct result { typedef expression_ast const& type; };
-
- expression_ast const& operator()(binary_op const& bin_op) const
- {
- return bin_op.left;
- }
-};
-
-boost::phoenix::function<get_left> _left;
-
-struct get_right
-{
- template <typename T1>
- struct result { typedef expression_ast const& type; };
-
- template <typename Node>
- expression_ast const& operator()(Node const& op) const
- {
- return op.right;
- }
-};
-
-boost::phoenix::function<get_right> _right;
-
-struct get_op
-{
- template <typename T1>
- struct result { typedef int type; };
-
- template <typename Node>
- int operator()(Node const& bin_op) const
- {
- return bin_op.op;
- }
-};
-
-boost::phoenix::function<get_op> _op;
-
 #endif

Deleted: branches/release/libs/spirit/example/karma/functor_facilities.cpp
==============================================================================
--- branches/release/libs/spirit/example/karma/functor_facilities.cpp 2009-09-14 12:45:39 EDT (Mon, 14 Sep 2009)
+++ (empty file)
@@ -1,199 +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)
-
-// This examples demonstrate how to write functor based generators for special
-// purposes.
-
-#include <boost/config/warning_disable.hpp>
-#include <boost/spirit/include/karma.hpp>
-#include <boost/spirit/include/karma_stream.hpp>
-
-#include <boost/spirit/include/phoenix_core.hpp>
-#include <boost/spirit/include/phoenix_bind.hpp>
-
-#include <iostream>
-#include <string>
-#include <vector>
-#include <list>
-#include <algorithm>
-#include <cstdlib>
-
-using namespace boost::spirit;
-
-///////////////////////////////////////////////////////////////////////////////
-// The functor generator 'counter' can be used for output annotation with some
-// item counting information.
-///////////////////////////////////////////////////////////////////////////////
-struct counter_impl : boost::spirit::karma::functor_base
-{
- template <typename OutputIterator, typename Context, typename Parameter>
- bool operator()(Parameter const&, Context& ctx, OutputIterator& sink) const
- {
- return karma::generate(sink, int_ << ": ", counter++);
- }
-
- counter_impl(int& counter_)
- : counter(counter_) {}
-
- int& counter;
-};
-
-inline boost::spirit::result_of::as_generator<counter_impl>::type
-counter(int& counter_)
-{
- using namespace boost::spirit::karma;
- return as_generator(counter_impl(counter_));
-}
-
-///////////////////////////////////////////////////////////////////////////////
-// The functor generator 'confix' allows a simple syntax for generating
-// output wrapped inside a pair of a prefix and a suffix.
-///////////////////////////////////////////////////////////////////////////////
-template <typename Expr>
-struct confix_impl : public boost::spirit::karma::functor_base
-{
- template <typename Context>
- struct apply
- {
- typedef boost::spirit::hold_any type;
- };
-
- template <typename OutputIterator, typename Context, typename Parameter>
- bool operator()(Parameter const& v, Context& ctx, OutputIterator& sink) const
- {
- return karma::generate(sink, open << xpr << close, v);
- }
-
- confix_impl(char const* open_, char const* close_, Expr const& xpr_)
- : open(open_), close(close_), xpr(xpr_) {}
-
- std::string open;
- std::string close;
- Expr xpr;
-};
-
-template <typename Expr>
-inline typename boost::spirit::result_of::as_generator<confix_impl<Expr> >::type
-confix(Expr const& xpr_, char const* open_ = "", char const* close_ = "")
-{
- using namespace boost::spirit::karma;
- return as_generator(confix_impl<Expr>(open_, close_, xpr_));
-}
-
-///////////////////////////////////////////////////////////////////////////////
-// The functor generator 'list' allows a simple syntax for generating
-// list formatted output.
-//
-// This example uses phoenix::bind to allow to omit the second argument from
-// the operator() and to allow to switch the remaining two arguments.
-///////////////////////////////////////////////////////////////////////////////
-template <typename Expr>
-struct list_impl : boost::spirit::karma::functor_base
-{
- // this function will be called to generate the output
- template <typename OutputIterator, typename Parameter>
- bool operator()(OutputIterator& sink, Parameter const& v) const
- {
- return karma::generate(sink, xpr % delim, v);
- }
-
- list_impl(Expr const& xpr_, char const* delim_)
- : xpr(xpr_), delim(delim_) {}
-
- Expr xpr;
- std::string delim;
-};
-
-// Supply the expected parameter type explicitly
-struct list_impl_mf
-{
- // the expected parameter type of a functor has to be defined using a
- // embedded apply metafunction
- template <typename Context>
- struct apply
- {
- typedef boost::spirit::hold_any type;
- };
-};
-
-template <typename Expr>
-inline list_impl<Expr>
-list(Expr const& xpr, char const* delim)
-{
- return list_impl<Expr>(xpr, delim);
-}
-
-///////////////////////////////////////////////////////////////////////////////
-int main()
-{
- using namespace boost::phoenix;
- using namespace boost::phoenix::arg_names;
-
- ///////////////////////////////////////////////////////////////////////////
- // Output the given containers in list format
- // We use a special functor generator here to annotate the output with
- // a integer counting the entries.
- ///////////////////////////////////////////////////////////////////////////
- std::vector<int> v (8);
- std::generate(v.begin(), v.end(), std::rand); // randomly fill the vector
-
- int counter1 = 1;
- std::cout <<
- karma::format(
- (counter(counter1) << int_) % ", ", // format description
- v // data
- ) << std::endl;
-
- // Here we initialize the counter to 100
- int counter2 = 100;
- std::cout <<
- karma::format(
- '[' << (
- (counter(counter2) << int_) % ", "
- ) << ']', // format description
- v // data
- ) << std::endl;
-
- ///////////////////////////////////////////////////////////////////////////
- // list
- // The output format description used below adds special item formatting
- ///////////////////////////////////////////////////////////////////////////
- std::list<std::string> names;
- names.push_back("Spirit");
- names.push_back("Qi");
- names.push_back("Karma");
-
- // specifying a prefix item suffix scheme directly
- std::cout <<
- karma::format(
- ('{' << stream << '}') % ", ", // format description
- names // data
- ) << std::endl;
-
- // The confix generator nicely wraps the given expression with prefix and
- // suffix strings
- std::cout <<
- karma::format(
- confix(stream % ", ", "[", "]"), // format description
- names // data
- ) << std::endl;
-
- ///////////////////////////////////////////////////////////////////////////
- // Output the given container as a list
- // We use a separate metafunction list_impl_mf to specify the expected
- // parameter type of this functor generator.
- // We use phoenix::bind to allow to omit the 2nd argument from the functor
- // function operator and to change the sequence of the remaining two
- // arguments.
- ///////////////////////////////////////////////////////////////////////////
- std::string str("Hello world!");
- std::cout <<
- karma::format(
- karma::as_generator_mf<list_impl_mf>(bind(list(stream, ", "), _3, _1)),
- str
- ) << std::endl;
-
- return 0;
-}

Modified: branches/release/libs/spirit/example/karma/mini_xml_karma.cpp
==============================================================================
--- branches/release/libs/spirit/example/karma/mini_xml_karma.cpp (original)
+++ branches/release/libs/spirit/example/karma/mini_xml_karma.cpp 2009-09-14 12:45:39 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
 
     Distributed under the Boost Software License, Version 1.0. (See accompanying
     file LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt)
@@ -15,6 +15,7 @@
 ///////////////////////////////////////////////////////////////////////////////
 
 #include <boost/config/warning_disable.hpp>
+
 #include <boost/spirit/include/qi.hpp>
 #include <boost/spirit/include/karma.hpp>
 #include <boost/spirit/include/phoenix_core.hpp>
@@ -32,7 +33,6 @@
 
 using namespace boost::spirit;
 using namespace boost::spirit::ascii;
-using namespace boost::spirit::arg_names;
 
 namespace fusion = boost::fusion;
 namespace phoenix = boost::phoenix;
@@ -80,6 +80,7 @@
 
         start_tag =
                 '<'
+ >> !lit('/')
>> lexeme[+(char_ - '>') [_val += _1]]
>> '>'
         ;
@@ -132,14 +133,11 @@
 {
     mini_xml_generator() : mini_xml_generator::base_type(xml)
     {
- node %=
- lit[_1 = _string(_r0)]
- | xml[_1 = _xml(_r0)]
- ;
-
- xml = char_('<') << lit(at_c<0>(_r0)) << '>'
- << (*node)[_1 = at_c<1>(_r0)]
- << lit("</") << lit(at_c<0>(_r0)) << '>'
+ node %= string | xml;
+ xml =
+ '<' << string[_1 = at_c<0>(_val)] << '>'
+ << (*node)[_1 = at_c<1>(_val)]
+ << "</" << string[_1 = at_c<0>(_val)] << '>'
             ;
     }
 
@@ -185,7 +183,7 @@
 
     std::string::const_iterator iter = storage.begin();
     std::string::const_iterator end = storage.end();
- bool r = qi::phrase_parse(iter, end, xmlin, ast, space);
+ bool r = qi::phrase_parse(iter, end, xmlin, space, ast);
 
     if (r && iter == end)
     {
@@ -199,7 +197,8 @@
         mini_xml_generator xmlout; // Our grammar definition
 
         std::string generated;
- bool r = karma::generate(std::back_inserter(generated), xmlout, ast);
+ outiter_type outit(generated);
+ bool r = karma::generate(outit, xmlout, ast);
 
         if (r)
             std::cout << generated << std::endl;
@@ -207,8 +206,11 @@
     }
     else
     {
- std::string::const_iterator some = iter+30;
- std::string context(iter, (some>end)?end:some);
+ std::string::const_iterator begin = storage.begin();
+ std::size_t dist = std::distance(begin, iter);
+ std::string::const_iterator some =
+ iter + (std::min)(storage.size()-dist, std::size_t(30));
+ std::string context(iter, some);
         std::cout << "-------------------------\n";
         std::cout << "Parsing failed\n";
         std::cout << "stopped at: \": " << context << "...\"\n";

Modified: branches/release/libs/spirit/example/karma/quick_start1.cpp
==============================================================================
--- branches/release/libs/spirit/example/karma/quick_start1.cpp (original)
+++ branches/release/libs/spirit/example/karma/quick_start1.cpp 2009-09-14 12:45:39 EDT (Mon, 14 Sep 2009)
@@ -41,15 +41,15 @@
     std::cout <<
         karma::format_delimited(
             *int_, // format description
- v, // data
- space // delimiter
+ space, // delimiter
+ v // data
         ) << std::endl << std::endl;
 
     std::cout <<
         karma::format_delimited(
             '[' << *int_ << ']', // format description
- v, // data
- space // delimiter
+ space, // delimiter
+ v // data
         ) << std::endl << std::endl;
 
     // output the container as a comma separated list
@@ -98,8 +98,8 @@
                 // no delimiting within verbatim
                 *verbatim[" <li>" << int_ << "</li>"]
             << "</ol>", // format description
- v, // data
- '\n' // delimiter
+ '\n', // delimiter
+ v // data
         ) << std::endl;
 
     // output the container as right aligned column
@@ -109,8 +109,8 @@
            *verbatim[
                 "|" << right_align[int_] << "|"
             ], // format description
- v, // data
- '\n' // delimiter
+ '\n', // delimiter
+ v // data
         ) << std::endl;
 
     std::cout << std::endl;

Modified: branches/release/libs/spirit/example/lex/Jamfile
==============================================================================
--- branches/release/libs/spirit/example/lex/Jamfile (original)
+++ branches/release/libs/spirit/example/lex/Jamfile 2009-09-14 12:45:39 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
 #
 # Distributed under the Boost Software License, Version 1.0. (See accompanying
 # file LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt)
@@ -8,16 +8,17 @@
 
 project spirit-lexer-example ;
 
-exe example1 : example1.cpp ;
-exe example2 : example2.cpp ;
-exe example3 : example3.cpp ;
-exe example4 : example4.cpp ;
-exe example5 : example5.cpp ;
-exe example6 : example6.cpp ;
-exe print_numbers : print_numbers.cpp ;
-exe word_count : word_count.cpp ;
-exe word_count_functor : word_count_functor.cpp ;
-exe word_count_lexer : word_count_lexer.cpp ;
-exe strip_comments : strip_comments.cpp ;
-exe strip_comments_lexer : strip_comments_lexer.cpp ;
+exe example1 : example1.cpp ;
+exe example2 : example2.cpp ;
+exe example3 : example3.cpp ;
+exe example4 : example4.cpp ;
+exe example5 : example5.cpp ;
+exe example6 : example6.cpp ;
+exe print_numbers : print_numbers.cpp ;
+exe word_count : word_count.cpp ;
+exe word_count_functor : word_count_functor.cpp ;
+exe word_count_lexer : word_count_lexer.cpp ;
+exe word_count_functor_flex : word_count_functor_flex.cpp ;
+exe strip_comments : strip_comments.cpp ;
+exe strip_comments_lexer : strip_comments_lexer.cpp ;
 

Modified: branches/release/libs/spirit/example/lex/example1.cpp
==============================================================================
--- branches/release/libs/spirit/example/lex/example1.cpp (original)
+++ branches/release/libs/spirit/example/lex/example1.cpp 2009-09-14 12:45:39 EDT (Mon, 14 Sep 2009)
@@ -1,14 +1,13 @@
 // 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)
 
 // Simple lexer/parser to test the Spirit installation.
 //
-// This example shows, how to create a simple lexer recognizing 4 different
+// This example shows, how to create a simple lexer recognizing 5 different
 // tokens, and how to use a single token definition as the skip parser during
-// the parsing. Additionally it demonstrates how to use one of the defined
+// the parsing. Additionally, it demonstrates how to use one of the defined
 // tokens as a parser component in the grammar.
 //
 // The grammar recognizes a simple input structure, for instance:
@@ -20,9 +19,11 @@
 // Any number of simple sentences (optionally comma separated) inside a pair
 // of curly braces will be matched.
 
+// #define BOOST_SPIRIT_LEXERTL_DEBUG
+
 #include <boost/config/warning_disable.hpp>
 #include <boost/spirit/include/qi.hpp>
-#include <boost/spirit/include/lex_lexer_lexertl.hpp>
+#include <boost/spirit/include/lex_lexertl.hpp>
 
 #include <iostream>
 #include <fstream>
@@ -31,6 +32,7 @@
 #include "example.hpp"
 
 using namespace boost::spirit;
+using namespace boost::spirit::ascii;
 using namespace boost::spirit::qi;
 using namespace boost::spirit::lex;
 
@@ -38,21 +40,20 @@
 // Token definition
 ///////////////////////////////////////////////////////////////////////////////
 template <typename Lexer>
-struct example1_tokens : lexer_def<Lexer>
+struct example1_tokens : lexer<Lexer>
 {
- template <typename Self>
- void def (Self& self)
+ example1_tokens()
     {
         // define tokens and associate them with the lexer
         identifier = "[a-zA-Z_][a-zA-Z0-9_]*";
- self = token_def<>(',') | '{' | '}' | identifier;
-
+ this->self = char_(',') | '{' | '}' | identifier;
+
         // any token definition to be used as the skip parser during parsing
         // has to be associated with a separate lexer state (here 'WS')
- white_space = "[ \\t\\n]+";
- self("WS") = white_space;
+ this->white_space = "[ \\t\\n]+";
+ this->self("WS") = white_space;
     }
-
+
     token_def<> identifier, white_space;
 };
 
@@ -78,29 +79,27 @@
 {
     // iterator type used to expose the underlying input stream
     typedef std::string::iterator base_iterator_type;
-
+
     // This is the token type to return from the lexer iterator
- typedef lexertl_token<base_iterator_type> token_type;
-
+ typedef lexertl::token<base_iterator_type> token_type;
+
     // This is the lexer type to use to tokenize the input.
     // We use the lexertl based lexer engine.
- typedef lexertl_lexer<token_type> lexer_type;
-
- // This is the token definition type (derived from the given lexer type).
- typedef example1_tokens<lexer_type> example1_tokens;
-
+ typedef lexertl::lexer<token_type> lexer_type;
+
+ // This is the lexer type (derived from the given lexer type).
+ typedef example1_tokens<lexer_type> example1_lex;
+
     // This is the iterator type exposed by the lexer
- typedef lexer<example1_tokens>::iterator_type iterator_type;
+ typedef example1_lex::iterator_type iterator_type;
 
     // This is the type of the grammar to parse
     typedef example1_grammar<iterator_type> example1_grammar;
 
     // now we use the types defined above to create the lexer and grammar
     // object instances needed to invoke the parsing process
- example1_tokens tokens; // Our token definition
- example1_grammar calc(tokens); // Our grammar definition
-
- lexer<example1_tokens> lex(tokens); // Our lexer
+ example1_lex lex; // Our lexer
+ example1_grammar calc(lex); // Our grammar definition
 
     std::string str (read_from_file("example1.input"));
 
@@ -115,7 +114,7 @@
     // Note, how we use the token_def defined above as the skip parser. It must
     // be explicitly wrapped inside a state directive, switching the lexer
     // state for the duration of skipping whitespace.
- bool r = phrase_parse(iter, end, calc, in_state("WS")[tokens.white_space]);
+ bool r = phrase_parse(iter, end, calc, in_state("WS")[lex.white_space]);
 
     if (r && iter == end)
     {

Modified: branches/release/libs/spirit/example/lex/example2.cpp
==============================================================================
--- branches/release/libs/spirit/example/lex/example2.cpp (original)
+++ branches/release/libs/spirit/example/lex/example2.cpp 2009-09-14 12:45:39 EDT (Mon, 14 Sep 2009)
@@ -1,5 +1,4 @@
 // 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)
@@ -22,7 +21,7 @@
 
 #include <boost/config/warning_disable.hpp>
 #include <boost/spirit/include/qi.hpp>
-#include <boost/spirit/include/lex_lexer_lexertl.hpp>
+#include <boost/spirit/include/lex_lexertl.hpp>
 #include <boost/spirit/include/phoenix_operator.hpp>
 
 #include <iostream>
@@ -32,6 +31,7 @@
 #include "example.hpp"
 
 using namespace boost::spirit;
+using namespace boost::spirit::ascii;
 using namespace boost::spirit::qi;
 using namespace boost::spirit::lex;
 using boost::phoenix::ref;
@@ -40,10 +40,9 @@
 // Token definition
 ///////////////////////////////////////////////////////////////////////////////
 template <typename Lexer>
-struct example2_tokens : lexer_def<Lexer>
+struct example2_tokens : lexer<Lexer>
 {
- template <typename Self>
- void def (Self& self)
+ example2_tokens()
     {
         // A 'word' is comprised of one or more letters and an optional
         // apostrophe. If it contains an apostrophe, there may only be one and
@@ -51,11 +50,15 @@
         // For example, "I'm" and "doesn't" meet the definition of 'word' we
         // define below.
         word = "[a-zA-Z]+('[a-zA-Z]+)?";
-
- // associate the tokens and the token set with the lexer
- self = token_def<>(',') | '!' | '.' | '?' | ' ' | '\n' | word;
+
+ // Associate the tokens and the token set with the lexer. Note that
+ // single character token definitions as used below always get
+ // interpreted literally and never as special regex characters. This is
+ // done to be able to assign single characters the id of their character
+ // code value, allowing to reference those as literals in Qi grammars.
+ this->self = token_def<>(',') | '!' | '.' | '?' | ' ' | '\n' | word;
     }
-
+
     token_def<> word;
 };
 
@@ -67,8 +70,8 @@
 {
     template <typename TokenDef>
     example2_grammar(TokenDef const& tok)
- : example2_grammar::base_type(story),
- paragraphs(0), commands(0), questions(0), statements(0)
+ : example2_grammar::base_type(story)
+ , paragraphs(0), commands(0), questions(0), statements(0)
     {
         story
             = +paragraph
@@ -112,38 +115,36 @@
 {
     // iterator type used to expose the underlying input stream
     typedef std::string::iterator base_iterator_type;
-
+
     // This is the token type to return from the lexer iterator
- typedef lexertl_token<base_iterator_type> token_type;
-
+ typedef lexertl::token<base_iterator_type> token_type;
+
     // This is the lexer type to use to tokenize the input.
     // Here we use the lexertl based lexer engine.
- typedef lexertl_lexer<token_type> lexer_type;
-
+ typedef lexertl::lexer<token_type> lexer_type;
+
     // This is the token definition type (derived from the given lexer type).
     typedef example2_tokens<lexer_type> example2_tokens;
-
+
     // this is the iterator type exposed by the lexer
- typedef lexer<example2_tokens>::iterator_type iterator_type;
+ typedef example2_tokens::iterator_type iterator_type;
 
     // this is the type of the grammar to parse
     typedef example2_grammar<iterator_type> example2_grammar;
 
     // now we use the types defined above to create the lexer and grammar
     // object instances needed to invoke the parsing process
- example2_tokens tokens; // Our token definition
- example2_grammar calc(tokens); // Our grammar definition
-
- lexer<example2_tokens> lex(tokens); // Our lexer
+ example2_tokens tokens; // Our lexer
+ example2_grammar calc(tokens); // Our parser
 
     std::string str (read_from_file("example2.input"));
 
     // At this point we generate the iterator pair used to expose the
     // tokenized input stream.
     std::string::iterator it = str.begin();
- iterator_type iter = lex.begin(it, str.end());
- iterator_type end = lex.end();
-
+ iterator_type iter = tokens.begin(it, str.end());
+ iterator_type end = tokens.end();
+
     // Parsing is done based on the the token stream, not the character
     // stream read from the input.
     bool r = parse(iter, end, calc);

Modified: branches/release/libs/spirit/example/lex/example3.cpp
==============================================================================
--- branches/release/libs/spirit/example/lex/example3.cpp (original)
+++ branches/release/libs/spirit/example/lex/example3.cpp 2009-09-14 12:45:39 EDT (Mon, 14 Sep 2009)
@@ -1,5 +1,4 @@
 // 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)
@@ -24,7 +23,7 @@
 
 #include <boost/config/warning_disable.hpp>
 #include <boost/spirit/include/qi.hpp>
-#include <boost/spirit/include/lex_lexer_lexertl.hpp>
+#include <boost/spirit/include/lex_lexertl.hpp>
 
 #include <iostream>
 #include <fstream>
@@ -40,32 +39,27 @@
 // Token definition
 ///////////////////////////////////////////////////////////////////////////////
 template <typename Lexer>
-struct example3_tokens : lexer_def<Lexer>
+struct example3_tokens : lexer<Lexer>
 {
- typedef typename Lexer::token_set token_set;
-
- template <typename Self>
- void def (Self& self)
+ example3_tokens()
     {
         // define the tokens to match
         ellipses = "\\.\\.\\.";
         number = "[0-9]+";
-
+
+ // associate the tokens and the token set with the lexer
+ this->self = ellipses | '(' | ')' | number;
+
         // define the whitespace to ignore (spaces, tabs, newlines and C-style
         // comments)
- white_space
+ this->self("WS")
             = token_def<>("[ \\t\\n]+") // whitespace
             | "\\/\\*[^*]*\\*+([^/*][^*]*\\*+)*\\/" // C style comments
             ;
-
- // associate the tokens and the token set with the lexer
- self = ellipses | '(' | ')' | number;
- self("WS") = white_space;
     }
-
+
     // these tokens expose the iterator_range of the matched input sequence
     token_def<> ellipses, identifier, number;
- token_set white_space;
 };
 
 ///////////////////////////////////////////////////////////////////////////////
@@ -73,7 +67,7 @@
 ///////////////////////////////////////////////////////////////////////////////
 template <typename Iterator, typename Lexer>
 struct example3_grammar
- : grammar<Iterator, in_state_skipper<typename Lexer::token_set> >
+ : grammar<Iterator, in_state_skipper<Lexer> >
 {
     template <typename TokenDef>
     example3_grammar(TokenDef const& tok)
@@ -97,8 +91,7 @@
         BOOST_SPIRIT_DEBUG_NODE(couplet);
     }
 
- typedef typename Lexer::token_set token_set;
- rule<Iterator, in_state_skipper<token_set> > start, couplet;
+ rule<Iterator, in_state_skipper<Lexer> > start, couplet;
 };
 
 ///////////////////////////////////////////////////////////////////////////////
@@ -108,41 +101,38 @@
     typedef std::string::iterator base_iterator_type;
 
     // This is the token type to return from the lexer iterator
- typedef lexertl_token<base_iterator_type> token_type;
+ typedef lexertl::token<base_iterator_type> token_type;
 
     // This is the lexer type to use to tokenize the input.
     // Here we use the lexertl based lexer engine.
- typedef lexertl_lexer<token_type> lexer_type;
+ typedef lexertl::lexer<token_type> lexer_type;
 
     // This is the token definition type (derived from the given lexer type).
     typedef example3_tokens<lexer_type> example3_tokens;
 
     // this is the iterator type exposed by the lexer
- typedef lexer<example3_tokens>::iterator_type iterator_type;
+ typedef example3_tokens::iterator_type iterator_type;
 
     // this is the type of the grammar to parse
- typedef example3_grammar<iterator_type, lexer_type> example3_grammar;
+ typedef example3_grammar<iterator_type, example3_tokens::lexer_def> example3_grammar;
 
     // now we use the types defined above to create the lexer and grammar
     // object instances needed to invoke the parsing process
- example3_tokens tokens; // Our token definition
- example3_grammar calc(tokens); // Our grammar definition
-
- lexer<example3_tokens> lex(tokens); // Our lexer
+ example3_tokens tokens; // Our lexer
+ example3_grammar calc(tokens); // Our parser
 
     std::string str (read_from_file("example3.input"));
 
     // At this point we generate the iterator pair used to expose the
     // tokenized input stream.
     std::string::iterator it = str.begin();
- iterator_type iter = lex.begin(it, str.end());
- iterator_type end = lex.end();
+ iterator_type iter = tokens.begin(it, str.end());
+ iterator_type end = tokens.end();
 
     // Parsing is done based on the the token stream, not the character
     // stream read from the input.
- // Note, how we use the token_set defined above as the skip parser.
- std::string ws("WS");
- bool r = phrase_parse(iter, end, calc, in_state(ws)[tokens.white_space]);
+ // Note how we use the lexer defined above as the skip parser.
+ bool r = phrase_parse(iter, end, calc, in_state("WS")[tokens.self]);
 
     if (r && iter == end)
     {

Modified: branches/release/libs/spirit/example/lex/example4.cpp
==============================================================================
--- branches/release/libs/spirit/example/lex/example4.cpp (original)
+++ branches/release/libs/spirit/example/lex/example4.cpp 2009-09-14 12:45:39 EDT (Mon, 14 Sep 2009)
@@ -1,17 +1,16 @@
 // 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)
 
 // This example shows how to create a simple lexer recognizing a couple of
 // different tokens aimed at a simple language and how to use this lexer with
-// a grammar. It shows how to associate values to tokens and how to access the
-// token values from inside the grammar.
+// a grammar. It shows how to associate attributes to tokens and how to access
+// the token attributes from inside the grammar.
 //
-// We use explicit token value types, making the corresponding token instances
+// We use explicit token attribute types, making the corresponding token instances
 // carry convert the matched input into an instance of that type. The token
-// value is exposed as the parser attribute if this token is used as a
+// attribute is exposed as the parser attribute if this token is used as a
 // parser component somewhere in a grammar.
 //
 // Additionally, this example demonstrates, how to define a token set usable
@@ -24,7 +23,7 @@
 
 #include <boost/config/warning_disable.hpp>
 #include <boost/spirit/include/qi.hpp>
-#include <boost/spirit/include/lex_lexer_lexertl.hpp>
+#include <boost/spirit/include/lex_lexertl.hpp>
 #include <boost/spirit/include/phoenix_operator.hpp>
 
 #include <iostream>
@@ -36,7 +35,6 @@
 using namespace boost::spirit;
 using namespace boost::spirit::qi;
 using namespace boost::spirit::lex;
-using namespace boost::spirit::arg_names;
 
 using boost::phoenix::val;
 
@@ -44,12 +42,9 @@
 // Token definition
 ///////////////////////////////////////////////////////////////////////////////
 template <typename Lexer>
-struct example4_tokens : lexer_def<Lexer>
+struct example4_tokens : lexer<Lexer>
 {
- typedef typename Lexer::token_set token_set;
-
- template <typename Self>
- void def (Self& self)
+ example4_tokens()
     {
         // define the tokens to match
         identifier = "[a-zA-Z_][a-zA-Z0-9_]*";
@@ -57,43 +52,39 @@
         if_ = "if";
         else_ = "else";
         while_ = "while";
-
+
+ // associate the tokens and the token set with the lexer
+ this->self = token_def<>('(') | ')' | '{' | '}' | '=' | ';' | constant;
+ this->self += if_ | else_ | while_ | identifier;
+
         // define the whitespace to ignore (spaces, tabs, newlines and C-style
         // comments)
- white_space
+ this->self("WS")
             = token_def<>("[ \\t\\n]+")
             | "\\/\\*[^*]*\\*+([^/*][^*]*\\*+)*\\/"
             ;
-
- // associate the tokens and the token set with the lexer
- self = token_def<>('(') | ')' | '{' | '}' | '=' | ';' | constant;
- self += if_ | else_ | while_ | identifier;
- self("WS") = white_space;
     }
 
 //[example4_token_def
     // these tokens expose the iterator_range of the matched input sequence
     token_def<> if_, else_, while_;
-
- // The following two tokens have an associated value type, 'identifier'
+
+ // The following two tokens have an associated attribute type, 'identifier'
     // carries a string (the identifier name) and 'constant' carries the
     // matched integer value.
     //
- // Note: any token value type specified explicitly during a token_def<>
+ // Note: any token attribute type explicitly specified in a token_def<>
     // declaration needs to be listed during token type definition as
     // well (see the typedef for the token_type below).
     //
     // The conversion of the matched input to an instance of this type occurs
- // once (on first access), which makes token values as efficient as
+ // once (on first access), which makes token attributes as efficient as
     // possible. Moreover, token instances are constructed once by the lexer
     // library. From this point on tokens are passed by reference only,
- // avoiding tokens being copied around.
+ // avoiding them being copied around.
     token_def<std::string> identifier;
     token_def<unsigned int> constant;
 //]
-
- // token set to be used as the skip parser
- token_set white_space;
 };
 
 ///////////////////////////////////////////////////////////////////////////////
@@ -101,12 +92,14 @@
 ///////////////////////////////////////////////////////////////////////////////
 template <typename Iterator, typename Lexer>
 struct example4_grammar
- : grammar<Iterator, in_state_skipper<typename Lexer::token_set> >
+ : grammar<Iterator, in_state_skipper<Lexer> >
 {
     template <typename TokenDef>
     example4_grammar(TokenDef const& tok)
       : example4_grammar::base_type(program)
     {
+ using boost::spirit::_val;
+
         program
             = +block
             ;
@@ -153,15 +146,14 @@
             ;
     }
 
- typedef typename Lexer::token_set token_set;
     typedef boost::variant<unsigned int, std::string> expression_type;
-
- rule<Iterator, in_state_skipper<token_set> > program, block, statement;
- rule<Iterator, in_state_skipper<token_set> > assignment, if_stmt;
- rule<Iterator, in_state_skipper<token_set> > while_stmt;
-
+
+ rule<Iterator, in_state_skipper<Lexer> > program, block, statement;
+ rule<Iterator, in_state_skipper<Lexer> > assignment, if_stmt;
+ rule<Iterator, in_state_skipper<Lexer> > while_stmt;
+
     // the expression is the only rule having a return value
- rule<Iterator, expression_type(), in_state_skipper<token_set> > expression;
+ rule<Iterator, expression_type(), in_state_skipper<Lexer> > expression;
 };
 
 ///////////////////////////////////////////////////////////////////////////////
@@ -169,58 +161,56 @@
 {
     // iterator type used to expose the underlying input stream
     typedef std::string::iterator base_iterator_type;
-
+
 //[example4_token
     // This is the lexer token type to use. The second template parameter lists
     // all attribute types used for token_def's during token definition (see
     // calculator_tokens<> above). Here we use the predefined lexertl token
     // type, but any compatible token type may be used instead.
     //
- // If you don't list any token value types in the following declaration
+ // If you don't list any token attribute types in the following declaration
     // (or just use the default token type: lexertl_token<base_iterator_type>)
     // it will compile and work just fine, just a bit less efficient. This is
- // because the token value will be generated from the matched input
+ // because the token attribute will be generated from the matched input
     // sequence every time it is requested. But as soon as you specify at
- // least one token value type you'll have to list all value types used
- // for token_def<> declarations in the token definition class above,
+ // least one token attribute type you'll have to list all attribute types
+ // used for token_def<> declarations in the token definition class above,
     // otherwise compilation errors will occur.
- typedef lexertl_token<
+ typedef lexertl::token<
         base_iterator_type, boost::mpl::vector<unsigned int, std::string>
> token_type;
 //]
     // Here we use the lexertl based lexer engine.
- typedef lexertl_lexer<token_type> lexer_type;
-
+ typedef lexertl::lexer<token_type> lexer_type;
+
     // This is the token definition type (derived from the given lexer type).
     typedef example4_tokens<lexer_type> example4_tokens;
-
+
     // this is the iterator type exposed by the lexer
- typedef lexer<example4_tokens>::iterator_type iterator_type;
+ typedef example4_tokens::iterator_type iterator_type;
 
     // this is the type of the grammar to parse
- typedef example4_grammar<iterator_type, lexer_type> example4_grammar;
+ typedef example4_grammar<iterator_type, example4_tokens::lexer_def> example4_grammar;
 
     // now we use the types defined above to create the lexer and grammar
     // object instances needed to invoke the parsing process
- example4_tokens tokens; // Our token definition
- example4_grammar calc(tokens); // Our grammar definition
-
- lexer<example4_tokens> lex(tokens); // Our lexer
+ example4_tokens tokens; // Our lexer
+ example4_grammar calc(tokens); // Our parser
 
     std::string str (read_from_file("example4.input"));
 
     // At this point we generate the iterator pair used to expose the
     // tokenized input stream.
     std::string::iterator it = str.begin();
- iterator_type iter = lex.begin(it, str.end());
- iterator_type end = lex.end();
+ iterator_type iter = tokens.begin(it, str.end());
+ iterator_type end = tokens.end();
         
     // Parsing is done based on the the token stream, not the character
     // stream read from the input.
- // Note, how we use the token_set defined above as the skip parser. It must
+ // Note how we use the lexer defined above as the skip parser. It must
     // be explicitly wrapped inside a state directive, switching the lexer
     // state for the duration of skipping whitespace.
- bool r = phrase_parse(iter, end, calc, in_state("WS")[tokens.white_space]);
+ bool r = phrase_parse(iter, end, calc, in_state("WS")[tokens.self]);
 
     if (r && iter == end)
     {

Modified: branches/release/libs/spirit/example/lex/example5.cpp
==============================================================================
--- branches/release/libs/spirit/example/lex/example5.cpp (original)
+++ branches/release/libs/spirit/example/lex/example5.cpp 2009-09-14 12:45:39 EDT (Mon, 14 Sep 2009)
@@ -1,22 +1,21 @@
 // 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)
 
 // This example shows how to create a simple lexer recognizing a couple of
 // different tokens aimed at a simple language and how to use this lexer with
-// a grammar. It shows how to associate values to tokens and how to access the
-// token values from inside the grammar.
+// a grammar. It shows how to associate attributes to tokens and how to access the
+// token attributes from inside the grammar.
 //
 // Additionally, this example demonstrates, how to define a token set usable
 // as the skip parser during parsing, allowing to define several tokens to be
 // ignored.
 //
-// The main purpose of this example is to show, how inheritance can be used to
+// The main purpose of this example is to show how inheritance can be used to
 // overload parts of a base grammar and add token definitions to a base lexer.
 //
-// Further, it shows how you can use the 'omitted' attribute type specifier
+// Further, it shows how you can use the 'omit' attribute type specifier
 // for token definitions to force the token to have no attribute (expose an
 // unused attribute).
 //
@@ -26,7 +25,7 @@
 
 #include <boost/config/warning_disable.hpp>
 #include <boost/spirit/include/qi.hpp>
-#include <boost/spirit/include/lex_lexer_lexertl.hpp>
+#include <boost/spirit/include/lex_lexertl.hpp>
 #include <boost/spirit/include/phoenix_operator.hpp>
 
 #include <iostream>
@@ -38,7 +37,6 @@
 using namespace boost::spirit;
 using namespace boost::spirit::qi;
 using namespace boost::spirit::lex;
-using namespace boost::spirit::arg_names;
 
 using boost::phoenix::val;
 
@@ -46,53 +44,51 @@
 // Token definition base, defines all tokens for the base grammar below
 ///////////////////////////////////////////////////////////////////////////////
 template <typename Lexer>
-struct example5_base_tokens : lexer_def<Lexer>
+struct example5_base_tokens : lexer<Lexer>
 {
- typedef typename Lexer::token_set token_set;
-
- template <typename Self>
- void def (Self& self)
+protected:
+ // this lexer is supposed to be used as a base type only
+ example5_base_tokens() {}
+
+public:
+ void init_token_definitions()
     {
         // define the tokens to match
         identifier = "[a-zA-Z_][a-zA-Z0-9_]*";
         constant = "[0-9]+";
         if_ = "if";
         while_ = "while";
-
+
+ // associate the tokens and the token set with the lexer
+ this->self += token_def<>('(') | ')' | '{' | '}' | '=' | ';' | constant;
+ this->self += if_ | while_ | identifier;
+
         // define the whitespace to ignore (spaces, tabs, newlines and C-style
         // comments)
- white_space
+ this->self("WS")
             = token_def<>("[ \\t\\n]+")
             | "\\/\\*[^*]*\\*+([^/*][^*]*\\*+)*\\/"
             ;
-
- // associate the tokens and the token set with the lexer
- self += token_def<>('(') | ')' | '{' | '}' | '=' | ';' | constant;
- self += if_ | while_ | identifier;
- self("WS") = white_space;
     }
-
- // these tokens have no value
- token_def<omitted> if_, while_;
-
- // The following two tokens have an associated value type, identifier
- // carries a string (the identifier name) and constant carries the matched
- // integer value.
+
+ // these tokens have no attribute
+ token_def<lex::omit> if_, while_;
+
+ // The following two tokens have an associated attribute type, 'identifier'
+ // carries a string (the identifier name) and 'constant' carries the
+ // matched integer value.
     //
- // Note: any explicitly token value type specified during a token_def<>
+ // Note: any token attribute type explicitly specified in a token_def<>
     // declaration needs to be listed during token type definition as
     // well (see the typedef for the token_type below).
     //
     // The conversion of the matched input to an instance of this type occurs
- // once (on first access), which makes token values as efficient as
+ // once (on first access), which makes token attributes as efficient as
     // possible. Moreover, token instances are constructed once by the lexer
     // library. From this point on tokens are passed by reference only,
- // avoiding tokens being copied around.
+ // avoiding them being copied around.
     token_def<std::string> identifier;
     token_def<unsigned int> constant;
-
- // token set to be used as the skip parser
- token_set white_space;
 };
 
 ///////////////////////////////////////////////////////////////////////////////
@@ -100,12 +96,14 @@
 ///////////////////////////////////////////////////////////////////////////////
 template <typename Iterator, typename Lexer>
 struct example5_base_grammar
- : grammar<Iterator, in_state_skipper<typename Lexer::token_set> >
+ : grammar<Iterator, in_state_skipper<Lexer> >
 {
     template <typename TokenDef>
     example5_base_grammar(TokenDef const& tok)
       : example5_base_grammar::base_type(program)
     {
+ using boost::spirit::_val;
+
         program
             = +block
             ;
@@ -150,15 +148,12 @@
             ;
     }
 
- typedef
- grammar<Iterator, in_state_skipper<typename Lexer::token_set> >
- base_type;
- typedef typename base_type::skipper_type skipper_type;
-
+ typedef in_state_skipper<Lexer> skipper_type;
+
     rule<Iterator, skipper_type> program, block, statement;
     rule<Iterator, skipper_type> assignment, if_stmt;
     rule<Iterator, skipper_type> while_stmt;
-
+
     // the expression is the only rule having a return value
     typedef boost::variant<unsigned int, std::string> expression_type;
     rule<Iterator, expression_type(), skipper_type> expression;
@@ -170,25 +165,24 @@
 template <typename Lexer>
 struct example5_tokens : example5_base_tokens<Lexer>
 {
- typedef typename Lexer::token_set token_set;
-
- template <typename Self>
- void def (Self& self)
+ typedef example5_base_tokens<Lexer> base_type;
+
+ example5_tokens()
     {
         // define the additional token to match
         else_ = "else";
-
+
         // associate the new token with the lexer, note we add 'else' before
         // anything else to add it to the token set before the identifier
         // token, otherwise "else" would be matched as an identifier
- self = else_;
-
- // call the base class definition function
- example5_base_tokens<Lexer>::def(self);
+ this->self = else_;
+
+ // now add the token definitions from the base class
+ this->base_type::init_token_definitions();
     }
-
- // this token has no value
- token_def<omitted> else_;
+
+ // this token has no attribute
+ token_def<lex::omit> else_;
 };
 
 ///////////////////////////////////////////////////////////////////////////////
@@ -213,58 +207,56 @@
 {
     // iterator type used to expose the underlying input stream
     typedef std::string::iterator base_iterator_type;
-
+
     // This is the lexer token type to use. The second template parameter lists
     // all attribute types used for token_def's during token definition (see
- // calculator_tokens<> above). Here we use the predefined lexertl token
+ // example5_base_tokens<> above). Here we use the predefined lexertl token
     // type, but any compatible token type may be used instead.
     //
- // If you don't list any token value types in the following declaration
+ // If you don't list any token attribute types in the following declaration
     // (or just use the default token type: lexertl_token<base_iterator_type>)
     // it will compile and work just fine, just a bit less efficient. This is
- // because the token value will be generated from the matched input
+ // because the token attribute will be generated from the matched input
     // sequence every time it is requested. But as soon as you specify at
- // least one token value type you'll have to list all value types used
- // for token_def<> declarations in the token definition class above,
+ // least one token attribute type you'll have to list all attribute types
+ // used for token_def<> declarations in the token definition class above,
     // otherwise compilation errors will occur.
- typedef lexertl_token<
+ typedef lexertl::token<
         base_iterator_type, boost::mpl::vector<unsigned int, std::string>
> token_type;
-
+
     // Here we use the lexertl based lexer engine.
- typedef lexertl_lexer<token_type> lexer_type;
-
+ typedef lexertl::lexer<token_type> lexer_type;
+
     // This is the token definition type (derived from the given lexer type).
     typedef example5_tokens<lexer_type> example5_tokens;
-
+
     // this is the iterator type exposed by the lexer
- typedef lexer<example5_tokens>::iterator_type iterator_type;
+ typedef example5_tokens::iterator_type iterator_type;
 
     // this is the type of the grammar to parse
- typedef example5_grammar<iterator_type, lexer_type> example5_grammar;
+ typedef example5_grammar<iterator_type, example5_tokens::lexer_def> example5_grammar;
 
     // now we use the types defined above to create the lexer and grammar
     // object instances needed to invoke the parsing process
- example5_tokens tokens; // Our token definition
- example5_grammar calc(tokens); // Our grammar definition
-
- lexer<example5_tokens> lex(tokens); // Our lexer
+ example5_tokens tokens; // Our lexer
+ example5_grammar calc(tokens); // Our parser
 
     std::string str (read_from_file("example5.input"));
 
     // At this point we generate the iterator pair used to expose the
     // tokenized input stream.
     std::string::iterator it = str.begin();
- iterator_type iter = lex.begin(it, str.end());
- iterator_type end = lex.end();
-
+ iterator_type iter = tokens.begin(it, str.end());
+ iterator_type end = tokens.end();
+
     // Parsing is done based on the the token stream, not the character
     // stream read from the input.
- // Note, how we use the token_set defined above as the skip parser. It must
+ // Note how we use the lexer defined above as the skip parser. It must
     // be explicitly wrapped inside a state directive, switching the lexer
     // state for the duration of skipping whitespace.
     std::string ws("WS");
- bool r = phrase_parse(iter, end, calc, in_state(ws)[tokens.white_space]);
+ bool r = phrase_parse(iter, end, calc, in_state(ws)[tokens.self]);
 
     if (r && iter == end)
     {

Modified: branches/release/libs/spirit/example/lex/example6.cpp
==============================================================================
--- branches/release/libs/spirit/example/lex/example6.cpp (original)
+++ branches/release/libs/spirit/example/lex/example6.cpp 2009-09-14 12:45:39 EDT (Mon, 14 Sep 2009)
@@ -1,13 +1,12 @@
 // 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)
 
 // This example shows how to create a simple lexer recognizing a couple of
 // different tokens aimed at a simple language and how to use this lexer with
-// a grammar. It shows how to associate values to tokens and how to access the
-// token values from inside the grammar.
+// a grammar. It shows how to associate attributes to tokens and how to access the
+// token attributes from inside the grammar.
 //
 // Additionally, this example demonstrates, how to define a token set usable
 // as the skip parser during parsing, allowing to define several tokens to be
@@ -28,7 +27,7 @@
 
 #include <boost/config/warning_disable.hpp>
 #include <boost/spirit/include/qi.hpp>
-#include <boost/spirit/include/lex_lexer_lexertl.hpp>
+#include <boost/spirit/include/lex_lexertl.hpp>
 #include <boost/spirit/include/phoenix_operator.hpp>
 
 #include <iostream>
@@ -40,7 +39,6 @@
 using namespace boost::spirit;
 using namespace boost::spirit::qi;
 using namespace boost::spirit::lex;
-using namespace boost::spirit::arg_names;
 
 using boost::phoenix::val;
 
@@ -60,61 +58,52 @@
 // Token definitions
 ///////////////////////////////////////////////////////////////////////////////
 template <typename Lexer>
-struct example6_tokens : lexer_def<Lexer>
+struct example6_tokens : lexer<Lexer>
 {
- typedef typename Lexer::token_set token_set;
-
- template <typename Self>
- void def (Self& self)
+ example6_tokens()
     {
         // define the tokens to match
         identifier = "[a-zA-Z_][a-zA-Z0-9_]*";
         constant = "[0-9]+";
-
- // define the whitespace to ignore (spaces, tabs, newlines and C-style
- // comments)
- white_space
- = token_def<>("[ \\t\\n]+")
- | "\\/\\*[^*]*\\*+([^/*][^*]*\\*+)*\\/"
- ;
-
+
         // associate the tokens and the token set with the lexer
- self = token_def<>('(') | ')' | '{' | '}' | '=' | ';';
-
+ this->self = token_def<>('(') | ')' | '{' | '}' | '=' | ';';
+
         // Token definitions can be added by using some special syntactic
         // construct as shown below.
         // Note, that the token definitions added this way expose the iterator
         // pair pointing to the matched input stream as their attribute.
- self.add
+ this->self.add
             (constant, ID_CONSTANT)
             ("if", ID_IF)
             ("else", ID_ELSE)
             ("while", ID_WHILE)
             (identifier, ID_IDENTIFIER)
         ;
-
- // add whitespace tokens to another lexer state (here: "WS")
- self("WS") = white_space;
+
+ // define the whitespace to ignore (spaces, tabs, newlines and C-style
+ // comments) and add those to another lexer state (here: "WS")
+ this->self("WS")
+ = token_def<>("[ \\t\\n]+")
+ | "\\/\\*[^*]*\\*+([^/*][^*]*\\*+)*\\/"
+ ;
     }
-
- // The following two tokens have an associated value type, identifier
+
+ // The following two tokens have an associated attribute type, identifier
     // carries a string (the identifier name) and constant carries the matched
     // integer value.
     //
- // Note: any explicitly token value type specified during a token_def<>
+ // Note: any token attribute type explicitly specified in a token_def<>
     // declaration needs to be listed during token type definition as
     // well (see the typedef for the token_type below).
     //
     // The conversion of the matched input to an instance of this type occurs
- // once (on first access), which makes token values as efficient as
+ // once (on first access), which makes token attributes as efficient as
     // possible. Moreover, token instances are constructed once by the lexer
     // library. From this point on tokens are passed by reference only,
- // avoiding tokens being copied around.
+ // avoiding them being copied around.
     token_def<std::string> identifier;
     token_def<unsigned int> constant;
-
- // token set to be used as the skip parser
- token_set white_space;
 };
 
 ///////////////////////////////////////////////////////////////////////////////
@@ -122,12 +111,14 @@
 ///////////////////////////////////////////////////////////////////////////////
 template <typename Iterator, typename Lexer>
 struct example6_grammar
- : grammar<Iterator, in_state_skipper<typename Lexer::token_set> >
+ : grammar<Iterator, in_state_skipper<Lexer> >
 {
     template <typename TokenDef>
     example6_grammar(TokenDef const& tok)
       : example6_grammar::base_type(program)
     {
+ using boost::spirit::_val;
+
         program
             = +block
             ;
@@ -177,15 +168,14 @@
             ;
     }
 
- typedef typename Lexer::token_set token_set;
     typedef boost::variant<unsigned int, std::string> expression_type;
-
- rule<Iterator, in_state_skipper<token_set> > program, block, statement;
- rule<Iterator, in_state_skipper<token_set> > assignment, if_stmt;
- rule<Iterator, in_state_skipper<token_set> > while_stmt;
-
+
+ rule<Iterator, in_state_skipper<Lexer> > program, block, statement;
+ rule<Iterator, in_state_skipper<Lexer> > assignment, if_stmt;
+ rule<Iterator, in_state_skipper<Lexer> > while_stmt;
+
     // the expression is the only rule having a return value
- rule<Iterator, expression_type(), in_state_skipper<token_set> > expression;
+ rule<Iterator, expression_type(), in_state_skipper<Lexer> > expression;
 };
 
 ///////////////////////////////////////////////////////////////////////////////
@@ -193,58 +183,56 @@
 {
     // iterator type used to expose the underlying input stream
     typedef std::string::iterator base_iterator_type;
-
+
     // This is the lexer token type to use. The second template parameter lists
     // all attribute types used for token_def's during token definition (see
     // calculator_tokens<> above). Here we use the predefined lexertl token
     // type, but any compatible token type may be used instead.
     //
- // If you don't list any token value types in the following declaration
+ // If you don't list any token attribute types in the following declaration
     // (or just use the default token type: lexertl_token<base_iterator_type>)
     // it will compile and work just fine, just a bit less efficient. This is
- // because the token value will be generated from the matched input
+ // because the token attribute will be generated from the matched input
     // sequence every time it is requested. But as soon as you specify at
- // least one token value type you'll have to list all value types used
- // for token_def<> declarations in the token definition class above,
+ // least one token attribute type you'll have to list all attribute types
+ // used for token_def<> declarations in the token definition class above,
     // otherwise compilation errors will occur.
- typedef lexertl_token<
+ typedef lexertl::token<
         base_iterator_type, boost::mpl::vector<unsigned int, std::string>
> token_type;
-
+
     // Here we use the lexertl based lexer engine.
- typedef lexertl_lexer<token_type> lexer_type;
-
+ typedef lexertl::lexer<token_type> lexer_type;
+
     // This is the token definition type (derived from the given lexer type).
     typedef example6_tokens<lexer_type> example6_tokens;
-
+
     // this is the iterator type exposed by the lexer
- typedef lexer<example6_tokens>::iterator_type iterator_type;
+ typedef example6_tokens::iterator_type iterator_type;
 
     // this is the type of the grammar to parse
- typedef example6_grammar<iterator_type, lexer_type> example6_grammar;
+ typedef example6_grammar<iterator_type, example6_tokens::lexer_def> example6_grammar;
 
     // now we use the types defined above to create the lexer and grammar
     // object instances needed to invoke the parsing process
- example6_tokens tokens; // Our token definition
- example6_grammar calc(tokens); // Our grammar definition
-
- lexer<example6_tokens> lex(tokens); // Our lexer
+ example6_tokens tokens; // Our lexer
+ example6_grammar calc(tokens); // Our parser
 
     std::string str (read_from_file("example6.input"));
 
     // At this point we generate the iterator pair used to expose the
     // tokenized input stream.
     std::string::iterator it = str.begin();
- iterator_type iter = lex.begin(it, str.end());
- iterator_type end = lex.end();
-
+ iterator_type iter = tokens.begin(it, str.end());
+ iterator_type end = tokens.end();
+
     // Parsing is done based on the the token stream, not the character
     // stream read from the input.
- // Note, how we use the token_def defined above as the skip parser. It must
+ // Note how we use the lexer defined above as the skip parser. It must
     // be explicitly wrapped inside a state directive, switching the lexer
     // state for the duration of skipping whitespace.
     std::string ws("WS");
- bool r = phrase_parse(iter, end, calc, in_state(ws)[tokens.white_space]);
+ bool r = phrase_parse(iter, end, calc, in_state(ws)[tokens.self]);
 
     if (r && iter == end)
     {

Modified: branches/release/libs/spirit/example/lex/print_numbers.cpp
==============================================================================
--- branches/release/libs/spirit/example/lex/print_numbers.cpp (original)
+++ branches/release/libs/spirit/example/lex/print_numbers.cpp 2009-09-14 12:45:39 EDT (Mon, 14 Sep 2009)
@@ -21,7 +21,7 @@
 
 #include <boost/config/warning_disable.hpp>
 #include <boost/spirit/include/qi.hpp>
-#include <boost/spirit/include/lex_lexer_lexertl.hpp>
+#include <boost/spirit/include/lex_lexertl.hpp>
 #include <boost/spirit/include/phoenix_operator.hpp>
 
 #include <iostream>
@@ -32,20 +32,21 @@
 using namespace boost::spirit;
 using namespace boost::spirit::qi;
 using namespace boost::spirit::lex;
-using namespace boost::spirit::arg_names;
 
 ///////////////////////////////////////////////////////////////////////////////
 // Token definition: We use the lexertl based lexer engine as the underlying
 // lexer type.
 ///////////////////////////////////////////////////////////////////////////////
 template <typename Lexer>
-struct print_numbers_tokens : lexer_def<Lexer>
+struct print_numbers_tokens : lexer<Lexer>
 {
- // define tokens and associate it with the lexer
- template <typename Self>
- void def (Self& self)
+ // define tokens and associate it with the lexer, we set the lexer flags
+ // not to match newlines while matching a dot, so we need to add the
+ // '\n' explicitly below
+ print_numbers_tokens()
+ : print_numbers_tokens::base_type(match_flags::match_not_dot_newline)
     {
- self = token_def<int>("[0-9]*") | ".|\n";
+ this->self = token_def<int>("[0-9]*") | ".|\n";
     }
 };
 
@@ -56,8 +57,11 @@
 struct print_numbers_grammar : grammar<Iterator>
 {
     print_numbers_grammar()
- : grammar<Iterator>(start)
+ : print_numbers_grammar::base_type(start)
     {
+ // we just know, that the token ids get assigned starting min_token_id
+ // so, "[0-9]*" gets the id 'min_token_id' and ".|\n" gets the id
+ // 'min_token_id+1'.
         start = *( token(lex::min_token_id) [ std::cout << _1 << "\n" ]
                   | token(lex::min_token_id+1)
                   )
@@ -74,30 +78,26 @@
     typedef std::string::iterator base_iterator_type;
 
     // the token type to be used, 'int' is available as the type of the token
- // value and no lexer state is supported
- typedef lexertl_token<
- base_iterator_type, boost::mpl::vector<int>, boost::mpl::false_
- > token_type;
-
+ // attribute and no lexer state is supported
+ typedef lexertl::token<base_iterator_type, boost::mpl::vector<int>
+ , boost::mpl::false_> token_type;
+
     // lexer type
- typedef lexertl_lexer<token_type> lexer_type;
-
+ typedef lexertl::lexer<token_type> lexer_type;
+
     // iterator type exposed by the lexer
- typedef
- lexer_iterator<print_numbers_tokens<lexer_type> >::type
- iterator_type;
+ typedef print_numbers_tokens<lexer_type>::iterator_type iterator_type;
 
     // now we use the types defined above to create the lexer and grammar
     // object instances needed to invoke the parsing process
- print_numbers_tokens<lexer_type> print_tokens; // Our token definition
- print_numbers_grammar<iterator_type> print; // Our grammar definition
+ print_numbers_tokens<lexer_type> print_tokens; // Our lexer
+ print_numbers_grammar<iterator_type> print; // Our parser
 
     // Parsing is done based on the the token stream, not the character
     // stream read from the input.
     std::string str (read_from_file(1 == argc ? "print_numbers.input" : argv[1]));
     base_iterator_type first = str.begin();
- bool r = tokenize_and_parse(first, str.end(), make_lexer(print_tokens),
- print);
+ bool r = tokenize_and_parse(first, str.end(), print_tokens, print);
 
     if (r) {
         std::cout << "-------------------------\n";

Modified: branches/release/libs/spirit/example/lex/static_lexer/Jamfile
==============================================================================
--- branches/release/libs/spirit/example/lex/static_lexer/Jamfile (original)
+++ branches/release/libs/spirit/example/lex/static_lexer/Jamfile 2009-09-14 12:45:39 EDT (Mon, 14 Sep 2009)
@@ -1,6 +1,5 @@
 #==============================================================================
-# Copyright (c) 2001-2007 Joel de Guzman
-# 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,3 +10,6 @@
 exe word_count_generate : word_count_generate.cpp ;
 exe word_count_static : word_count_static.cpp ;
 
+exe word_count_lexer_generate : word_count_lexer_generate.cpp ;
+exe word_count_lexer_static : word_count_lexer_static.cpp ;
+

Modified: branches/release/libs/spirit/example/lex/static_lexer/word_count_generate.cpp
==============================================================================
--- branches/release/libs/spirit/example/lex/static_lexer/word_count_generate.cpp (original)
+++ branches/release/libs/spirit/example/lex/static_lexer/word_count_generate.cpp 2009-09-14 12:45:39 EDT (Mon, 14 Sep 2009)
@@ -14,8 +14,8 @@
 // #define BOOST_SPIRIT_LEXERTL_DEBUG
 
 #include <boost/config/warning_disable.hpp>
-#include <boost/spirit/include/lex_lexer_lexertl.hpp>
-#include <boost/spirit/home/lex/lexer/lexertl/lexertl_generate_static.hpp>
+#include <boost/spirit/include/lex_lexertl.hpp>
+#include <boost/spirit/include/lex_generate_static_lexertl.hpp>
 
 #include <fstream>
 
@@ -29,15 +29,18 @@
 int main(int argc, char* argv[])
 {
     // create the lexer object instance needed to invoke the generator
- word_count_tokens<lexertl_lexer<> > word_count; // the token definition
+ word_count_tokens<lexertl::lexer<> > word_count; // the token definition
 
     // open the output file, where the generated tokenizer function will be
     // written to
     std::ofstream out(argc < 2 ? "word_count_static.hpp" : argv[1]);
 
     // invoke the generator, passing the token definition, the output stream
- // and the name prefix of the tokenizing function to be generated
- char const* function_name = (argc < 3 ? "" : argv[2]);
- return generate_static(make_lexer(word_count), out, function_name) ? 0 : -1;
+ // and the name suffix of the tables and functions to be generated
+ //
+ // The suffix "wc" used below results in a type lexertl::static_::lexer_wc
+ // to be generated, which needs to be passed as a template parameter to the
+ // lexertl::static_lexer template (see word_count_static.cpp).
+ return lexertl::generate_static(word_count, out, "wc") ? 0 : -1;
 }
 //]

Modified: branches/release/libs/spirit/example/lex/static_lexer/word_count_static.cpp
==============================================================================
--- branches/release/libs/spirit/example/lex/static_lexer/word_count_static.cpp (original)
+++ branches/release/libs/spirit/example/lex/static_lexer/word_count_static.cpp 2009-09-14 12:45:39 EDT (Mon, 14 Sep 2009)
@@ -17,7 +17,7 @@
 #include <boost/config/warning_disable.hpp>
 #include <boost/spirit/include/qi.hpp>
 //[wc_static_include
-#include <boost/spirit/include/lex_lexer_static_lexertl.hpp>
+#include <boost/spirit/include/lex_static_lexertl.hpp>
 //]
 #include <boost/spirit/include/phoenix_operator.hpp>
 #include <boost/spirit/include/phoenix_statement.hpp>
@@ -27,11 +27,11 @@
 #include <string>
 
 #include "../example.hpp"
-#include "word_count_tokens.hpp" // token definition
-
-#include "word_count_static.hpp" // generated tokenizer
+#include "word_count_tokens.hpp" // token definition
+#include "word_count_static.hpp" // generated tokenizer
 
 using namespace boost::spirit;
+using namespace boost::spirit::ascii;
 using namespace boost::spirit::qi;
 using namespace boost::spirit::lex;
 
@@ -48,17 +48,17 @@
 {
     template <typename TokenDef>
     word_count_grammar(TokenDef const& tok)
- : grammar<Iterator>(start), c(0), w(0), l(0)
+ : word_count_grammar::base_type(start)
+ , c(0), w(0), l(0)
     {
- using boost::spirit::arg_names::_1;
         using boost::phoenix::ref;
         using boost::phoenix::size;
-
+
         // associate the defined tokens with the lexer, at the same time
         // defining the actions to be executed
- start = *( tok.word [++ref(w), ref(c) += size(_1)]
- | char_('\n') [++ref(l), ++ref(c)]
- | token(IDANY) [++ref(c)]
+ start = *( tok.word [ ++ref(w), ref(c) += size(_1) ]
+ | lit('\n') [ ++ref(l), ++ref(c) ]
+ | token(IDANY) [ ++ref(c) ]
                   )
               ;
     }
@@ -74,7 +74,7 @@
 {
     // Define the token type to be used: 'std::string' is available as the type
     // of the token value.
- typedef lexertl_token<
+ typedef lexertl::token<
         char const*, boost::mpl::vector<std::string>
> token_type;
 
@@ -82,26 +82,31 @@
     // definition.
     //
     // This is the only place where the code is different from an equivalent
- // dynamic lexical analyzer. We use the `lexertl_static_lexer<>` instead of
- // the `lexertl_lexer<>` as the base class for our token defintion type.
+ // dynamic lexical analyzer. We use the `lexertl::static_lexer<>` instead of
+ // the `lexertl::lexer<>` as the base class for our token defintion type.
     //
- typedef lexertl_static_lexer<token_type> lexer_type;
-
+ // As we specified the suffix "wc" while generating the static tables we
+ // need to pass the type lexertl::static_::lexer_wc as the second template
+ // parameter below (see word_count_generate.cpp).
+ typedef lexertl::static_lexer<
+ token_type, lexertl::static_::lexer_wc
+ > lexer_type;
+
     // Define the iterator type exposed by the lexer.
- typedef lexer_iterator<word_count_tokens<lexer_type> >::type iterator_type;
+ typedef word_count_tokens<lexer_type>::iterator_type iterator_type;
 
     // Now we use the types defined above to create the lexer and grammar
     // object instances needed to invoke the parsing process.
- word_count_tokens<lexer_type> word_count; // Our token definition
- word_count_grammar<iterator_type> g (word_count); // Our grammar definition
+ word_count_tokens<lexer_type> word_count; // Our lexer
+ word_count_grammar<iterator_type> g (word_count); // Our parser
 
     // Read in the file into memory.
     std::string str (read_from_file(1 == argc ? "word_count.input" : argv[1]));
     char const* first = str.c_str();
     char const* last = &first[str.size()];
-
+
     // Parsing is done based on the the token stream, not the character stream.
- bool r = tokenize_and_parse(first, last, make_lexer(word_count), g);
+ bool r = tokenize_and_parse(first, last, word_count, g);
 
     if (r) { // success
         std::cout << "lines: " << g.l << ", words: " << g.w

Modified: branches/release/libs/spirit/example/lex/static_lexer/word_count_static.hpp
==============================================================================
--- branches/release/libs/spirit/example/lex/static_lexer/word_count_static.hpp (original)
+++ branches/release/libs/spirit/example/lex/static_lexer/word_count_static.hpp 2009-09-14 12:45:39 EDT (Mon, 14 Sep 2009)
@@ -1,37 +1,49 @@
-// Copyright (c) 2008 Ben Hanson
+// Copyright (c) 2008-2009 Ben Hanson
+// Copyright (c) 2008-2009 Hartmut Kaiser
 //
 // 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)
 
-// Auto-generated by boost::lexer
-#if !defined(BOOST_SPIRIT_LEXER_NEXT_TOKEN_Apr_20_2008_17_34_03)
-#define BOOST_SPIRIT_LEXER_NEXT_TOKEN_Apr_20_2008_17_34_03
+// Auto-generated by boost::lexer, do not edit
+
+#if !defined(BOOST_SPIRIT_LEXER_NEXT_TOKEN_WC_SEP_10_2009_20_29_29)
+#define BOOST_SPIRIT_LEXER_NEXT_TOKEN_WC_SEP_10_2009_20_29_29
 
 #include <boost/detail/iterator.hpp>
 #include <boost/spirit/home/support/detail/lexer/char_traits.hpp>
 
+////////////////////////////////////////////////////////////////////////////////
 // the generated table of state names and the tokenizer have to be
-// defined in the boost::spirit::lex::static namespace
-namespace boost { namespace spirit { namespace lex { namespace static_ {
+// defined in the boost::spirit::lex::lexertl::static_ namespace
+namespace boost { namespace spirit { namespace lex { namespace lexertl { namespace static_ {
 
+////////////////////////////////////////////////////////////////////////////////
 // this table defines the names of the lexer states
-char const* const lexer_state_names[1] =
+char const* const lexer_state_names_wc[1] =
 {
- "INITIAL",
+ "INITIAL"
 };
 
+////////////////////////////////////////////////////////////////////////////////
+// this variable defines the number of lexer states
+std::size_t const lexer_state_count_wc = 1;
+
+////////////////////////////////////////////////////////////////////////////////
+// this function returns the next matched token
 template<typename Iterator>
-std::size_t next_token (std::size_t &start_state_, Iterator const& start_,
- Iterator &start_token_, Iterator const& end_)
+std::size_t next_token_wc (std::size_t &start_state_, Iterator const& start_,
+ Iterator &start_token_, Iterator const& end_, std::size_t& unique_id_)
 {
- enum {end_state_index, id_index, state_index, bol_index, eol_index,
- dead_state_index, dfa_offset};
+ enum {end_state_index, id_index, unique_id_index, state_index, bol_index,
+ eol_index, dead_state_index, dfa_offset};
+
     static const std::size_t npos = static_cast<std::size_t>(~0);
- static const std::size_t lookup_[256] = {8, 8, 8, 8, 8, 8, 8, 8,
- 8, 7, 6, 8, 8, 8, 8, 8,
+ static const std::size_t lookup_[256] = {
+ 8, 8, 8, 8, 8, 8, 8, 8,
+ 8, 9, 7, 8, 8, 8, 8, 8,
         8, 8, 8, 8, 8, 8, 8, 8,
         8, 8, 8, 8, 8, 8, 8, 8,
- 7, 8, 8, 8, 8, 8, 8, 8,
+ 9, 8, 8, 8, 8, 8, 8, 8,
         8, 8, 8, 8, 8, 8, 8, 8,
         8, 8, 8, 8, 8, 8, 8, 8,
         8, 8, 8, 8, 8, 8, 8, 8,
@@ -58,14 +70,16 @@
         8, 8, 8, 8, 8, 8, 8, 8,
         8, 8, 8, 8, 8, 8, 8, 8,
         8, 8, 8, 8, 8, 8, 8, 8,
- 8, 8, 8, 8, 8, 8, 8, 8};
- static const std::size_t dfa_alphabet_ = 9;
- static const std::size_t dfa_[45] = {0, 0, 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0, 0, 3,
- 4, 2, 1, 65536, 0, 0, 0, 0,
- 0, 0, 2, 1, 10, 0, 0, 0,
- 0, 0, 0, 0, 1, 65537, 0, 0,
- 0, 0, 0, 0, 0};
+ 8, 8, 8, 8, 8, 8, 8, 8 };
+ static const std::size_t dfa_alphabet_ = 10;
+ static const std::size_t dfa_[50] = {
+ 0, 0, 0, 0, 0, 0, 0, 0,
+ 0, 0, 0, 0, 0, 0, 0, 0,
+ 0, 3, 2, 4, 1, 65536, 0, 0,
+ 0, 0, 0, 0, 2, 0, 1, 10,
+ 1, 0, 0, 0, 0, 0, 0, 0,
+ 1, 65537, 2, 0, 0, 0, 0, 0,
+ 0, 0 };
 
     if (start_token_ == end_) return 0;
 
@@ -73,13 +87,13 @@
     Iterator curr_ = start_token_;
     bool end_state_ = *ptr_ != 0;
     std::size_t id_ = *(ptr_ + id_index);
+ std::size_t uid_ = *(ptr_ + unique_id_index);
     Iterator end_token_ = start_token_;
 
     while (curr_ != end_)
     {
         std::size_t const state_ =
- ptr_[lookup_[static_cast<unsigned char>
- (*curr_++)]];
+ ptr_[lookup_[static_cast<unsigned char>(*curr_++)]];
 
         if (state_ == 0) break;
 
@@ -89,6 +103,7 @@
         {
             end_state_ = true;
             id_ = *(ptr_ + id_index);
+ uid_ = *(ptr_ + unique_id_index);
             end_token_ = curr_;
         }
     }
@@ -101,11 +116,41 @@
     else
     {
         id_ = npos;
+ uid_ = npos;
     }
 
+ unique_id_ = uid_;
     return id_;
 }
 
-}}}} // namespace boost::spirit::lex::static_
+////////////////////////////////////////////////////////////////////////////////
+// this defines a generic accessors for the information above
+struct lexer_wc
+{
+ // version number of compatible static lexer engine
+ enum { static_version = 65536 };
+
+ // return the number of lexer states
+ static std::size_t const state_count()
+ {
+ return lexer_state_count_wc;
+ }
+
+ // return the name of the lexer state as given by 'idx'
+ static char const* const state_name(std::size_t idx)
+ {
+ return lexer_state_names_wc[idx];
+ }
+
+ // return the next matched token
+ template<typename Iterator>
+ static std::size_t next(std::size_t &start_state_, Iterator const& start_
+ , Iterator &start_token_, Iterator const& end_, std::size_t& unique_id_)
+ {
+ return next_token_wc(start_state_, start_, start_token_, end_, unique_id_);
+ }
+};
+
+}}}}} // namespace boost::spirit::lex::lexertl::static_
 
 #endif

Modified: branches/release/libs/spirit/example/lex/static_lexer/word_count_tokens.hpp
==============================================================================
--- branches/release/libs/spirit/example/lex/static_lexer/word_count_tokens.hpp (original)
+++ branches/release/libs/spirit/example/lex/static_lexer/word_count_tokens.hpp 2009-09-14 12:45:39 EDT (Mon, 14 Sep 2009)
@@ -23,16 +23,17 @@
 // possible use cases: a dynamic lexical analyzer, a code generator, and a
 // static lexical analyzer.
 template <typename BaseLexer>
-struct word_count_tokens : boost::spirit::lex::lexer_def<BaseLexer>
+struct word_count_tokens : boost::spirit::lex::lexer<BaseLexer>
 {
- template <typename Self>
- void def (Self& self)
+ word_count_tokens()
+ : word_count_tokens::base_type(
+ boost::spirit::lex::match_flags::match_not_dot_newline)
     {
         // define tokens and associate them with the lexer
         word = "[^ \t\n]+";
- self = word | '\n' | token_def<>(".", IDANY);
+ this->self = word | '\n' | boost::spirit::lex::token_def<>(".", IDANY);
     }
-
+
     boost::spirit::lex::token_def<std::string> word;
 };
 //]

Modified: branches/release/libs/spirit/example/lex/strip_comments.cpp
==============================================================================
--- branches/release/libs/spirit/example/lex/strip_comments.cpp (original)
+++ branches/release/libs/spirit/example/lex/strip_comments.cpp 2009-09-14 12:45:39 EDT (Mon, 14 Sep 2009)
@@ -35,7 +35,7 @@
 
 #include <boost/config/warning_disable.hpp>
 #include <boost/spirit/include/qi.hpp>
-#include <boost/spirit/include/lex_lexer_lexertl.hpp>
+#include <boost/spirit/include/lex_lexertl.hpp>
 #include <boost/spirit/include/phoenix_operator.hpp>
 #include <boost/spirit/include/phoenix_container.hpp>
 
@@ -47,7 +47,6 @@
 using namespace boost::spirit;
 using namespace boost::spirit::qi;
 using namespace boost::spirit::lex;
-using namespace boost::spirit::arg_names;
 
 ///////////////////////////////////////////////////////////////////////////////
 // Token definition: We use the lexertl based lexer engine as the underlying
@@ -59,35 +58,35 @@
 };
 
 template <typename Lexer>
-struct strip_comments_tokens : lexer_def<Lexer>
+struct strip_comments_tokens : lexer<Lexer>
 {
- template <typename Self>
- void def (Self& self)
+ strip_comments_tokens()
+ : strip_comments_tokens::base_type(match_flags::match_default)
     {
         // define tokens and associate them with the lexer
- cppcomment = "//[^\n]*";
- ccomment = "/\\*";
- endcomment = "\\*/";
-
+ cppcomment = "\\/\\/[^\n]*"; // '//[^\n]*'
+ ccomment = "\\/\\*"; // '/*'
+ endcomment = "\\*\\/"; // '*/'
+
         // The following tokens are associated with the default lexer state
         // (the "INITIAL" state). Specifying 'INITIAL' as a lexer state is
         // strictly optional.
- self.add
+ this->self.add
             (cppcomment) // no explicit token id is associated
             (ccomment)
             (".", IDANY) // IDANY is the token id associated with this token
                             // definition
         ;
-
+
         // The following tokens are associated with the lexer state "COMMENT".
         // We switch lexer states from inside the parsing process using the
         // in_state("COMMENT")[] parser component as shown below.
- self("COMMENT").add
+ this->self("COMMENT").add
             (endcomment)
             (".", IDANY)
         ;
     }
-
+
     token_def<> cppcomment, ccomment, endcomment;
 };
 
@@ -99,7 +98,7 @@
 {
     template <typename TokenDef>
     strip_comments_grammar(TokenDef const& tok)
- : grammar<Iterator>(start)
+ : strip_comments_grammar::base_type(start)
     {
         // The in_state("COMMENT")[...] parser component switches the lexer
         // state to be 'COMMENT' during the matching of the embedded parser.
@@ -124,26 +123,24 @@
 {
     // iterator type used to expose the underlying input stream
     typedef std::string::iterator base_iterator_type;
-
+
     // lexer type
- typedef lexertl_lexer<lexertl_token<base_iterator_type> > lexer_type;
-
+ typedef lexertl::lexer<lexertl::token<base_iterator_type> > lexer_type;
+
     // iterator type exposed by the lexer
- typedef
- lexer_iterator<strip_comments_tokens<lexer_type> >::type
- iterator_type;
+ typedef strip_comments_tokens<lexer_type>::iterator_type iterator_type;
 
     // now we use the types defined above to create the lexer and grammar
     // object instances needed to invoke the parsing process
- strip_comments_tokens<lexer_type> strip_comments; // Our token definition
- strip_comments_grammar<iterator_type> g (strip_comments); // Our grammar definition
+ strip_comments_tokens<lexer_type> strip_comments; // Our lexer
+ strip_comments_grammar<iterator_type> g (strip_comments); // Our parser
 
     // Parsing is done based on the the token stream, not the character
     // stream read from the input.
     std::string str (read_from_file(1 == argc ? "strip_comments.input" : argv[1]));
     base_iterator_type first = str.begin();
 
- bool r = tokenize_and_parse(first, str.end(), make_lexer(strip_comments), g);
+ bool r = tokenize_and_parse(first, str.end(), strip_comments, g);
 
     if (r) {
         std::cout << "-------------------------\n";

Modified: branches/release/libs/spirit/example/lex/strip_comments.input
==============================================================================
--- branches/release/libs/spirit/example/lex/strip_comments.input (original)
+++ branches/release/libs/spirit/example/lex/strip_comments.input 2009-09-14 12:45:39 EDT (Mon, 14 Sep 2009)
@@ -1,4 +1,4 @@
-// Copyright (c) 2001-2007 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)
@@ -27,13 +27,17 @@
 // }
 //
 // Its purpose is to strip comments out of C code.
+//
+// Additionally this example demonstrates the use of lexer states to structure
+// the lexer definition.
 
 // #define BOOST_SPIRIT_LEXERTL_DEBUG
 
-#include <boost/spirit/qi.hpp>
-#include <boost/spirit/lex/lexer_lexertl.hpp>
-#include <boost/spirit/phoenix/operator.hpp>
-#include <boost/spirit/phoenix/container.hpp>
+#include <boost/config/warning_disable.hpp>
+#include <boost/spirit/include/qi.hpp>
+#include <boost/spirit/include/lex_lexer_lexertl.hpp>
+#include <boost/spirit/include/phoenix_operator.hpp>
+#include <boost/spirit/include/phoenix_container.hpp>
 
 #include <iostream>
 #include <string>
@@ -43,39 +47,45 @@
 using namespace boost::spirit;
 using namespace boost::spirit::qi;
 using namespace boost::spirit::lex;
-using namespace boost::spirit::arg_names;
 
 ///////////////////////////////////////////////////////////////////////////////
 // Token definition: We use the lexertl based lexer engine as the underlying
 // lexer type.
 ///////////////////////////////////////////////////////////////////////////////
-enum {
+enum tokenids
+{
     IDANY = lex::min_token_id + 10
 };
 
-template <typename BaseIterator>
-struct strip_comments_tokens : lexer_def<lexertl_lexer<BaseIterator> >
+template <typename Lexer>
+struct strip_comments_tokens : lexer<Lexer>
 {
- template <typename Self>
- void def (Self& self)
+ strip_comments_tokens()
     {
         // define tokens and associate them with the lexer
- cppcomment = "//.*\n";
+ cppcomment = "//[^\n]*";
         ccomment = "/\\*";
         endcomment = "\\*/";
-
- self.add
- (cppcomment)
+
+ // The following tokens are associated with the default lexer state
+ // (the "INITIAL" state). Specifying 'INITIAL' as a lexer state is
+ // strictly optional.
+ this->self.add
+ (cppcomment) // no explicit token id is associated
             (ccomment)
- (".", IDANY)
+ (".", IDANY) // IDANY is the token id associated with this token
+ // definition
         ;
-
- self("COMMENT").add
+
+ // The following tokens are associated with the lexer state "COMMENT".
+ // We switch lexer states from inside the parsing process using the
+ // in_state("COMMENT")[] parser component as shown below.
+ this->self("COMMENT").add
             (endcomment)
             (".", IDANY)
         ;
     }
-
+
     token_def<> cppcomment, ccomment, endcomment;
 };
 
@@ -83,16 +93,23 @@
 // Grammar definition
 ///////////////////////////////////////////////////////////////////////////////
 template <typename Iterator>
-struct strip_comments_grammar : grammar_def<Iterator>
+struct strip_comments_grammar : grammar<Iterator>
 {
     template <typename TokenDef>
     strip_comments_grammar(TokenDef const& tok)
+ : strip_comments_grammar::base_type(start)
     {
+ // The in_state("COMMENT")[...] parser component switches the lexer
+ // state to be 'COMMENT' during the matching of the embedded parser.
         start = *( tok.ccomment
>> in_state("COMMENT")
- [ *token(IDANY) >> tok.endcomment ]
+ [
+ // the lexer is in the 'COMMENT' state during
+ // matching of the following parser components
+ *token(IDANY) >> tok.endcomment
+ ]
                   | tok.cppcomment
- | token(IDANY)
+ | token(IDANY) [ std::cout << _1 ]
                   )
               ;
     }
@@ -104,24 +121,25 @@
 int main(int argc, char* argv[])
 {
     // iterator type used to expose the underlying input stream
- typedef std::string::const_iterator base_iterator_type;
-
+ typedef std::string::iterator base_iterator_type;
+
+ // lexer type
+ typedef lexertl::lexer<lexertl::token<base_iterator_type> > lexer_type;
+
     // iterator type exposed by the lexer
- typedef
- lexer_iterator<strip_comments_tokens<base_iterator_type> >::type
- iterator_type;
+ typedef strip_comments_tokens<lexer_type>::iterator_type iterator_type;
 
     // now we use the types defined above to create the lexer and grammar
     // object instances needed to invoke the parsing process
- strip_comments_tokens<base_iterator_type> strip_comments; // Our token definition
- strip_comments_grammar<iterator_type> def (strip_comments); // Our grammar definition
+ strip_comments_tokens<lexer_type> strip_comments; // Our lexer
+ strip_comments_grammar<iterator_type> g (strip_comments); // Our grammar
 
     // Parsing is done based on the the token stream, not the character
     // stream read from the input.
     std::string str (read_from_file(1 == argc ? "strip_comments.input" : argv[1]));
     base_iterator_type first = str.begin();
- base_iterator_type end = str.end();
- bool r = lex_and_parse(first, end, strip_comments, make_grammar(def));
+
+ bool r = tokenize_and_parse(first, str.end(), strip_comments, g);
 
     if (r) {
         std::cout << "-------------------------\n";
@@ -129,7 +147,7 @@
         std::cout << "-------------------------\n";
     }
     else {
- std::string rest(first, end);
+ std::string rest(first, str.end());
         std::cout << "-------------------------\n";
         std::cout << "Parsing failed\n";
         std::cout << "stopped at: \"" << rest << "\"\n";

Modified: branches/release/libs/spirit/example/lex/strip_comments_lexer.cpp
==============================================================================
--- branches/release/libs/spirit/example/lex/strip_comments_lexer.cpp (original)
+++ branches/release/libs/spirit/example/lex/strip_comments_lexer.cpp 2009-09-14 12:45:39 EDT (Mon, 14 Sep 2009)
@@ -34,7 +34,7 @@
 // #define BOOST_SPIRIT_LEXERTL_DEBUG
 
 #include <boost/config/warning_disable.hpp>
-#include <boost/spirit/include/lex_lexer_lexertl.hpp>
+#include <boost/spirit/include/lex_lexertl.hpp>
 #include <boost/spirit/include/phoenix_operator.hpp>
 #include <boost/spirit/include/phoenix_statement.hpp>
 #include <boost/spirit/include/phoenix_core.hpp>
@@ -57,36 +57,86 @@
     IDEOL = lex::min_token_id + 11
 };
 
+///////////////////////////////////////////////////////////////////////////////
+// Simple custom semantic action function object used to print the matched
+// input sequence for a particular token
+template <typename Char, typename Traits>
+struct echo_input_functor
+{
+ echo_input_functor (std::basic_ostream<Char, Traits>& os_)
+ : os(os_) {}
+
+ // This is called by the semantic action handling code during the lexing
+ template <typename Iterator, typename Context>
+ void operator()(Iterator const& b, Iterator const& e
+ , BOOST_SCOPED_ENUM(boost::spirit::lex::pass_flags)&
+ , std::size_t&, Context&) const
+ {
+ os << std::string(b, e);
+ }
+
+ 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);
+}
+
+///////////////////////////////////////////////////////////////////////////////
+// Another simple custom semantic action function object used to switch the
+// state of the lexer
+struct set_lexer_state
+{
+ set_lexer_state(char const* state_)
+ : state(state_) {}
+
+ // This is called by the semantic action handling code during the lexing
+ template <typename Iterator, typename Context>
+ void operator()(Iterator const&, Iterator const&
+ , BOOST_SCOPED_ENUM(boost::spirit::lex::pass_flags)&
+ , std::size_t&, Context& ctx) const
+ {
+ ctx.set_state_name(state.c_str());
+ }
+
+ std::string state;
+};
+
+///////////////////////////////////////////////////////////////////////////////
 template <typename Lexer>
-struct strip_comments_tokens : lexer_def<Lexer>
+struct strip_comments_tokens : lexer<Lexer>
 {
- template <typename Self>
- void def (Self& self)
+ strip_comments_tokens()
+ : strip_comments_tokens::base_type(match_flags::match_default)
     {
         // define tokens and associate them with the lexer
- cppcomment = "//[^\n]*";
- ccomment = "/\\*";
- endcomment = "\\*/";
+ cppcomment = "\\/\\/[^\n]*"; // '//[^\n]*'
+ ccomment = "\\/\\*"; // '/*'
+ endcomment = "\\*\\/"; // '*/'
         any = ".";
         eol = "\n";
-
+
         // The following tokens are associated with the default lexer state
         // (the "INITIAL" state). Specifying 'INITIAL' as a lexer state is
         // strictly optional.
- self = cppcomment
- | ccomment [ set_state("COMMENT") ]
+ this->self
+ = cppcomment
+ | ccomment [ set_lexer_state("COMMENT") ]
             | eol [ echo_input(std::cout) ]
             | any [ echo_input(std::cout) ]
             ;
-
+
         // The following tokens are associated with the lexer state 'COMMENT'.
- self("COMMENT")
- = endcomment [ set_state("INITIAL") ]
- | eol
- | any
+ this->self("COMMENT")
+ = endcomment [ set_lexer_state("INITIAL") ]
+ | "\n"
+ | "."
             ;
     }
-
+
     token_def<> cppcomment, ccomment, endcomment, any, eol;
 };
 
@@ -95,19 +145,19 @@
 {
     // iterator type used to expose the underlying input stream
     typedef std::string::iterator base_iterator_type;
-
+
     // lexer type
- typedef lexertl_actor_lexer<lexertl_token<base_iterator_type> > lexer_type;
-
+ typedef lexertl::actor_lexer<lexertl::token<base_iterator_type> > lexer_type;
+
     // now we use the types defined above to create the lexer and grammar
     // object instances needed to invoke the parsing process
- strip_comments_tokens<lexer_type> strip_comments; // Our token definition
+ strip_comments_tokens<lexer_type> strip_comments; // Our lexer
 
- // Parsing is done based on the the token stream, not the character
- // stream read from the input.
+ // No parsing is done alltogether, everzthing happens in the lexer semantic
+ // actions.
     std::string str (read_from_file(1 == argc ? "strip_comments.input" : argv[1]));
     base_iterator_type first = str.begin();
- bool r = tokenize(first, str.end(), make_lexer(strip_comments));
+ bool r = tokenize(first, str.end(), strip_comments);
 
     if (!r) {
         std::string rest(first, str.end());

Modified: branches/release/libs/spirit/example/lex/word_count.cpp
==============================================================================
--- branches/release/libs/spirit/example/lex/word_count.cpp (original)
+++ branches/release/libs/spirit/example/lex/word_count.cpp 2009-09-14 12:45:39 EDT (Mon, 14 Sep 2009)
@@ -37,7 +37,7 @@
 #include <boost/config/warning_disable.hpp>
 //[wcp_includes
 #include <boost/spirit/include/qi.hpp>
-#include <boost/spirit/include/lex_lexer_lexertl.hpp>
+#include <boost/spirit/include/lex_lexertl.hpp>
 #include <boost/spirit/include/phoenix_operator.hpp>
 #include <boost/spirit/include/phoenix_statement.hpp>
 #include <boost/spirit/include/phoenix_container.hpp>
@@ -50,6 +50,7 @@
 
 //[wcp_namespaces
 using namespace boost::spirit;
+using namespace boost::spirit::ascii;
 using namespace boost::spirit::qi;
 using namespace boost::spirit::lex;
 //]
@@ -67,29 +68,29 @@
 
 //[wcp_token_definition
 template <typename Lexer>
-struct word_count_tokens : lexer_def<Lexer>
+struct word_count_tokens : lexer<Lexer>
 {
- template <typename Self>
- void def (Self& self)
+ word_count_tokens()
     {
         // define patterns (lexer macros) to be used during token definition
         // below
- self.add_pattern
+ this->self.add_pattern
             ("WORD", "[^ \t\n]+")
         ;
-
+
         // define tokens and associate them with the lexer
         word = "{WORD}"; // reference the pattern 'WORD' as defined above
 
         // this lexer will recognize 3 token types: words, newlines, and
         // everything else
- self.add
+ this->self.add
             (word) // no token id is needed here
             ('\n') // characters are usable as tokens as well
- (".", IDANY)
+ (".", IDANY) // string literals will not be esacped by the library
         ;
     }
-
+
+ // the token 'word' exposes the matched string as its parser attribute
     token_def<std::string> word;
 };
 //]
@@ -103,19 +104,14 @@
 {
     template <typename TokenDef>
     word_count_grammar(TokenDef const& tok)
- : grammar<Iterator>(start), c(0), w(0), l(0)
+ : word_count_grammar::base_type(start)
+ , c(0), w(0), l(0)
     {
         using boost::phoenix::ref;
         using boost::phoenix::size;
-
- // As documented in the Spirit.Qi documentation, any placeholders
- // (_1 et.al.) used in semantic actions inside a grammar need to be
- // imported from the namespace boost::spirit::arg_names, and not from
- // the corresponding namespace in Phoenix.
- using boost::spirit::arg_names::_1;
 
         start = *( tok.word [++ref(w), ref(c) += size(_1)]
- | char_('\n') [++ref(c), ++ref(l)]
+ | lit('\n') [++ref(c), ++ref(l)]
                   | token(IDANY) [++ref(c)]
                   )
               ;
@@ -130,33 +126,33 @@
 //[wcp_main
 int main(int argc, char* argv[])
 {
-/*< define the token type to be used: `std::string` is available as the
- type of the token value
->*/ typedef lexertl_token<
+/*< Define the token type to be used: `std::string` is available as the
+ type of the token attribute
+>*/ typedef lexertl::token<
         char const*, boost::mpl::vector<std::string>
> token_type;
 
-/*< define the lexer type to use implementing the state machine
->*/ typedef lexertl_lexer<token_type> lexer_type;
+/*< Define the lexer type to use implementing the state machine
+>*/ typedef lexertl::lexer<token_type> lexer_type;
 
-/*< define the iterator type exposed by the lexer type
->*/ typedef lexer_iterator<word_count_tokens<lexer_type> >::type iterator_type;
+/*< Define the iterator type exposed by the lexer type
+>*/ typedef word_count_tokens<lexer_type>::iterator_type iterator_type;
 
     // now we use the types defined above to create the lexer and grammar
     // object instances needed to invoke the parsing process
- word_count_tokens<lexer_type> word_count; // Our token definition
- word_count_grammar<iterator_type> g (word_count); // Our grammar definition
+ word_count_tokens<lexer_type> word_count; // Our lexer
+ word_count_grammar<iterator_type> g (word_count); // Our parser
 
     // read in the file int memory
     std::string str (read_from_file(1 == argc ? "word_count.input" : argv[1]));
     char const* first = str.c_str();
     char const* last = &first[str.size()];
-
- // Parsing is done based on the the token stream, not the character
- // stream read from the input. The function `tokenize_and_parse()` wraps
- // the passed iterator range `[first, last)` by the lexical analyzer and
- // uses its exposed iterators to parse the toke stream.
- bool r = tokenize_and_parse(first, last, make_lexer(word_count), g);
+
+/*< Parsing is done based on the the token stream, not the character
+ stream read from the input. The function `tokenize_and_parse()` wraps
+ the passed iterator range `[first, last)` by the lexical analyzer and
+ uses its exposed iterators to parse the toke stream.
+>*/ bool r = tokenize_and_parse(first, last, word_count, g);
 
     if (r) {
         std::cout << "lines: " << g.l << ", words: " << g.w

Modified: branches/release/libs/spirit/example/lex/word_count_functor.cpp
==============================================================================
--- branches/release/libs/spirit/example/lex/word_count_functor.cpp (original)
+++ branches/release/libs/spirit/example/lex/word_count_functor.cpp 2009-09-14 12:45:39 EDT (Mon, 14 Sep 2009)
@@ -51,7 +51,7 @@
 
 #include <boost/config/warning_disable.hpp>
 //[wcf_includes
-#include <boost/spirit/include/lex_lexer_lexertl.hpp>
+#include <boost/spirit/include/lex_lexertl.hpp>
 #include <boost/bind.hpp>
 #include <boost/ref.hpp>
 //]
@@ -62,7 +62,6 @@
 #include "example.hpp"
 
 //[wcf_namespaces
-using namespace boost::spirit;
 using namespace boost::spirit::lex;
 //]
 
@@ -91,14 +90,13 @@
     example we use the Lexertl based lexer engine as the underlying lexer type.
 */
 template <typename Lexer>
-struct word_count_tokens : lexer_def<Lexer>
+struct word_count_tokens : lexer<Lexer>
 {
- template <typename Self>
- void def (Self& self)
+ word_count_tokens()
     {
         // define tokens (the regular expression to match and the corresponding
         // token id) and add them to the lexer
- self.add
+ this->self.add
             ("[^ \t\n]+", ID_WORD) // words (anything except ' ', '\t' or '\n')
             ("\n", ID_EOL) // newline characters
             (".", ID_CHAR) // anything else is a plain character
@@ -114,9 +112,9 @@
 */
 struct counter
 {
-//<- this is an implementation detail and doesn't show up in the documentation
+//<- this is an implementation detail specific to boost::bind and doesn't show
+// up in the documentation
     typedef bool result_type;
-
 //->
     // the function operator gets called for each of the matched tokens
     // c, l, w are references to the counters used to keep track of the numbers
@@ -126,8 +124,8 @@
         switch (t.id()) {
         case ID_WORD: // matched a word
         // since we're using a default token type in this example, every
- // token instance contains a `iterator_range<BaseIterator>` as its
- // token value pointing to the matched character sequence in the input
+ // token instance contains a `iterator_range<BaseIterator>` as its token
+ // attribute pointing to the matched character sequence in the input
             ++w; c += t.value().size();
             break;
         case ID_EOL: // matched a newline character
@@ -147,8 +145,8 @@
 /*` The main function simply loads the given file into memory (as a
     `std::string`), instantiates an instance of the token definition template
     using the correct iterator type (`word_count_tokens<char const*>`),
- and finally calls `lex::tokenize`, passing an instance of the counter functor
- defined above. The return value of `lex::tokenize` will be `true` if the
+ and finally calls `lex::tokenize`, passing an instance of the counter function
+ object. The return value of `lex::tokenize()` will be `true` if the
     whole input sequence has been successfully tokenized, and `false` otherwise.
 */
 int main(int argc, char* argv[])
@@ -160,13 +158,13 @@
     std::string str (read_from_file(1 == argc ? "word_count.input" : argv[1]));
 
     // create the token definition instance needed to invoke the lexical analyzer
- word_count_tokens<lexertl_lexer<> > word_count_functor;
+ word_count_tokens<lexertl::lexer<> > word_count_functor;
 
     // tokenize the given string, the bound functor gets invoked for each of
     // the matched tokens
     char const* first = str.c_str();
     char const* last = &first[str.size()];
- bool r = lex::tokenize(first, last, make_lexer(word_count_functor),
+ bool r = tokenize(first, last, word_count_functor,
         boost::bind(counter(), _1, boost::ref(c), boost::ref(w), boost::ref(l)));
 
     // print results

Modified: branches/release/libs/spirit/example/lex/word_count_lexer.cpp
==============================================================================
--- branches/release/libs/spirit/example/lex/word_count_lexer.cpp (original)
+++ branches/release/libs/spirit/example/lex/word_count_lexer.cpp 2009-09-14 12:45:39 EDT (Mon, 14 Sep 2009)
@@ -34,8 +34,7 @@
 
 #include <boost/config/warning_disable.hpp>
 //[wcl_includes
-#include <boost/spirit/include/support_argument.hpp>
-#include <boost/spirit/include/lex_lexer_lexertl.hpp>
+#include <boost/spirit/include/lex_lexertl.hpp>
 #include <boost/spirit/include/phoenix_operator.hpp>
 #include <boost/spirit/include/phoenix_statement.hpp>
 #include <boost/spirit/include/phoenix_algorithm.hpp>
@@ -59,29 +58,42 @@
 // Note, the token definition type is derived from the 'lexertl_actor_lexer'
 // template, which is a necessary to being able to use lexer semantic actions.
 ///////////////////////////////////////////////////////////////////////////////
+struct distance_func
+{
+ template <typename Iterator1, typename Iterator2>
+ struct result : boost::iterator_difference<Iterator1> {};
+
+ template <typename Iterator1, typename Iterator2>
+ typename result<Iterator1, Iterator2>::type
+ operator()(Iterator1& begin, Iterator2& end) const
+ {
+ return std::distance(begin, end);
+ }
+};
+boost::phoenix::function<distance_func> const distance = distance_func();
+
 //[wcl_token_definition
 template <typename Lexer>
-struct word_count_tokens : lexer_def<Lexer>
+struct word_count_tokens : lexer<Lexer>
 {
     word_count_tokens()
- : c(0), w(0), l(0),
- word("[^ \t\n]+"), eol("\n"), any(".") // define tokens
- {}
-
- template <typename Self>
- void def (Self& self)
+ : c(0), w(0), l(0)
+ , word("[^ \t\n]+") // define tokens
+ , eol("\n")
+ , any(".")
     {
+ using boost::spirit::lex::_start;
+ using boost::spirit::lex::_end;
         using boost::phoenix::ref;
- using boost::phoenix::distance;
- using boost::spirit::arg_names::_1;
 
         // associate tokens with the lexer
- self = word [++ref(w), ref(c) += distance(_1)]
+ this->self
+ = word [++ref(w), ref(c) += distance(_start, _end)]
             | eol [++ref(c), ++ref(l)]
             | any [++ref(c)]
             ;
     }
-
+
     std::size_t c, w, l;
     token_def<> word, eol, any;
 };
@@ -91,34 +103,39 @@
 //[wcl_main
 int main(int argc, char* argv[])
 {
- // read input from the given file
- std::string str (read_from_file(1 == argc ? "word_count.input" : argv[1]));
 
- // Specifying 'omitted' as the token value type generates a token class not
- // holding any token value at all (not even the iterator_range of the
- // matched input sequence), therefor optimizing the token, the lexer, and
- // possibly the parser implementation as much as possible.
- //
- // Specifying mpl::false_ as the 3rd template parameter generates a token
- // type and an iterator, both holding no lexer state, allowing for even more
- // aggressive optimizations.
- //
- // As a result the token instances contain the token ids as the only data
- // member.
- typedef lexertl_token<char const*, omitted, boost::mpl::false_> token_type;
-
- // lexer type
- typedef lexertl_actor_lexer<token_type> lexer_type;
-
- // create the lexer object instance needed to invoke the lexical analysis
- word_count_tokens<lexer_type> word_count_lexer;
-
- // tokenize the given string, all generated tokens are discarded
+/*< Specifying `omit` as the token attribute type generates a token class
+ not holding any token attribute at all (not even the iterator range of the
+ matched input sequence), therefore optimizing the token, the lexer, and
+ possibly the parser implementation as much as possible. Specifying
+ `mpl::false_` as the 3rd template parameter generates a token
+ type and an iterator, both holding no lexer state, allowing for even more
+ aggressive optimizations. As a result the token instances contain the token
+ ids as the only data member.
+>*/ typedef lexertl::token<char const*, lex::omit, boost::mpl::false_> token_type;
+
+/*< This defines the lexer type to use
+>*/ typedef lexertl::actor_lexer<token_type> lexer_type;
+
+/*< Create the lexer object instance needed to invoke the lexical analysis
+>*/ word_count_tokens<lexer_type> word_count_lexer;
+
+/*< Read input from the given file, tokenize all the input, while discarding
+ all generated tokens
+>*/ std::string str (read_from_file(1 == argc ? "word_count.input" : argv[1]));
     char const* first = str.c_str();
     char const* last = &first[str.size()];
- bool r = tokenize(first, last, make_lexer(word_count_lexer));
 
- if (r) {
+/*< Create a pair of iterators returning the sequence of generated tokens
+>*/ lexer_type::iterator_type iter = word_count_lexer.begin(first, last);
+ lexer_type::iterator_type end = word_count_lexer.end();
+
+/*< Here we simply iterate over all tokens, making sure to break the loop
+ if an invalid token gets returned from the lexer
+>*/ while (iter != end && token_is_valid(*iter))
+ ++iter;
+
+ if (iter == end) {
         std::cout << "lines: " << word_count_lexer.l
                   << ", words: " << word_count_lexer.w
                   << ", characters: " << word_count_lexer.c

Modified: branches/release/libs/spirit/example/qi/Jamfile
==============================================================================
--- branches/release/libs/spirit/example/qi/Jamfile (original)
+++ branches/release/libs/spirit/example/qi/Jamfile 2009-09-14 12:45:39 EDT (Mon, 14 Sep 2009)
@@ -5,7 +5,7 @@
 # file LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt)
 #==============================================================================
 project spirit-qi-example
- : requirements <toolset>gcc:<cxxflags>-ftemplate-depth-300
+ : requirements <toolset>gcc:<c++-template-depth>300
     :
     :
     ;
@@ -15,8 +15,10 @@
 exe complex_number : complex_number.cpp ;
 exe employee : employee.cpp ;
 exe roman : roman.cpp ;
+exe reference : reference.cpp ;
 exe mini_xml1 : mini_xml1.cpp ;
 exe mini_xml2 : mini_xml2.cpp ;
+exe mini_xml3 : mini_xml3.cpp ;
 exe num_list1 : num_list1.cpp ;
 exe num_list2 : num_list2.cpp ;
 exe num_list3 : num_list3.cpp ;
@@ -26,8 +28,9 @@
 exe calc2 : calc2.cpp ;
 exe calc2_ast : calc2_ast.cpp ;
 exe calc3 : calc3.cpp ;
-exe calc3_lexer : calc3_lexer.cpp ;
+#exe calc3_lexer : calc3_lexer.cpp ;
 exe calc4 : calc4.cpp ;
+exe calc4_debug : calc4_debug.cpp ;
 exe calc5 : calc5.cpp ;
 
 exe calc6 :

Modified: branches/release/libs/spirit/example/qi/actions.cpp
==============================================================================
--- branches/release/libs/spirit/example/qi/actions.cpp (original)
+++ branches/release/libs/spirit/example/qi/actions.cpp 2009-09-14 12:45:39 EDT (Mon, 14 Sep 2009)
@@ -1,10 +1,9 @@
 /*=============================================================================
- Copyright (c) 2001-2008 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)
 =============================================================================*/
-
 #include <boost/config/warning_disable.hpp>
 #include <boost/spirit/include/qi.hpp>
 #include <boost/lambda/lambda.hpp>
@@ -19,41 +18,50 @@
 // * Using boost.bind with a member function
 // * Using boost.lambda
 
-using namespace boost::spirit;
-
 //[tutorial_semantic_action_functions
-// A plain function
-void write(int const& i)
+namespace client
 {
- std::cout << i << std::endl;
-}
+ namespace qi = boost::spirit::qi;
 
-// A member function
-struct writer
-{
- void print(int const& i) const
+ // A plain function
+ void print(int const& i)
     {
         std::cout << i << std::endl;
     }
-};
 
-// A function object
-struct write_action
-{
- void operator()(int const& i, unused_type, unused_type) const
+ // A member function
+ struct writer
     {
- std::cout << i << std::endl;
- }
-};
+ void print(int const& i) const
+ {
+ std::cout << i << std::endl;
+ }
+ };
+
+ // A function object
+ struct print_action
+ {
+ void operator()(int const& i, qi::unused_type, qi::unused_type) const
+ {
+ std::cout << i << std::endl;
+ }
+ };
+}
 //]
 
 int main()
 {
+ using boost::spirit::qi::int_;
+ using boost::spirit::qi::parse;
+ using client::print;
+ using client::writer;
+ using client::print_action;
+
     { // example using plain function
 
         char const *first = "{42}", *last = first + std::strlen(first);
         //[tutorial_attach_actions1
- qi::parse(first, last, '{' >> int_[&write] >> '}');
+ parse(first, last, '{' >> int_[&print] >> '}');
         //]
     }
 
@@ -61,7 +69,7 @@
 
         char const *first = "{43}", *last = first + std::strlen(first);
         //[tutorial_attach_actions2
- qi::parse(first, last, '{' >> int_[write_action()] >> '}');
+ parse(first, last, '{' >> int_[print_action()] >> '}');
         //]
     }
 
@@ -69,7 +77,7 @@
 
         char const *first = "{44}", *last = first + std::strlen(first);
         //[tutorial_attach_actions3
- qi::parse(first, last, '{' >> int_[boost::bind(&write, _1)] >> '}');
+ parse(first, last, '{' >> int_[boost::bind(&print, _1)] >> '}');
         //]
     }
 
@@ -78,7 +86,7 @@
         char const *first = "{44}", *last = first + std::strlen(first);
         //[tutorial_attach_actions4
         writer w;
- qi::parse(first, last, '{' >> int_[boost::bind(&writer::print, &w, _1)] >> '}');
+ parse(first, last, '{' >> int_[boost::bind(&writer::print, &w, _1)] >> '}');
         //]
     }
 
@@ -88,7 +96,7 @@
         char const *first = "{45}", *last = first + std::strlen(first);
         using lambda::_1;
         //[tutorial_attach_actions5
- qi::parse(first, last, '{' >> int_[std::cout << _1 << '\n'] >> '}');
+ parse(first, last, '{' >> int_[std::cout << _1 << '\n'] >> '}');
         //]
     }
 

Modified: branches/release/libs/spirit/example/qi/calc1.cpp
==============================================================================
--- branches/release/libs/spirit/example/qi/calc1.cpp (original)
+++ branches/release/libs/spirit/example/qi/calc1.cpp 2009-09-14 12:45:39 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)
@@ -19,42 +19,46 @@
 #include <iostream>
 #include <string>
 
-using namespace boost::spirit;
-using namespace boost::spirit::qi;
-using namespace boost::spirit::ascii;
-
-///////////////////////////////////////////////////////////////////////////////
-// Our calculator grammar
-///////////////////////////////////////////////////////////////////////////////
-template <typename Iterator>
-struct calculator : grammar<Iterator, space_type>
+namespace client
 {
- calculator() : calculator::base_type(expression)
+ namespace qi = boost::spirit::qi;
+ namespace ascii = boost::spirit::ascii;
+
+ ///////////////////////////////////////////////////////////////////////////////
+ // Our calculator grammar
+ ///////////////////////////////////////////////////////////////////////////////
+ template <typename Iterator>
+ struct calculator : qi::grammar<Iterator, ascii::space_type>
     {
- expression =
- term
- >> *( ('+' >> term)
- | ('-' >> term)
- )
- ;
-
- term =
- factor
- >> *( ('*' >> factor)
- | ('/' >> factor)
- )
- ;
-
- factor =
- uint_
- | '(' >> expression >> ')'
- | ('-' >> factor)
- | ('+' >> factor)
- ;
- }
+ calculator() : calculator::base_type(expression)
+ {
+ using qi::uint_;
+
+ expression =
+ term
+ >> *( ('+' >> term)
+ | ('-' >> term)
+ )
+ ;
+
+ term =
+ factor
+ >> *( ('*' >> factor)
+ | ('/' >> factor)
+ )
+ ;
+
+ factor =
+ uint_
+ | '(' >> expression >> ')'
+ | ('-' >> factor)
+ | ('+' >> factor)
+ ;
+ }
 
- rule<Iterator, space_type> expression, term, factor;
-};
+ qi::rule<Iterator, ascii::space_type> expression, term, factor;
+ };
+}
 
 ///////////////////////////////////////////////////////////////////////////////
 // Main program
@@ -67,8 +71,9 @@
     std::cout << "/////////////////////////////////////////////////////////\n\n";
     std::cout << "Type an expression...or [q or Q] to quit\n\n";
 
+ using boost::spirit::ascii::space;
     typedef std::string::const_iterator iterator_type;
- typedef calculator<iterator_type> calculator;
+ typedef client::calculator<iterator_type> calculator;
 
     calculator calc; // Our grammar
 

Modified: branches/release/libs/spirit/example/qi/calc2.cpp
==============================================================================
--- branches/release/libs/spirit/example/qi/calc2.cpp (original)
+++ branches/release/libs/spirit/example/qi/calc2.cpp 2009-09-14 12:45:39 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)
@@ -21,55 +21,59 @@
 #include <iostream>
 #include <string>
 
-using namespace boost::spirit;
-using namespace boost::spirit::qi;
-using namespace boost::spirit::ascii;
-
-///////////////////////////////////////////////////////////////////////////////
-// Semantic actions
-///////////////////////////////////////////////////////////////////////////////
-namespace
+namespace client
 {
- void do_int(int n) { std::cout << "push " << n << std::endl; }
- void do_add() { std::cout << "add\n"; }
- void do_subt() { std::cout << "subtract\n"; }
- void do_mult() { std::cout << "mult\n"; }
- void do_div() { std::cout << "divide\n"; }
- void do_neg() { std::cout << "negate\n"; }
-}
+ namespace qi = boost::spirit::qi;
+ namespace ascii = boost::spirit::ascii;
 
-///////////////////////////////////////////////////////////////////////////////
-// Our calculator grammar
-///////////////////////////////////////////////////////////////////////////////
-template <typename Iterator>
-struct calculator : grammar<Iterator, space_type>
-{
- calculator() : calculator::base_type(expression)
+ ///////////////////////////////////////////////////////////////////////////////
+ // Semantic actions
+ ///////////////////////////////////////////////////////////////////////////////
+ namespace
     {
- expression =
- term
- >> *( ('+' >> term [&do_add])
- | ('-' >> term [&do_subt])
- )
- ;
-
- term =
- factor
- >> *( ('*' >> factor [&do_mult])
- | ('/' >> factor [&do_div])
- )
- ;
-
- factor =
- uint_ [&do_int]
- | '(' >> expression >> ')'
- | ('-' >> factor [&do_neg])
- | ('+' >> factor)
- ;
+ void do_int(int n) { std::cout << "push " << n << std::endl; }
+ void do_add() { std::cout << "add\n"; }
+ void do_subt() { std::cout << "subtract\n"; }
+ void do_mult() { std::cout << "mult\n"; }
+ void do_div() { std::cout << "divide\n"; }
+ void do_neg() { std::cout << "negate\n"; }
     }
 
- rule<Iterator, space_type> expression, term, factor;
-};
+ ///////////////////////////////////////////////////////////////////////////////
+ // Our calculator grammar
+ ///////////////////////////////////////////////////////////////////////////////
+ template <typename Iterator>
+ struct calculator : qi::grammar<Iterator, ascii::space_type>
+ {
+ calculator() : calculator::base_type(expression)
+ {
+ using qi::uint_;
+
+ expression =
+ term
+ >> *( ('+' >> term [&do_add])
+ | ('-' >> term [&do_subt])
+ )
+ ;
+
+ term =
+ factor
+ >> *( ('*' >> factor [&do_mult])
+ | ('/' >> factor [&do_div])
+ )
+ ;
+
+ factor =
+ uint_ [&do_int]
+ | '(' >> expression >> ')'
+ | ('-' >> factor [&do_neg])
+ | ('+' >> factor)
+ ;
+ }
+
+ qi::rule<Iterator, ascii::space_type> expression, term, factor;
+ };
+}
 
 ///////////////////////////////////////////////////////////////////////////////
 // Main program
@@ -82,8 +86,9 @@
     std::cout << "/////////////////////////////////////////////////////////\n\n";
     std::cout << "Type an expression...or [q or Q] to quit\n\n";
 
+ using boost::spirit::ascii::space;
     typedef std::string::const_iterator iterator_type;
- typedef calculator<iterator_type> calculator;
+ typedef client::calculator<iterator_type> calculator;
 
     calculator calc; // Our grammar
 

Modified: branches/release/libs/spirit/example/qi/calc2_ast.cpp
==============================================================================
--- branches/release/libs/spirit/example/qi/calc2_ast.cpp (original)
+++ branches/release/libs/spirit/example/qi/calc2_ast.cpp 2009-09-14 12:45:39 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)
@@ -8,13 +8,14 @@
 //
 // A Calculator example demonstrating generation of AST
 //
-// [ JDG April 28, 2002 ]
+// [ JDG April 28, 2008 ]
 //
 ///////////////////////////////////////////////////////////////////////////////
 
 #include <boost/config/warning_disable.hpp>
 #include <boost/spirit/include/qi.hpp>
 #include <boost/variant/recursive_variant.hpp>
+#include <boost/variant/apply_visitor.hpp>
 #include <boost/spirit/include/phoenix_operator.hpp>
 #include <boost/spirit/include/phoenix_function.hpp>
 
@@ -22,142 +23,180 @@
 #include <vector>
 #include <string>
 
-using namespace boost::spirit;
-using namespace boost::spirit::qi;
-using namespace boost::spirit::ascii;
-using namespace boost::spirit::arg_names;
-
-///////////////////////////////////////////////////////////////////////////////
-// Our AST
-///////////////////////////////////////////////////////////////////////////////
-struct binary_op;
-struct unary_op;
-struct nil {};
-
-struct expression_ast
+namespace client
 {
- typedef
- boost::variant<
- nil // can't happen!
- , unsigned int
- , boost::recursive_wrapper<expression_ast>
- , boost::recursive_wrapper<binary_op>
- , boost::recursive_wrapper<unary_op>
- >
- type;
-
- expression_ast()
- : expr(nil()) {}
-
- template <typename Expr>
- expression_ast(Expr const& expr)
- : expr(expr) {}
-
- expression_ast& operator+=(expression_ast const& rhs);
- expression_ast& operator-=(expression_ast const& rhs);
- expression_ast& operator*=(expression_ast const& rhs);
- expression_ast& operator/=(expression_ast const& rhs);
+ namespace qi = boost::spirit::qi;
+ namespace ascii = boost::spirit::ascii;
 
- type expr;
-};
+ ///////////////////////////////////////////////////////////////////////////
+ // Our AST
+ ///////////////////////////////////////////////////////////////////////////
+ struct binary_op;
+ struct unary_op;
+ struct nil {};
 
-struct binary_op
-{
- binary_op(
- char op
- , expression_ast const& left
- , expression_ast const& right)
- : op(op), left(left), right(right) {}
-
- char op;
- expression_ast left;
- expression_ast right;
-};
+ struct expression_ast
+ {
+ typedef
+ boost::variant<
+ nil // can't happen!
+ , unsigned int
+ , boost::recursive_wrapper<expression_ast>
+ , boost::recursive_wrapper<binary_op>
+ , boost::recursive_wrapper<unary_op>
+ >
+ type;
+
+ expression_ast()
+ : expr(nil()) {}
+
+ template <typename Expr>
+ expression_ast(Expr const& expr)
+ : expr(expr) {}
+
+ expression_ast& operator+=(expression_ast const& rhs);
+ expression_ast& operator-=(expression_ast const& rhs);
+ expression_ast& operator*=(expression_ast const& rhs);
+ expression_ast& operator/=(expression_ast const& rhs);
 
-struct unary_op
-{
- unary_op(
- char op
- , expression_ast const& subject)
- : op(op), subject(subject) {}
-
- char op;
- expression_ast subject;
-};
+ type expr;
+ };
 
-expression_ast& expression_ast::operator+=(expression_ast const& rhs)
-{
- expr = binary_op('+', expr, rhs);
- return *this;
-}
+ struct binary_op
+ {
+ binary_op(
+ char op
+ , expression_ast const& left
+ , expression_ast const& right)
+ : op(op), left(left), right(right) {}
+
+ char op;
+ expression_ast left;
+ expression_ast right;
+ };
 
-expression_ast& expression_ast::operator-=(expression_ast const& rhs)
-{
- expr = binary_op('-', expr, rhs);
- return *this;
-}
+ struct unary_op
+ {
+ unary_op(
+ char op
+ , expression_ast const& subject)
+ : op(op), subject(subject) {}
+
+ char op;
+ expression_ast subject;
+ };
 
-expression_ast& expression_ast::operator*=(expression_ast const& rhs)
-{
- expr = binary_op('*', expr, rhs);
- return *this;
-}
+ expression_ast& expression_ast::operator+=(expression_ast const& rhs)
+ {
+ expr = binary_op('+', expr, rhs);
+ return *this;
+ }
 
-expression_ast& expression_ast::operator/=(expression_ast const& rhs)
-{
- expr = binary_op('/', expr, rhs);
- return *this;
-}
+ expression_ast& expression_ast::operator-=(expression_ast const& rhs)
+ {
+ expr = binary_op('-', expr, rhs);
+ return *this;
+ }
 
-// We should be using expression_ast::operator-. There's a bug
-// in phoenix type deduction mechanism that prevents us from
-// doing so. Phoenix will be switching to BOOST_TYPEOF. In the
-// meantime, we will use a phoenix::function below:
-struct negate_expr
-{
- template <typename T>
- struct result { typedef T type; };
+ expression_ast& expression_ast::operator*=(expression_ast const& rhs)
+ {
+ expr = binary_op('*', expr, rhs);
+ return *this;
+ }
 
- expression_ast operator()(expression_ast const& expr) const
+ expression_ast& expression_ast::operator/=(expression_ast const& rhs)
     {
- return expression_ast(unary_op('-', expr));
+ expr = binary_op('/', expr, rhs);
+ return *this;
     }
-};
 
-boost::phoenix::function<negate_expr> neg;
+ // We should be using expression_ast::operator-. There's a bug
+ // in phoenix type deduction mechanism that prevents us from
+ // doing so. Phoenix will be switching to BOOST_TYPEOF. In the
+ // meantime, we will use a phoenix::function below:
+ struct negate_expr
+ {
+ template <typename T>
+ struct result { typedef T type; };
+
+ expression_ast operator()(expression_ast const& expr) const
+ {
+ return expression_ast(unary_op('-', expr));
+ }
+ };
 
-///////////////////////////////////////////////////////////////////////////////
-// Our calculator grammar
-///////////////////////////////////////////////////////////////////////////////
-template <typename Iterator>
-struct calculator : grammar<Iterator, expression_ast(), space_type>
-{
- calculator() : calculator::base_type(expression)
+ boost::phoenix::function<negate_expr> neg;
+
+ ///////////////////////////////////////////////////////////////////////////
+ // Walk the tree
+ ///////////////////////////////////////////////////////////////////////////
+ struct ast_print
     {
- expression =
- term [_val = _1]
- >> *( ('+' >> term [_val += _1])
- | ('-' >> term [_val -= _1])
- )
- ;
-
- term =
- factor [_val = _1]
- >> *( ('*' >> factor [_val *= _1])
- | ('/' >> factor [_val /= _1])
- )
- ;
-
- factor =
- uint_ [_val = _1]
- | '(' >> expression [_val = _1] >> ')'
- | ('-' >> factor [_val = neg(_1)])
- | ('+' >> factor [_val = _1])
- ;
- }
+ typedef void result_type;
+
+ void operator()(qi::info::nil) const {}
+ void operator()(int n) const { std::cout << n; }
 
- rule<Iterator, expression_ast(), space_type> expression, term, factor;
-};
+ void operator()(expression_ast const& ast) const
+ {
+ boost::apply_visitor(*this, ast.expr);
+ }
+
+ void operator()(binary_op const& expr) const
+ {
+ std::cout << "op:" << expr.op << "(";
+ boost::apply_visitor(*this, expr.left.expr);
+ std::cout << ", ";
+ boost::apply_visitor(*this, expr.right.expr);
+ std::cout << ')';
+ }
+
+ void operator()(unary_op const& expr) const
+ {
+ std::cout << "op:" << expr.op << "(";
+ boost::apply_visitor(*this, expr.subject.expr);
+ std::cout << ')';
+ }
+ };
+
+ ///////////////////////////////////////////////////////////////////////////
+ // Our calculator grammar
+ ///////////////////////////////////////////////////////////////////////////
+ template <typename Iterator>
+ struct calculator : qi::grammar<Iterator, expression_ast(), ascii::space_type>
+ {
+ calculator() : calculator::base_type(expression)
+ {
+ using qi::_val;
+ using qi::_1;
+ using qi::uint_;
+
+ expression =
+ term [_val = _1]
+ >> *( ('+' >> term [_val += _1])
+ | ('-' >> term [_val -= _1])
+ )
+ ;
+
+ term =
+ factor [_val = _1]
+ >> *( ('*' >> factor [_val *= _1])
+ | ('/' >> factor [_val /= _1])
+ )
+ ;
+
+ factor =
+ uint_ [_val = _1]
+ | '(' >> expression [_val = _1] >> ')'
+ | ('-' >> factor [_val = neg(_1)])
+ | ('+' >> factor [_val = _1])
+ ;
+ }
+
+ qi::rule<Iterator, expression_ast(), ascii::space_type>
+ expression, term, factor;
+ };
+}
 
 ///////////////////////////////////////////////////////////////////////////////
 // Main program
@@ -170,8 +209,12 @@
     std::cout << "/////////////////////////////////////////////////////////\n\n";
     std::cout << "Type an expression...or [q or Q] to quit\n\n";
 
+ using boost::spirit::ascii::space;
+ using client::expression_ast;
+ using client::ast_print;
+
     typedef std::string::const_iterator iterator_type;
- typedef calculator<iterator_type> calculator;
+ typedef client::calculator<iterator_type> calculator;
 
     calculator calc; // Our grammar
 
@@ -183,13 +226,16 @@
 
         std::string::const_iterator iter = str.begin();
         std::string::const_iterator end = str.end();
- bool r = phrase_parse(iter, end, calc, space);
+ expression_ast ast;
+ ast_print printer;
+ bool r = phrase_parse(iter, end, calc, space, ast);
 
         if (r && iter == end)
         {
             std::cout << "-------------------------\n";
             std::cout << "Parsing succeeded\n";
- std::cout << "-------------------------\n";
+ printer(ast);
+ std::cout << "\n-------------------------\n";
         }
         else
         {

Modified: branches/release/libs/spirit/example/qi/calc3.cpp
==============================================================================
--- branches/release/libs/spirit/example/qi/calc3.cpp (original)
+++ branches/release/libs/spirit/example/qi/calc3.cpp 2009-09-14 12:45:39 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)
@@ -22,43 +22,48 @@
 #include <iostream>
 #include <string>
 
-using namespace boost::spirit;
-using namespace boost::spirit::qi;
-using namespace boost::spirit::ascii;
-using namespace boost::spirit::arg_names;
-
-///////////////////////////////////////////////////////////////////////////////
-// Our calculator grammar
-///////////////////////////////////////////////////////////////////////////////
-template <typename Iterator>
-struct calculator : grammar<Iterator, int(), space_type>
+namespace client
 {
- calculator() : calculator::base_type(expression)
+ namespace qi = boost::spirit::qi;
+ namespace ascii = boost::spirit::ascii;
+
+ ///////////////////////////////////////////////////////////////////////////
+ // Our calculator grammar
+ ///////////////////////////////////////////////////////////////////////////
+ template <typename Iterator>
+ struct calculator : qi::grammar<Iterator, int(), ascii::space_type>
     {
- expression =
- term [_val = _1]
- >> *( ('+' >> term [_val += _1])
- | ('-' >> term [_val -= _1])
- )
- ;
-
- term =
- factor [_val = _1]
- >> *( ('*' >> factor [_val *= _1])
- | ('/' >> factor [_val /= _1])
- )
- ;
-
- factor =
- uint_ [_val = _1]
- | '(' >> expression [_val = _1] >> ')'
- | ('-' >> factor [_val = -_1])
- | ('+' >> factor [_val = _1])
- ;
- }
+ calculator() : calculator::base_type(expression)
+ {
+ using qi::_val;
+ using qi::_1;
+ using qi::uint_;
+
+ expression =
+ term [_val = _1]
+ >> *( ('+' >> term [_val += _1])
+ | ('-' >> term [_val -= _1])
+ )
+ ;
+
+ term =
+ factor [_val = _1]
+ >> *( ('*' >> factor [_val *= _1])
+ | ('/' >> factor [_val /= _1])
+ )
+ ;
+
+ factor =
+ uint_ [_val = _1]
+ | '(' >> expression [_val = _1] >> ')'
+ | ('-' >> factor [_val = -_1])
+ | ('+' >> factor [_val = _1])
+ ;
+ }
 
- rule<Iterator, int(), space_type> expression, term, factor;
-};
+ qi::rule<Iterator, int(), ascii::space_type> expression, term, factor;
+ };
+}
 
 ///////////////////////////////////////////////////////////////////////////////
 // Main program
@@ -71,8 +76,9 @@
     std::cout << "/////////////////////////////////////////////////////////\n\n";
     std::cout << "Type an expression...or [q or Q] to quit\n\n";
 
+ using boost::spirit::ascii::space;
     typedef std::string::const_iterator iterator_type;
- typedef calculator<iterator_type> calculator;
+ typedef client::calculator<iterator_type> calculator;
 
     calculator calc; // Our grammar
 
@@ -85,7 +91,7 @@
 
         std::string::const_iterator iter = str.begin();
         std::string::const_iterator end = str.end();
- bool r = phrase_parse(iter, end, calc, result, space);
+ bool r = phrase_parse(iter, end, calc, space, result);
 
         if (r && iter == end)
         {

Deleted: branches/release/libs/spirit/example/qi/calc3_lexer.cpp
==============================================================================
--- branches/release/libs/spirit/example/qi/calc3_lexer.cpp 2009-09-14 12:45:39 EDT (Mon, 14 Sep 2009)
+++ (empty file)
@@ -1,203 +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)
-=============================================================================*/
-///////////////////////////////////////////////////////////////////////////////
-//
-// A calculator example demonstrating the grammar and semantic actions
-// using phoenix to do the actual expression evaluation. The parser is
-// essentially an "interpreter" that evaluates expressions on the fly.
-//
-// Additionally this examples shows how to build and use a lexer based on
-// Ben Hansons Lexertl (http://www.benhanson.net/lexertl.html). This way the
-// parser matches the grammar against the tokens generated by the lexer
-// component and not against the input character stream.
-//
-// Even if the benefits of using a lexer for this small calculator grammar may
-// not outweight the corresponding overhead, we provide this example because
-// it allows to concentrate on the essentials without having to understand
-// the semantics first.
-//
-// [ JDG June 29, 2002 ] spirit1
-// [ JDG March 5, 2007 ] spirit2
-//
-///////////////////////////////////////////////////////////////////////////////
-
-#include <boost/config/warning_disable.hpp>
-#include <boost/spirit/include/qi.hpp>
-#include <boost/spirit/include/lex_lexer_lexertl.hpp>
-#include <boost/spirit/include/phoenix_operator.hpp>
-
-#include <iostream>
-#include <string>
-
-using namespace boost::spirit;
-using namespace boost::spirit::qi;
-using namespace boost::spirit::lex;
-using namespace boost::spirit::ascii;
-using namespace boost::spirit::arg_names;
-
-///////////////////////////////////////////////////////////////////////////////
-// Our token definition
-// This class is used to define all the tokens to be recognized by the lexer.
-///////////////////////////////////////////////////////////////////////////////
-template <typename Lexer>
-struct calculator_tokens : lexer_def<Lexer>
-{
- template <typename Self>
- void def (Self& self)
- {
- // unsigned integer token definition
- ui = "[1-9][0-9]*";
-
- // whitespace token definitions
- ws = "[ \\t\\f\\v]+";
- c_comment = "\\/\\*[^*]*\\*+([^/*][^*]*\\*+)*\\/";
-
- // build token set
- skipper = ws | c_comment; // += is allowed as well
-
- // associate the tokens and the token set with the lexer
- // default lexer state
- self = token_def<>('+') | '-' | '*' | '/' | '(' | ')';
- self += ui; // still default state
-
- // The token_set 'skipper' get's assigned to a separate lexer state
- // which allows to use it separately from the main tokenization
- // (it is used as the skipper parser below)
- self("SKIPPER") = skipper; // lexer state "SKIPPER"
- }
-
- // This are the tokens to be recognized by the lexer.
- token_def<unsigned int> ui; // matched tokens will have a unsigned int
- token_def<> ws, c_comment; // attribute will not be used
-
- // This is the only token set explicitly defined by this lexer because it
- // needs to be accessible from the outside (used as skip parser below).
- typename Lexer::token_set skipper;
-};
-
-///////////////////////////////////////////////////////////////////////////////
-// Our calculator grammar
-//
-// The difference to the original example (calc3.cpp) is that we are
-// specifying a second template parameter referring to the lexer. Further, we
-// use a defined tokenset from above as the skip parser.
-///////////////////////////////////////////////////////////////////////////////
-template <typename Iterator, typename Lexer>
-struct calculator : grammar<Iterator, int(), typename Lexer::token_set>
-{
- template <typename TokenDef>
- calculator(TokenDef const& tok)
- : calculator::base_type(expression)
- {
- // grammar
- expression =
- term [_val = _1]
- >> *( ('+' >> term [_val += _1])
- | ('-' >> term [_val -= _1])
- )
- ;
-
- term =
- factor [_val = _1]
- >> *( ('*' >> factor [_val *= _1])
- | ('/' >> factor [_val /= _1])
- )
- ;
-
- factor =
- tok.ui [_val = _1]
- | '(' >> expression [_val = _1] >> ')'
- | ('-' >> factor [_val = -_1])
- | ('+' >> factor [_val = _1])
- ;
- }
-
- rule<Iterator, int(), typename Lexer::token_set> expression, term, factor;
-};
-
-///////////////////////////////////////////////////////////////////////////////
-// Main program
-///////////////////////////////////////////////////////////////////////////////
-int
-main()
-{
- std::cout << "/////////////////////////////////////////////////////////\n\n";
- std::cout << "Expression parser...\n\n";
- std::cout << "/////////////////////////////////////////////////////////\n\n";
- std::cout << "Type an expression...or [q or Q] to quit\n\n";
-
- // iterator type used to expose the underlying input stream
- typedef std::string::const_iterator base_iterator_type;
-
- // This is the lexer token type to use. The second template parameter lists
- // all attribute types used for token_def's during token definition (see
- // calculator_tokens<> above). Here we use the predefined lexertl token
- // type, but any compatible token type may be used.
- typedef lexertl_token<
- base_iterator_type, boost::mpl::vector<unsigned int>
- > token_type;
-
- // This is the lexer type to use to tokenize the input.
- // Here we use the lexertl based lexer engine.
- typedef lexertl_lexer<token_type> lexer_type;
-
- // This is the token definition type (derived from the given lexer type).
- typedef calculator_tokens<lexer_type> calculator_tokens;
-
- // this is the iterator type exposed by the lexer
- typedef lexer<calculator_tokens>::iterator_type iterator_type;
-
- // this is the type of the grammar to parse
- typedef calculator<iterator_type, lexer_type> calculator;
-
- // now we use the types defined above to create the lexer and grammar
- // object instances needed to invoke the parsing process
- calculator_tokens tokens; // Our token definition
- calculator calc(tokens); // Our grammar definition
-
- lexer<calculator_tokens> lex(tokens); // Our lexer
-
- // get input line by line and feed the parser to evaluate the expressions
- // read in from the input
- std::string str;
- int result;
- while (std::getline(std::cin, str))
- {
- if (str.empty() || str[0] == 'q' || str[0] == 'Q')
- break;
-
- // At this point we generate the iterator pair used to expose the
- // tokenized input stream.
- iterator_type iter = lex.begin(str.begin(), str.end());
- iterator_type end = lex.end();
-
- // Parsing is done based on the the token stream, not the character
- // stream read from the input.
- // Note, how we use the token_set defined above as the skip parser.
- bool r = phrase_parse(iter, end, calc, result, tokens.skipper);
-
- if (r && iter == end)
- {
- std::cout << "-------------------------\n";
- std::cout << "Parsing succeeded\n";
- std::cout << "result = " << result << std::endl;
- std::cout << "-------------------------\n";
- }
- else
- {
- std::cout << "-------------------------\n";
- std::cout << "Parsing failed\n";
- std::cout << "-------------------------\n";
- }
- }
-
- std::cout << "Bye... :-) \n\n";
- return 0;
-}
-
-

Modified: branches/release/libs/spirit/example/qi/calc4.cpp
==============================================================================
--- branches/release/libs/spirit/example/qi/calc4.cpp (original)
+++ branches/release/libs/spirit/example/qi/calc4.cpp 2009-09-14 12:45:39 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)
@@ -21,62 +21,69 @@
 #include <iostream>
 #include <string>
 
-using namespace boost::spirit;
-using namespace boost::spirit::qi;
-using namespace boost::spirit::ascii;
-using namespace boost::spirit::arg_names;
-
-using boost::phoenix::val;
-using boost::phoenix::construct;
-
-///////////////////////////////////////////////////////////////////////////////
-// Our calculator grammar
-///////////////////////////////////////////////////////////////////////////////
-template <typename Iterator>
-struct calculator : grammar<Iterator, int(), space_type>
+namespace client
 {
- calculator() : calculator::base_type(expression)
+ namespace qi = boost::spirit::qi;
+ namespace phoenix = boost::phoenix;
+ namespace ascii = boost::spirit::ascii;
+
+ ///////////////////////////////////////////////////////////////////////////////
+ // Our calculator grammar
+ ///////////////////////////////////////////////////////////////////////////////
+ template <typename Iterator>
+ struct calculator : qi::grammar<Iterator, int(), ascii::space_type>
     {
- expression =
- term [_val = _1]
- >> *( ('+' > term [_val += _1])
- | ('-' > term [_val -= _1])
- )
- ;
-
- term =
- factor [_val = _1]
- >> *( ('*' > factor [_val *= _1])
- | ('/' > factor [_val /= _1])
- )
- ;
-
- factor =
- uint_ [_val = _1]
- | '(' > expression [_val = _1] > ')'
- | ('-' > factor [_val = -_1])
- | ('+' > factor [_val = _1])
- ;
-
- expression.name("expression");
- term.name("term");
- factor.name("factor");
-
- on_error<fail>
- (
- expression
- , std::cout
- << val("Error! Expecting ")
- << _4 // what failed?
- << val(" here: \"")
- << construct<std::string>(_3, _2) // iterators to error-pos, end
- << val("\"")
- << std::endl
- );
- }
+ calculator() : calculator::base_type(expression)
+ {
+ using namespace qi::labels;
+ using qi::uint_;
+ using qi::on_error;
+ using qi::fail;
+
+ using phoenix::construct;
+ using phoenix::val;
+
+ expression =
+ term [_val = _1]
+ >> *( ('+' > term [_val += _1])
+ | ('-' > term [_val -= _1])
+ )
+ ;
+
+ term =
+ factor [_val = _1]
+ >> *( ('*' > factor [_val *= _1])
+ | ('/' > factor [_val /= _1])
+ )
+ ;
+
+ factor =
+ uint_ [_val = _1]
+ | '(' > expression [_val = _1] > ')'
+ | ('-' > factor [_val = -_1])
+ | ('+' > factor [_val = _1])
+ ;
+
+ expression.name("expression");
+ term.name("term");
+ factor.name("factor");
+
+ on_error<fail>
+ (
+ expression
+ , std::cout
+ << val("Error! Expecting ")
+ << _4 // what failed?
+ << val(" here: \"")
+ << construct<std::string>(_3, _2) // iterators to error-pos, end
+ << val("\"")
+ << std::endl
+ );
+ }
 
- rule<Iterator, int(), space_type> expression, term, factor;
-};
+ qi::rule<Iterator, int(), ascii::space_type> expression, term, factor;
+ };
+}
 
 ///////////////////////////////////////////////////////////////////////////////
 // Main program
@@ -89,10 +96,10 @@
     std::cout << "/////////////////////////////////////////////////////////\n\n";
     std::cout << "Type an expression...or [q or Q] to quit\n\n";
 
+ using boost::spirit::ascii::space;
     typedef std::string::const_iterator iterator_type;
- typedef calculator<iterator_type> calculator;
+ typedef client::calculator<iterator_type> calculator;
 
- calculator def; // Our grammar definition
     calculator calc; // Our grammar
 
     std::string str;
@@ -104,7 +111,7 @@
 
         std::string::const_iterator iter = str.begin();
         std::string::const_iterator end = str.end();
- bool r = phrase_parse(iter, end, calc, result, space);
+ bool r = phrase_parse(iter, end, calc, space, result);
 
         if (r && iter == end)
         {

Modified: branches/release/libs/spirit/example/qi/calc5.cpp
==============================================================================
--- branches/release/libs/spirit/example/qi/calc5.cpp (original)
+++ branches/release/libs/spirit/example/qi/calc5.cpp 2009-09-14 12:45:39 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)
@@ -28,163 +28,170 @@
 #include <string>
 #include <vector>
 
-using namespace boost::spirit;
-using namespace boost::spirit::qi;
-using namespace boost::spirit::ascii;
-using namespace boost::spirit::arg_names;
-
-using boost::phoenix::ref;
-using boost::phoenix::push_back;
-using boost::phoenix::val;
-using boost::phoenix::construct;
-
-///////////////////////////////////////////////////////////////////////////////
-// The Virtual Machine
-///////////////////////////////////////////////////////////////////////////////
-enum byte_code
+namespace client
 {
- op_neg, // negate the top stack entry
- op_add, // add top two stack entries
- op_sub, // subtract top two stack entries
- op_mul, // multiply top two stack entries
- op_div, // divide top two stack entries
- op_int, // push constant integer into the stack
-};
-
-class vmachine
-{
-public:
-
- vmachine(unsigned stackSize = 4096)
- : stack(stackSize)
- , stack_ptr(stack.begin())
- {
- }
+ namespace qi = boost::spirit::qi;
+ namespace phoenix = boost::phoenix;
+ namespace ascii = boost::spirit::ascii;
+
+ ///////////////////////////////////////////////////////////////////////////
+ // The Virtual Machine
+ ///////////////////////////////////////////////////////////////////////////
+ enum byte_code
+ {
+ op_neg, // negate the top stack entry
+ op_add, // add top two stack entries
+ op_sub, // subtract top two stack entries
+ op_mul, // multiply top two stack entries
+ op_div, // divide top two stack entries
+ op_int, // push constant integer into the stack
+ };
+
+ class vmachine
+ {
+ public:
+
+ vmachine(unsigned stackSize = 4096)
+ : stack(stackSize)
+ , stack_ptr(stack.begin())
+ {
+ }
 
- int top() const { return stack_ptr[-1]; };
- void execute(std::vector<int> const& code);
+ int top() const { return stack_ptr[-1]; };
+ void execute(std::vector<int> const& code);
 
-private:
+ private:
 
- std::vector<int> stack;
- std::vector<int>::iterator stack_ptr;
-};
+ std::vector<int> stack;
+ std::vector<int>::iterator stack_ptr;
+ };
 
-void vmachine::execute(std::vector<int> const& code)
-{
- std::vector<int>::const_iterator pc = code.begin();
- stack_ptr = stack.begin();
-
- while (pc != code.end())
+ void vmachine::execute(std::vector<int> const& code)
     {
- switch (*pc++)
+ std::vector<int>::const_iterator pc = code.begin();
+ stack_ptr = stack.begin();
+
+ while (pc != code.end())
         {
- case op_neg:
- stack_ptr[-1] = -stack_ptr[-1];
- break;
-
- case op_add:
- --stack_ptr;
- stack_ptr[-1] += stack_ptr[0];
- break;
-
- case op_sub:
- --stack_ptr;
- stack_ptr[-1] -= stack_ptr[0];
- break;
-
- case op_mul:
- --stack_ptr;
- stack_ptr[-1] *= stack_ptr[0];
- break;
-
- case op_div:
- --stack_ptr;
- stack_ptr[-1] /= stack_ptr[0];
- break;
-
- case op_int:
- *stack_ptr++ = *pc++;
- break;
+ switch (*pc++)
+ {
+ case op_neg:
+ stack_ptr[-1] = -stack_ptr[-1];
+ break;
+
+ case op_add:
+ --stack_ptr;
+ stack_ptr[-1] += stack_ptr[0];
+ break;
+
+ case op_sub:
+ --stack_ptr;
+ stack_ptr[-1] -= stack_ptr[0];
+ break;
+
+ case op_mul:
+ --stack_ptr;
+ stack_ptr[-1] *= stack_ptr[0];
+ break;
+
+ case op_div:
+ --stack_ptr;
+ stack_ptr[-1] /= stack_ptr[0];
+ break;
+
+ case op_int:
+ *stack_ptr++ = *pc++;
+ break;
+ }
         }
     }
-}
 
-///////////////////////////////////////////////////////////////////////////////
-// Our calculator grammar and compiler
-///////////////////////////////////////////////////////////////////////////////
-template <typename Iterator>
-struct calculator : grammar<Iterator, space_type>
-{
- calculator(std::vector<int>& code)
- : calculator::base_type(expression)
- , code(code)
- {
- expression =
- term
- >> *( ('+' > term [push_back(ref(code), op_add)])
- | ('-' > term [push_back(ref(code), op_sub)])
- )
- ;
-
- term =
- factor
- >> *( ('*' > factor [push_back(ref(code), op_mul)])
- | ('/' > factor [push_back(ref(code), op_div)])
- )
- ;
-
- factor =
- uint_ [
- push_back(ref(code), op_int),
- push_back(ref(code), _1)
- ]
- | '(' > expression > ')'
- | ('-' > factor [push_back(ref(code), op_neg)])
- | ('+' > factor)
- ;
-
- expression.name("expression");
- term.name("term");
- factor.name("factor");
-
- on_error<fail>
- (
- expression
- , std::cout
- << val("Error! Expecting ")
- << _4 // what failed?
- << val(" here: \"")
- << construct<std::string>(_3, _2) // iterators to error-pos, end
- << val("\"")
- << std::endl
- );
- }
+ ///////////////////////////////////////////////////////////////////////////
+ // Our calculator grammar and compiler
+ ///////////////////////////////////////////////////////////////////////////
+ template <typename Iterator>
+ struct calculator : qi::grammar<Iterator, ascii::space_type>
+ {
+ calculator(std::vector<int>& code)
+ : calculator::base_type(expression)
+ , code(code)
+ {
+ using namespace qi::labels;
+ using qi::uint_;
+ using qi::on_error;
+ using qi::fail;
+
+ using phoenix::val;
+ using phoenix::ref;
+ using phoenix::push_back;
+ using phoenix::construct;
+
+ expression =
+ term
+ >> *( ('+' > term [push_back(ref(code), op_add)])
+ | ('-' > term [push_back(ref(code), op_sub)])
+ )
+ ;
+
+ term =
+ factor
+ >> *( ('*' > factor [push_back(ref(code), op_mul)])
+ | ('/' > factor [push_back(ref(code), op_div)])
+ )
+ ;
+
+ factor =
+ uint_ [
+ push_back(ref(code), op_int),
+ push_back(ref(code), _1)
+ ]
+ | '(' > expression > ')'
+ | ('-' > factor [push_back(ref(code), op_neg)])
+ | ('+' > factor)
+ ;
+
+ expression.name("expression");
+ term.name("term");
+ factor.name("factor");
+
+ on_error<fail>
+ (
+ expression
+ , std::cout
+ << val("Error! Expecting ")
+ << _4 // what failed?
+ << val(" here: \"")
+ << construct<std::string>(_3, _2) // iterators to error-pos, end
+ << val("\"")
+ << std::endl
+ );
+ }
 
- rule<Iterator, space_type> expression, term, factor;
- std::vector<int>& code;
-};
+ qi::rule<Iterator, ascii::space_type> expression, term, factor;
+ std::vector<int>& code;
+ };
+
+ template <typename Grammar>
+ bool compile(Grammar const& calc, std::string const& expr)
+ {
+ std::string::const_iterator iter = expr.begin();
+ std::string::const_iterator end = expr.end();
+ bool r = phrase_parse(iter, end, calc, ascii::space);
 
-template <typename Grammar>
-bool compile(Grammar const& calc, std::string const& expr)
-{
- std::string::const_iterator iter = expr.begin();
- std::string::const_iterator end = expr.end();
- bool r = phrase_parse(iter, end, calc, space);
-
- if (r && iter == end)
- {
- std::cout << "-------------------------\n";
- std::cout << "Parsing succeeded\n";
- std::cout << "-------------------------\n";
- return true;
- }
- else
- {
- std::cout << "-------------------------\n";
- std::cout << "Parsing failed\n";
- std::cout << "-------------------------\n";
- return false;
+ if (r && iter == end)
+ {
+ std::cout << "-------------------------\n";
+ std::cout << "Parsing succeeded\n";
+ std::cout << "-------------------------\n";
+ return true;
+ }
+ else
+ {
+ std::cout << "-------------------------\n";
+ std::cout << "Parsing failed\n";
+ std::cout << "-------------------------\n";
+ return false;
+ }
     }
 }
 
@@ -200,9 +207,9 @@
     std::cout << "Type an expression...or [q or Q] to quit\n\n";
 
     typedef std::string::const_iterator iterator_type;
- typedef calculator<iterator_type> calculator;
+ typedef client::calculator<iterator_type> calculator;
 
- vmachine mach; // Our virtual machine
+ client::vmachine mach; // Our virtual machine
     std::vector<int> code; // Our VM code
     calculator calc(code); // Our grammar
 
@@ -213,7 +220,7 @@
             break;
 
         code.clear();
- if (::compile(calc, str))
+ if (client::compile(calc, str))
         {
             mach.execute(code);
             std::cout << "\n\nresult = " << mach.top() << std::endl;

Modified: branches/release/libs/spirit/example/qi/calc6/calc6.cpp
==============================================================================
--- branches/release/libs/spirit/example/qi/calc6/calc6.cpp (original)
+++ branches/release/libs/spirit/example/qi/calc6/calc6.cpp 2009-09-14 12:45:39 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)
@@ -21,6 +21,8 @@
 template <typename Grammar>
 bool compile(Grammar const& calc, std::string const& expr)
 {
+ using ascii::space;
+
     std::string::const_iterator iter = expr.begin();
     std::string::const_iterator end = expr.end();
     bool r = phrase_parse(iter, end, calc, space);

Modified: branches/release/libs/spirit/example/qi/calc6/calc6.hpp
==============================================================================
--- branches/release/libs/spirit/example/qi/calc6/calc6.hpp (original)
+++ branches/release/libs/spirit/example/qi/calc6/calc6.hpp 2009-09-14 12:45:39 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)
@@ -18,14 +18,14 @@
 #include <string>
 #include <vector>
 
-using namespace boost::spirit;
-using namespace boost::spirit::qi;
-using namespace boost::spirit::ascii;
-using namespace boost::spirit::arg_names;
-
 using boost::phoenix::function;
 using boost::phoenix::ref;
 
+using boost::spirit::qi::unused_type;
+
+namespace qi = boost::spirit::qi;
+namespace ascii = boost::spirit::ascii;
+
 ///////////////////////////////////////////////////////////////////////////////
 // The Virtual Machine
 ///////////////////////////////////////////////////////////////////////////////
@@ -105,7 +105,7 @@
 
     template <typename Iterator>
     void operator()(
- std::string const& what
+ qi::info const& what
       , Iterator err_pos, Iterator last) const
     {
         std::cout
@@ -125,16 +125,16 @@
 // Our expression grammar and compiler
 ///////////////////////////////////////////////////////////////////////////////
 template <typename Iterator>
-struct expression : grammar<Iterator, space_type>
+struct expression : qi::grammar<Iterator, ascii::space_type>
 {
- expression(std::vector<int>& code, symbols<char, int>& vars);
+ expression(std::vector<int>& code, qi::symbols<char, int>& vars);
 
- rule<Iterator, space_type>
+ qi::rule<Iterator, ascii::space_type>
         expr, additive_expr, multiplicative_expr
       , unary_expr, primary_expr, variable;
 
     std::vector<int>& code;
- symbols<char, int>& vars;
+ qi::symbols<char, int>& vars;
     function<compile_op> op;
 };
 
@@ -146,7 +146,7 @@
     template <typename, typename>
     struct result { typedef void type; };
 
- var_adder(symbols<char, int>& vars)
+ var_adder(qi::symbols<char, int>& vars)
       : vars(vars)
     {
     }
@@ -156,24 +156,24 @@
         vars.add(var.begin(), var.end(), nvars++);
     };
 
- symbols<char, int>& vars;
+ qi::symbols<char, int>& vars;
 };
 
 template <typename Iterator>
-struct statement : grammar<Iterator, space_type>
+struct statement : qi::grammar<Iterator, ascii::space_type>
 {
     statement(std::vector<int>& code);
 
     std::vector<int>& code;
- symbols<char, int> vars;
+ qi::symbols<char, int> vars;
     int nvars;
 
     expression<Iterator> expr;
- rule<Iterator, space_type> start, var_decl;
- rule<Iterator, std::string(), space_type> identifier;
- rule<Iterator, int(), space_type> var_ref;
- rule<Iterator, locals<int>, space_type> assignment;
- rule<Iterator, void(int), space_type> assignment_rhs;
+ qi::rule<Iterator, ascii::space_type> start, var_decl;
+ qi::rule<Iterator, std::string(), ascii::space_type> identifier;
+ qi::rule<Iterator, int(), ascii::space_type> var_ref;
+ qi::rule<Iterator, qi::locals<int>, ascii::space_type> assignment;
+ qi::rule<Iterator, void(int), ascii::space_type> assignment_rhs;
 
     function<var_adder> add_var;
     function<compile_op> op;

Modified: branches/release/libs/spirit/example/qi/calc6/calc6a.cpp
==============================================================================
--- branches/release/libs/spirit/example/qi/calc6/calc6a.cpp (original)
+++ branches/release/libs/spirit/example/qi/calc6/calc6a.cpp 2009-09-14 12:45:39 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)

Modified: branches/release/libs/spirit/example/qi/calc6/calc6b.cpp
==============================================================================
--- branches/release/libs/spirit/example/qi/calc6/calc6b.cpp (original)
+++ branches/release/libs/spirit/example/qi/calc6/calc6b.cpp 2009-09-14 12:45:39 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)
@@ -11,7 +11,7 @@
 void instantiate_expression()
 {
     typedef std::string::const_iterator iterator_type;
- symbols<char, int> vars;
+ qi::symbols<char, int> vars;
     std::vector<int> code;
     expression<iterator_type> g(code, vars);
 }

Modified: branches/release/libs/spirit/example/qi/calc6/calc6b.hpp
==============================================================================
--- branches/release/libs/spirit/example/qi/calc6/calc6b.hpp (original)
+++ branches/release/libs/spirit/example/qi/calc6/calc6b.hpp 2009-09-14 12:45:39 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)
@@ -13,12 +13,19 @@
 // Our expression grammar and compiler
 ///////////////////////////////////////////////////////////////////////////////
 template <typename Iterator>
-expression<Iterator>::expression(std::vector<int>& code, symbols<char, int>& vars)
+expression<Iterator>::expression(std::vector<int>& code, qi::symbols<char, int>& vars)
   : expression::base_type(expr)
   , code(code)
   , vars(vars)
   , op(code)
 {
+ using qi::lexeme;
+ using qi::uint_;
+ using namespace qi::labels;
+ using qi::on_error;
+ using qi::fail;
+ using ascii::alnum;
+
     expr =
         additive_expr.alias()
         ;

Modified: branches/release/libs/spirit/example/qi/calc6/calc6c.cpp
==============================================================================
--- branches/release/libs/spirit/example/qi/calc6/calc6c.cpp (original)
+++ branches/release/libs/spirit/example/qi/calc6/calc6c.cpp 2009-09-14 12:45:39 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)

Modified: branches/release/libs/spirit/example/qi/calc6/calc6c.hpp
==============================================================================
--- branches/release/libs/spirit/example/qi/calc6/calc6c.hpp (original)
+++ branches/release/libs/spirit/example/qi/calc6/calc6c.hpp 2009-09-14 12:45:39 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)
@@ -21,6 +21,15 @@
   , add_var(vars)
   , op(code)
 {
+ using qi::lexeme;
+ using qi::lit;
+ using qi::raw;
+ using namespace qi::labels;
+ using qi::on_error;
+ using qi::fail;
+ using ascii::alnum;
+ using ascii::alpha;
+
     identifier %=
         raw[lexeme[alpha >> *(alnum | '_')]]
         ;
@@ -48,7 +57,7 @@
 
     assignment_rhs =
             expr
- > char_(';') [op(op_store, _r1)]
+ > lit(';') [op(op_store, _r1)]
         ;
 
     start = +(var_decl | assignment);
@@ -62,4 +71,4 @@
     on_error<fail>(start, error_handler(_4, _3, _2));
 }
 
-#endif
\ No newline at end of file
+#endif

Modified: branches/release/libs/spirit/example/qi/calc7/calc7.cpp
==============================================================================
--- branches/release/libs/spirit/example/qi/calc7/calc7.cpp (original)
+++ branches/release/libs/spirit/example/qi/calc7/calc7.cpp 2009-09-14 12:45:39 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)
@@ -17,6 +17,8 @@
 template <typename Grammar>
 bool compile(Grammar const& calc, std::string const& expr)
 {
+ using ascii::space;
+
     std::string::const_iterator iter = expr.begin();
     std::string::const_iterator end = expr.end();
     bool r = phrase_parse(iter, end, calc, space);

Modified: branches/release/libs/spirit/example/qi/calc7/calc7.hpp
==============================================================================
--- branches/release/libs/spirit/example/qi/calc7/calc7.hpp (original)
+++ branches/release/libs/spirit/example/qi/calc7/calc7.hpp 2009-09-14 12:45:39 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)
@@ -18,15 +18,15 @@
 #include <string>
 #include <vector>
 
-using namespace boost::spirit;
-using namespace boost::spirit::qi;
-using namespace boost::spirit::ascii;
-using namespace boost::spirit::arg_names;
-
 using boost::phoenix::function;
 using boost::phoenix::ref;
 using boost::phoenix::size;
 
+using boost::spirit::qi::unused_type;
+
+namespace qi = boost::spirit::qi;
+namespace ascii = boost::spirit::ascii;
+
 ///////////////////////////////////////////////////////////////////////////////
 // The Virtual Machine
 ///////////////////////////////////////////////////////////////////////////////
@@ -124,7 +124,7 @@
 
     template <typename Iterator>
     void operator()(
- std::string const& what
+ qi::info const& what
       , Iterator err_pos, Iterator last) const
     {
         std::cout
@@ -144,18 +144,18 @@
 // Our expression grammar and compiler
 ///////////////////////////////////////////////////////////////////////////////
 template <typename Iterator>
-struct expression : grammar<Iterator, space_type>
+struct expression : qi::grammar<Iterator, ascii::space_type>
 {
- expression(std::vector<int>& code, symbols<char, int>& vars);
+ expression(std::vector<int>& code, qi::symbols<char, int>& vars);
 
- rule<Iterator, space_type>
+ qi::rule<Iterator, ascii::space_type>
         expr, equality_expr, relational_expr
       , logical_expr, additive_expr, multiplicative_expr
       , unary_expr, primary_expr, variable
     ;
 
     std::vector<int>& code;
- symbols<char, int>& vars;
+ qi::symbols<char, int>& vars;
     function<compile_op> op;
 };
 
@@ -167,7 +167,7 @@
     template <typename, typename>
     struct result { typedef void type; };
 
- var_adder(symbols<char, int>& vars)
+ var_adder(qi::symbols<char, int>& vars)
       : vars(vars)
     {
     }
@@ -177,29 +177,29 @@
         vars.add(var.begin(), var.end(), nvars++);
     };
 
- symbols<char, int>& vars;
+ qi::symbols<char, int>& vars;
 };
 
 template <typename Iterator>
-struct statement : grammar<Iterator, space_type>
+struct statement : qi::grammar<Iterator, ascii::space_type>
 {
     statement(std::vector<int>& code);
 
     std::vector<int>& code;
- symbols<char, int> vars;
+ qi::symbols<char, int> vars;
     int nvars;
 
     expression<Iterator> expr;
- rule<Iterator, space_type>
+ qi::rule<Iterator, ascii::space_type>
         statement_, statement_list, var_decl, compound_statement
     ;
 
- rule<Iterator, locals<int>, space_type> if_statement;
- rule<Iterator, locals<int, int>, space_type> while_statement;
- rule<Iterator, std::string(), space_type> identifier;
- rule<Iterator, int(), space_type> var_ref;
- rule<Iterator, locals<int>, space_type> assignment;
- rule<Iterator, void(int), space_type> assignment_rhs;
+ qi::rule<Iterator, qi::locals<int>, ascii::space_type> if_statement;
+ qi::rule<Iterator, qi::locals<int, int>, ascii::space_type> while_statement;
+ qi::rule<Iterator, std::string(), ascii::space_type> identifier;
+ qi::rule<Iterator, int(), ascii::space_type> var_ref;
+ qi::rule<Iterator, qi::locals<int>, ascii::space_type> assignment;
+ qi::rule<Iterator, void(int), ascii::space_type> assignment_rhs;
 
     function<var_adder> add_var;
     function<compile_op> op;

Modified: branches/release/libs/spirit/example/qi/calc7/calc7a.cpp
==============================================================================
--- branches/release/libs/spirit/example/qi/calc7/calc7a.cpp (original)
+++ branches/release/libs/spirit/example/qi/calc7/calc7a.cpp 2009-09-14 12:45:39 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)

Modified: branches/release/libs/spirit/example/qi/calc7/calc7b.cpp
==============================================================================
--- branches/release/libs/spirit/example/qi/calc7/calc7b.cpp (original)
+++ branches/release/libs/spirit/example/qi/calc7/calc7b.cpp 2009-09-14 12:45:39 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)
@@ -11,7 +11,7 @@
 void instantiate_expression()
 {
     typedef std::string::const_iterator iterator_type;
- symbols<char, int> vars;
+ qi::symbols<char, int> vars;
     std::vector<int> code;
     expression<iterator_type> g(code, vars);
 }

Modified: branches/release/libs/spirit/example/qi/calc7/calc7b.hpp
==============================================================================
--- branches/release/libs/spirit/example/qi/calc7/calc7b.hpp (original)
+++ branches/release/libs/spirit/example/qi/calc7/calc7b.hpp 2009-09-14 12:45:39 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)
@@ -13,12 +13,20 @@
 // Our expression grammar and compiler
 ///////////////////////////////////////////////////////////////////////////////
 template <typename Iterator>
-expression<Iterator>::expression(std::vector<int>& code, symbols<char, int>& vars)
+expression<Iterator>::expression(std::vector<int>& code, qi::symbols<char, int>& vars)
   : expression::base_type(expr)
   , code(code)
   , vars(vars)
   , op(code)
 {
+ using qi::lexeme;
+ using qi::lit;
+ using qi::uint_;
+ using namespace qi::labels;
+ using qi::on_error;
+ using qi::fail;
+ using ascii::alnum;
+
     expr =
         equality_expr.alias()
         ;

Modified: branches/release/libs/spirit/example/qi/calc7/calc7c.cpp
==============================================================================
--- branches/release/libs/spirit/example/qi/calc7/calc7c.cpp (original)
+++ branches/release/libs/spirit/example/qi/calc7/calc7c.cpp 2009-09-14 12:45:39 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)

Modified: branches/release/libs/spirit/example/qi/calc7/calc7c.hpp
==============================================================================
--- branches/release/libs/spirit/example/qi/calc7/calc7c.hpp (original)
+++ branches/release/libs/spirit/example/qi/calc7/calc7c.hpp 2009-09-14 12:45:39 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)
@@ -21,6 +21,15 @@
   , add_var(vars)
   , op(code)
 {
+ using qi::lexeme;
+ using qi::lit;
+ using qi::raw;
+ using namespace qi::labels;
+ using qi::on_error;
+ using qi::fail;
+ using ascii::alnum;
+ using ascii::alpha;
+
     identifier %=
         raw[lexeme[alpha >> *(alnum | '_')]]
         ;
@@ -48,7 +57,7 @@
 
     assignment_rhs =
             expr
- > char_(';') [op(op_store, _r1)]
+ > lit(';') [op(op_store, _r1)]
         ;
 
     if_statement =

Modified: branches/release/libs/spirit/example/qi/complex_number.cpp
==============================================================================
--- branches/release/libs/spirit/example/qi/complex_number.cpp (original)
+++ branches/release/libs/spirit/example/qi/complex_number.cpp 2009-09-14 12:45:39 EDT (Mon, 14 Sep 2009)
@@ -1,5 +1,5 @@
 /*=============================================================================
- Copyright (c) 2002-2007 Joel de Guzman
+ Copyright (c) 2002-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)
@@ -22,37 +22,40 @@
 #include <string>
 #include <complex>
 
-using namespace boost::phoenix;
-using namespace boost::spirit;
-using namespace boost::spirit::qi;
-using namespace boost::spirit::ascii;
-using namespace boost::spirit::arg_names;
-
 ///////////////////////////////////////////////////////////////////////////////
 // Our complex number parser/compiler
 ///////////////////////////////////////////////////////////////////////////////
 //[tutorial_complex_number
-template <typename Iterator>
-bool parse_complex(Iterator first, Iterator last, std::complex<double>& c)
+namespace client
 {
- double rN = 0.0;
- double iN = 0.0;
- bool r = phrase_parse(first, last,
-
- // Begin grammar
- (
- '(' >> double_[ref(rN) = _1]
- >> -(',' >> double_[ref(iN) = _1]) >> ')'
- | double_[ref(rN) = _1]
- ),
- // End grammar
-
- space);
-
- if (!r || first != last) // fail if we did not get a full match
- return false;
- c = std::complex<double>(rN, iN);
- return r;
+ template <typename Iterator>
+ bool parse_complex(Iterator first, Iterator last, std::complex<double>& c)
+ {
+ using boost::spirit::qi::double_;
+ using boost::spirit::qi::_1;
+ using boost::spirit::qi::phrase_parse;
+ using boost::spirit::ascii::space;
+ using boost::phoenix::ref;
+
+ double rN = 0.0;
+ double iN = 0.0;
+ bool r = phrase_parse(first, last,
+
+ // Begin grammar
+ (
+ '(' >> double_[ref(rN) = _1]
+ >> -(',' >> double_[ref(iN) = _1]) >> ')'
+ | double_[ref(rN) = _1]
+ ),
+ // End grammar
+
+ space);
+
+ if (!r || first != last) // fail if we did not get a full match
+ return false;
+ c = std::complex<double>(rN, iN);
+ return r;
+ }
 }
 //]
 
@@ -76,7 +79,7 @@
             break;
 
         std::complex<double> c;
- if (parse_complex(str.begin(), str.end(), c))
+ if (client::parse_complex(str.begin(), str.end(), c))
         {
             std::cout << "-------------------------\n";
             std::cout << "Parsing succeeded\n";

Modified: branches/release/libs/spirit/example/qi/employee.cpp
==============================================================================
--- branches/release/libs/spirit/example/qi/employee.cpp (original)
+++ branches/release/libs/spirit/example/qi/employee.cpp 2009-09-14 12:45:39 EDT (Mon, 14 Sep 2009)
@@ -1,5 +1,5 @@
 /*=============================================================================
- Copyright (c) 2002-2007 Joel de Guzman
+ Copyright (c) 2002-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)
@@ -25,30 +25,32 @@
 #include <string>
 #include <complex>
 
-using namespace boost::phoenix;
-using namespace boost::spirit;
-using namespace boost::spirit::qi;
-using namespace boost::spirit::ascii;
-using namespace boost::spirit::arg_names;
-
-///////////////////////////////////////////////////////////////////////////////
-// Our employee struct
-///////////////////////////////////////////////////////////////////////////////
-//[tutorial_employee_struct
-struct employee
+namespace client
 {
- int age;
- std::string surname;
- std::string forename;
- double salary;
-};
-//]
+ namespace qi = boost::spirit::qi;
+ namespace ascii = boost::spirit::ascii;
+
+ ///////////////////////////////////////////////////////////////////////////
+ // Our employee struct
+ ///////////////////////////////////////////////////////////////////////////
+ //[tutorial_employee_struct
+ struct employee
+ {
+ int age;
+ std::string surname;
+ std::string forename;
+ double salary;
+ };
+ //]
+}
 
 // We need to tell fusion about our employee struct
-// to make it a first-class fusion citizen
+// to make it a first-class fusion citizen. This has to
+// be in global scope.
+
 //[tutorial_employee_adapt_struct
 BOOST_FUSION_ADAPT_STRUCT(
- employee,
+ client::employee,
     (int, age)
     (std::string, surname)
     (std::string, forename)
@@ -56,32 +58,41 @@
 )
 //]
 
-///////////////////////////////////////////////////////////////////////////////
-// Our employee parser
-///////////////////////////////////////////////////////////////////////////////
-//[tutorial_employee_parser
-template <typename Iterator>
-struct employee_parser : grammar<Iterator, employee(), space_type>
+namespace client
 {
- employee_parser() : employee_parser::base_type(start)
+ ///////////////////////////////////////////////////////////////////////////////
+ // Our employee parser
+ ///////////////////////////////////////////////////////////////////////////////
+ //[tutorial_employee_parser
+ template <typename Iterator>
+ struct employee_parser : qi::grammar<Iterator, employee(), ascii::space_type>
     {
- quoted_string %= lexeme['"' >> +(char_ - '"') >> '"'];
-
- start %=
- lit("employee")
- >> '{'
- >> int_ >> ','
- >> quoted_string >> ','
- >> quoted_string >> ','
- >> double_
- >> '}'
- ;
- }
+ employee_parser() : employee_parser::base_type(start)
+ {
+ using qi::int_;
+ using qi::lit;
+ using qi::double_;
+ using qi::lexeme;
+ using ascii::char_;
+
+ quoted_string %= lexeme['"' >> +(char_ - '"') >> '"'];
+
+ start %=
+ lit("employee")
+ >> '{'
+ >> int_ >> ','
+ >> quoted_string >> ','
+ >> quoted_string >> ','
+ >> double_
+ >> '}'
+ ;
+ }
 
- rule<Iterator, std::string(), space_type> quoted_string;
- rule<Iterator, employee(), space_type> start;
-};
-//]
+ qi::rule<Iterator, std::string(), ascii::space_type> quoted_string;
+ qi::rule<Iterator, employee(), ascii::space_type> start;
+ };
+ //]
+}
 
 ////////////////////////////////////////////////////////////////////////////
 // Main program
@@ -98,8 +109,9 @@
         << "employee{age, \"surname\", \"forename\", salary } \n";
     std::cout << "Type [q or Q] to quit\n\n";
 
+ using boost::spirit::ascii::space;
     typedef std::string::const_iterator iterator_type;
- typedef employee_parser<iterator_type> employee_parser;
+ typedef client::employee_parser<iterator_type> employee_parser;
 
     employee_parser g; // Our grammar
     std::string str;
@@ -108,10 +120,10 @@
         if (str.empty() || str[0] == 'q' || str[0] == 'Q')
             break;
 
- employee emp;
+ client::employee emp;
         std::string::const_iterator iter = str.begin();
         std::string::const_iterator end = str.end();
- bool r = phrase_parse(iter, end, g, emp, space);
+ bool r = phrase_parse(iter, end, g, space, emp);
 
         if (r && iter == end)
         {

Modified: branches/release/libs/spirit/example/qi/mini_c/mini_c.cpp
==============================================================================
--- branches/release/libs/spirit/example/qi/mini_c/mini_c.cpp (original)
+++ branches/release/libs/spirit/example/qi/mini_c/mini_c.cpp 2009-09-14 12:45:39 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)
@@ -85,7 +85,7 @@
     {
         std::string fmain("main");
         std::string::iterator fbegin = fmain.begin();
- function_info* f = prog.functions.lookup()->find(fbegin, fmain.end());
+ function_info* f = prog.functions.lookup->find(fbegin, fmain.end());
         if (f == 0)
         {
             std::cerr << "Error: main function not defined" << std::endl;

Modified: branches/release/libs/spirit/example/qi/mini_c/mini_c.hpp
==============================================================================
--- branches/release/libs/spirit/example/qi/mini_c/mini_c.hpp (original)
+++ branches/release/libs/spirit/example/qi/mini_c/mini_c.hpp 2009-09-14 12:45:39 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)
@@ -20,15 +20,14 @@
 #include <string>
 #include <vector>
 
-using namespace boost::spirit;
-using namespace boost::spirit::qi;
-using namespace boost::spirit::ascii;
-using namespace boost::spirit::arg_names;
-
 using boost::phoenix::function;
 using boost::phoenix::ref;
 using boost::phoenix::size;
 
+using namespace boost::spirit;
+using namespace boost::spirit::qi;
+using namespace boost::spirit::ascii;
+
 ///////////////////////////////////////////////////////////////////////////////
 // The Virtual Machine
 ///////////////////////////////////////////////////////////////////////////////
@@ -152,7 +151,7 @@
 
     template <typename Iterator>
     void operator()(
- std::string const& what
+ info const& what
       , Iterator err_pos, Iterator last) const
     {
         std::cout
@@ -270,15 +269,15 @@
       , symbols<char, int>& vars
       , symbols<char, function_info>& functions);
 
- typedef white_space<Iterator> white_space;
+ typedef white_space<Iterator> white_space_;
 
- rule<Iterator, white_space>
+ rule<Iterator, white_space_>
         expr, equality_expr, relational_expr
       , logical_expr, additive_expr, multiplicative_expr
       , unary_expr, primary_expr, variable
     ;
 
- rule<Iterator, locals<function_info, int>, white_space> function_call;
+ rule<Iterator, locals<function_info, int>, white_space_> function_call;
 
     std::vector<int>& code;
     symbols<char, int>& vars;
@@ -294,7 +293,7 @@
 {
     statement(std::vector<int>& code, symbols<char, function_info>& functions);
 
- typedef white_space<Iterator> white_space;
+ typedef white_space<Iterator> white_space_;
 
     std::vector<int>& code;
     symbols<char, int> vars;
@@ -303,16 +302,16 @@
     bool has_return;
 
     expression<Iterator> expr;
- rule<Iterator, white_space>
+ rule<Iterator, white_space_>
         statement_, statement_list, var_decl, compound_statement
       , return_statement;
 
- rule<Iterator, locals<int>, white_space> if_statement;
- rule<Iterator, locals<int, int>, white_space> while_statement;
- rule<Iterator, std::string(), white_space> identifier;
- rule<Iterator, int(), white_space> var_ref;
- rule<Iterator, locals<int>, white_space> assignment;
- rule<Iterator, void(int), white_space> assignment_rhs;
+ rule<Iterator, locals<int>, white_space_> if_statement;
+ rule<Iterator, locals<int, int>, white_space_> while_statement;
+ rule<Iterator, std::string(), white_space_> identifier;
+ rule<Iterator, int(), white_space_> var_ref;
+ rule<Iterator, locals<int>, white_space_> assignment;
+ rule<Iterator, void(int), white_space_> assignment_rhs;
 
     function<var_adder> add_var;
     function<compile_op> op;
@@ -326,11 +325,11 @@
 {
     program(std::vector<int>& code);
 
- typedef white_space<Iterator> white_space;
+ typedef white_space<Iterator> white_space_;
 
     std::vector<int>& code;
- rule<Iterator, std::string(), white_space> identifier;
- rule<Iterator, white_space> start;
+ rule<Iterator, std::string(), white_space_> identifier;
+ rule<Iterator, white_space_> start;
 
     typedef
         locals<
@@ -340,9 +339,9 @@
     function_locals;
 
     symbols<char, function_info> functions;
- statement<Iterator> statement;
+ statement<Iterator> statement_;
 
- rule<Iterator, function_locals, white_space> function;
+ rule<Iterator, function_locals, white_space_> function;
     boost::phoenix::function<function_adder> add_function;
     boost::phoenix::function<function_state_reset> state_reset;
     boost::phoenix::function<compile_op> op;

Modified: branches/release/libs/spirit/example/qi/mini_c/mini_ca.cpp
==============================================================================
--- branches/release/libs/spirit/example/qi/mini_c/mini_ca.cpp (original)
+++ branches/release/libs/spirit/example/qi/mini_c/mini_ca.cpp 2009-09-14 12:45:39 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)

Modified: branches/release/libs/spirit/example/qi/mini_c/mini_cb.cpp
==============================================================================
--- branches/release/libs/spirit/example/qi/mini_c/mini_cb.cpp (original)
+++ branches/release/libs/spirit/example/qi/mini_c/mini_cb.cpp 2009-09-14 12:45:39 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)

Modified: branches/release/libs/spirit/example/qi/mini_c/mini_cb.hpp
==============================================================================
--- branches/release/libs/spirit/example/qi/mini_c/mini_cb.hpp (original)
+++ branches/release/libs/spirit/example/qi/mini_c/mini_cb.hpp 2009-09-14 12:45:39 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)
@@ -96,7 +96,7 @@
                 expr [++_b]
>> *(',' > expr [++_b])
             )
- > char_(')') [op(_a, _b, pass)]
+ > lit(')') [op(_a, _b, _pass)]
         ;
 
     expr.name("expression");
@@ -110,7 +110,7 @@
     variable.name("variable");
     function_call.name("function-call");
 
- on_error<fail>(expr, error_handler(_4, _3, _2));
+ on_error<fail>(expr, ::error_handler(_4, _3, _2)); // $$$ fix!
 }
 
 #endif

Modified: branches/release/libs/spirit/example/qi/mini_c/mini_cc.cpp
==============================================================================
--- branches/release/libs/spirit/example/qi/mini_c/mini_cc.cpp (original)
+++ branches/release/libs/spirit/example/qi/mini_c/mini_cc.cpp 2009-09-14 12:45:39 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)

Modified: branches/release/libs/spirit/example/qi/mini_c/mini_cc.hpp
==============================================================================
--- branches/release/libs/spirit/example/qi/mini_c/mini_cc.hpp (original)
+++ branches/release/libs/spirit/example/qi/mini_c/mini_cc.hpp 2009-09-14 12:45:39 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)
@@ -50,7 +50,7 @@
 
     assignment_rhs =
             expr
- > char_(';') [op(op_store, _r1)]
+ > lit(';') [op(op_store, _r1)]
         ;
 
     if_statement =
@@ -137,7 +137,7 @@
     statement_.name("statement");
     statement_list.name("statement-list");
 
- on_error<fail>(statement_list, error_handler(_4, _3, _2));
+ on_error<fail>(statement_list, ::error_handler(_4, _3, _2));
 }
 
 #endif

Modified: branches/release/libs/spirit/example/qi/mini_c/mini_cd.cpp
==============================================================================
--- branches/release/libs/spirit/example/qi/mini_c/mini_cd.cpp (original)
+++ branches/release/libs/spirit/example/qi/mini_c/mini_cd.cpp 2009-09-14 12:45:39 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)

Modified: branches/release/libs/spirit/example/qi/mini_c/mini_cd.hpp
==============================================================================
--- branches/release/libs/spirit/example/qi/mini_c/mini_cd.hpp (original)
+++ branches/release/libs/spirit/example/qi/mini_c/mini_cd.hpp 2009-09-14 12:45:39 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)
@@ -16,14 +16,14 @@
 program<Iterator>::program(std::vector<int>& code)
   : program::base_type(start)
   , code(code)
- , statement(code, functions)
+ , statement_(code, functions)
   , add_function(function_adder(functions))
- , state_reset(function_state_reset(code, statement.vars, statement.nvars))
+ , state_reset(function_state_reset(code, statement_.vars, statement_.nvars))
   , op(code)
 {
- bool& has_return = statement.has_return;
- int& nvars = statement.nvars;
- boost::phoenix::function<var_adder>& add_var = statement.add_var;
+ bool& has_return = statement_.has_return;
+ int& nvars = statement_.nvars;
+ boost::phoenix::function<var_adder>& add_var = statement_.add_var;
 
     identifier %=
         raw[lexeme[alpha >> *(alnum | '_')]]
@@ -42,7 +42,7 @@
>> *(',' > identifier [add_var(_1)])
             )
> ')'
- > char_('{') [
+ > lit('{') [
                                                     _b = size(ref(code)),
                                                     add_function(
                                                         _a // function name
@@ -51,8 +51,8 @@
                                                     ),
                                                     op(op_stk_adj, 0) // adjust this later
                                                 ]
- > statement
- > char_('}') [state_reset(_b)]
+ > statement_
+ > lit('}') [state_reset(_b)]
         ;
 
     start =
@@ -63,7 +63,7 @@
     function.name("function");
     start.name("program");
 
- on_error<fail>(start, error_handler(_4, _3, _2));
+ on_error<fail>(start, ::error_handler(_4, _3, _2));
 }
 
 #endif

Modified: branches/release/libs/spirit/example/qi/mini_xml1.cpp
==============================================================================
--- branches/release/libs/spirit/example/qi/mini_xml1.cpp (original)
+++ branches/release/libs/spirit/example/qi/mini_xml1.cpp 2009-09-14 12:45:39 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)
@@ -27,147 +27,156 @@
 #include <string>
 #include <vector>
 
-using namespace boost::spirit;
-using namespace boost::spirit::qi;
-using namespace boost::spirit::ascii;
-using namespace boost::spirit::arg_names;
-
-namespace fusion = boost::fusion;
-namespace phoenix = boost::phoenix;
-
-using phoenix::at_c;
-using phoenix::push_back;
-
-///////////////////////////////////////////////////////////////////////////////
-// Our mini XML tree representation
-///////////////////////////////////////////////////////////////////////////////
-//[tutorial_xml1_structures
-struct mini_xml;
-
-typedef
- boost::variant<
- boost::recursive_wrapper<mini_xml>
- , std::string
- >
-mini_xml_node;
-
-struct mini_xml
+namespace client
 {
- std::string name; // tag name
- std::vector<mini_xml_node> children; // children
-};
-//]
+ namespace fusion = boost::fusion;
+ namespace phoenix = boost::phoenix;
+ namespace qi = boost::spirit::qi;
+ namespace ascii = boost::spirit::ascii;
+
+ ///////////////////////////////////////////////////////////////////////////
+ // Our mini XML tree representation
+ ///////////////////////////////////////////////////////////////////////////
+ //[tutorial_xml1_structures
+ struct mini_xml;
+
+ typedef
+ boost::variant<
+ boost::recursive_wrapper<mini_xml>
+ , std::string
+ >
+ mini_xml_node;
+
+ struct mini_xml
+ {
+ std::string name; // tag name
+ std::vector<mini_xml_node> children; // children
+ };
+ //]
+}
 
 // We need to tell fusion about our mini_xml struct
 // to make it a first-class fusion citizen
 //[tutorial_xml1_adapt_structures
 BOOST_FUSION_ADAPT_STRUCT(
- mini_xml,
+ client::mini_xml,
     (std::string, name)
- (std::vector<mini_xml_node>, children)
+ (std::vector<client::mini_xml_node>, children)
 )
 //]
 
-///////////////////////////////////////////////////////////////////////////////
-// Print out the mini xml tree
-///////////////////////////////////////////////////////////////////////////////
-int const tabsize = 4;
-
-void tab(int indent)
+namespace client
 {
- for (int i = 0; i < indent; ++i)
- std::cout << ' ';
+ ///////////////////////////////////////////////////////////////////////////
+ // Print out the mini xml tree
+ ///////////////////////////////////////////////////////////////////////////
+ int const tabsize = 4;
+
+ void tab(int indent)
+ {
+ for (int i = 0; i < indent; ++i)
+ std::cout << ' ';
+ }
+
+ struct mini_xml_printer
+ {
+ mini_xml_printer(int indent = 0)
+ : indent(indent)
+ {
+ }
+
+ void operator()(mini_xml const& xml) const;
+
+ int indent;
+ };
+
+ struct mini_xml_node_printer : boost::static_visitor<>
+ {
+ mini_xml_node_printer(int indent = 0)
+ : indent(indent)
+ {
+ }
+
+ void operator()(mini_xml const& xml) const
+ {
+ mini_xml_printer(indent+tabsize)(xml);
+ }
+
+ void operator()(std::string const& text) const
+ {
+ tab(indent+tabsize);
+ std::cout << "text: \"" << text << '"' << std::endl;
+ }
+
+ int indent;
+ };
+
+ void mini_xml_printer::operator()(mini_xml const& xml) const
+ {
+ tab(indent);
+ std::cout << "tag: " << xml.name << std::endl;
+ tab(indent);
+ std::cout << '{' << std::endl;
+
+ BOOST_FOREACH(mini_xml_node const& node, xml.children)
+ {
+ boost::apply_visitor(mini_xml_node_printer(indent), node);
+ }
+
+ tab(indent);
+ std::cout << '}' << std::endl;
+ }
+
+ ///////////////////////////////////////////////////////////////////////////
+ // Our mini XML grammar definition
+ ///////////////////////////////////////////////////////////////////////////
+ //[tutorial_xml1_grammar
+ template <typename Iterator>
+ struct mini_xml_grammar : qi::grammar<Iterator, mini_xml(), ascii::space_type>
+ {
+ mini_xml_grammar() : mini_xml_grammar::base_type(xml)
+ {
+ using qi::lit;
+ using qi::lexeme;
+ using ascii::char_;
+ using ascii::string;
+ using namespace qi::labels;
+
+ using phoenix::at_c;
+ using phoenix::push_back;
+
+ text = lexeme[+(char_ - '<') [_val += _1]];
+ node = (xml | text) [_val = _1];
+
+ start_tag =
+ '<'
+ >> !lit('/')
+ >> lexeme[+(char_ - '>') [_val += _1]]
+ >> '>'
+ ;
+
+ end_tag =
+ "</"
+ >> string(_r1)
+ >> '>'
+ ;
+
+ xml =
+ start_tag [at_c<0>(_val) = _1]
+ >> *node [push_back(at_c<1>(_val), _1)]
+ >> end_tag(at_c<0>(_val))
+ ;
+ }
+
+ qi::rule<Iterator, mini_xml(), ascii::space_type> xml;
+ qi::rule<Iterator, mini_xml_node(), ascii::space_type> node;
+ qi::rule<Iterator, std::string(), ascii::space_type> text;
+ qi::rule<Iterator, std::string(), ascii::space_type> start_tag;
+ qi::rule<Iterator, void(std::string), ascii::space_type> end_tag;
+ };
+ //]
 }
 
-struct mini_xml_printer
-{
- mini_xml_printer(int indent = 0)
- : indent(indent)
- {
- }
-
- void operator()(mini_xml const& xml) const;
-
- int indent;
-};
-
-struct mini_xml_node_printer : boost::static_visitor<>
-{
- mini_xml_node_printer(int indent = 0)
- : indent(indent)
- {
- }
-
- void operator()(mini_xml const& xml) const
- {
- mini_xml_printer(indent+tabsize)(xml);
- }
-
- void operator()(std::string const& text) const
- {
- tab(indent+tabsize);
- std::cout << "text: \"" << text << '"' << std::endl;
- }
-
- int indent;
-};
-
-void mini_xml_printer::operator()(mini_xml const& xml) const
-{
- tab(indent);
- std::cout << "tag: " << xml.name << std::endl;
- tab(indent);
- std::cout << '{' << std::endl;
-
- BOOST_FOREACH(mini_xml_node const& node, xml.children)
- {
- boost::apply_visitor(mini_xml_node_printer(indent), node);
- }
-
- tab(indent);
- std::cout << '}' << std::endl;
-}
-
-///////////////////////////////////////////////////////////////////////////////
-// Our mini XML grammar definition
-///////////////////////////////////////////////////////////////////////////////
-//[tutorial_xml1_grammar
-template <typename Iterator>
-struct mini_xml_grammar : grammar<Iterator, mini_xml(), space_type>
-{
- mini_xml_grammar() : mini_xml_grammar::base_type(xml)
- {
- text = lexeme[+(char_ - '<') [_val += _1]];
- node = (xml | text) [_val = _1];
-
- start_tag =
- '<'
- >> !char_('/')
- >> lexeme[+(char_ - '>') [_val += _1]]
- >> '>'
- ;
-
- end_tag =
- "</"
- >> lit(_r1)
- >> '>'
- ;
-
- xml =
- start_tag [at_c<0>(_val) = _1]
- >> *node [push_back(at_c<1>(_val), _1)]
- >> end_tag(at_c<0>(_val))
- ;
- }
-
- rule<Iterator, mini_xml(), space_type> xml;
- rule<Iterator, mini_xml_node(), space_type> node;
- rule<Iterator, std::string(), space_type> text;
- rule<Iterator, std::string(), space_type> start_tag;
- rule<Iterator, void(std::string), space_type> end_tag;
-};
-//]
-
 ///////////////////////////////////////////////////////////////////////////////
 // Main program
 ///////////////////////////////////////////////////////////////////////////////
@@ -200,20 +209,21 @@
         std::istream_iterator<char>(),
         std::back_inserter(storage));
 
- typedef mini_xml_grammar<std::string::const_iterator> mini_xml_grammar;
+ typedef client::mini_xml_grammar<std::string::const_iterator> mini_xml_grammar;
     mini_xml_grammar xml; // Our grammar
- mini_xml ast; // our tree
+ client::mini_xml ast; // Our tree
 
+ using boost::spirit::ascii::space;
     std::string::const_iterator iter = storage.begin();
     std::string::const_iterator end = storage.end();
- bool r = phrase_parse(iter, end, xml, ast, space);
+ bool r = phrase_parse(iter, end, xml, space, ast);
 
     if (r && iter == end)
     {
         std::cout << "-------------------------\n";
         std::cout << "Parsing succeeded\n";
         std::cout << "-------------------------\n";
- mini_xml_printer printer;
+ client::mini_xml_printer printer;
         printer(ast);
         return 0;
     }

Modified: branches/release/libs/spirit/example/qi/mini_xml2.cpp
==============================================================================
--- branches/release/libs/spirit/example/qi/mini_xml2.cpp (original)
+++ branches/release/libs/spirit/example/qi/mini_xml2.cpp 2009-09-14 12:45:39 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)
@@ -27,145 +27,151 @@
 #include <string>
 #include <vector>
 
-using namespace boost::spirit;
-using namespace boost::spirit::qi;
-using namespace boost::spirit::ascii;
-using namespace boost::spirit::arg_names;
-
-namespace fusion = boost::fusion;
-namespace phoenix = boost::phoenix;
-
-using phoenix::at_c;
-using phoenix::push_back;
-
-///////////////////////////////////////////////////////////////////////////////
-// Our mini XML tree representation
-///////////////////////////////////////////////////////////////////////////////
-struct mini_xml;
-
-typedef
- boost::variant<
- boost::recursive_wrapper<mini_xml>
- , std::string
- >
-mini_xml_node;
-
-struct mini_xml
+namespace client
 {
- std::string name; // tag name
- std::vector<mini_xml_node> children; // children
-};
+ namespace fusion = boost::fusion;
+ namespace phoenix = boost::phoenix;
+ namespace qi = boost::spirit::qi;
+ namespace ascii = boost::spirit::ascii;
+
+ ///////////////////////////////////////////////////////////////////////////
+ // Our mini XML tree representation
+ ///////////////////////////////////////////////////////////////////////////
+ struct mini_xml;
+
+ typedef
+ boost::variant<
+ boost::recursive_wrapper<mini_xml>
+ , std::string
+ >
+ mini_xml_node;
+
+ struct mini_xml
+ {
+ std::string name; // tag name
+ std::vector<mini_xml_node> children; // children
+ };
+}
 
 // We need to tell fusion about our mini_xml struct
 // to make it a first-class fusion citizen
 BOOST_FUSION_ADAPT_STRUCT(
- mini_xml,
+ client::mini_xml,
     (std::string, name)
- (std::vector<mini_xml_node>, children)
+ (std::vector<client::mini_xml_node>, children)
 )
 
-///////////////////////////////////////////////////////////////////////////////
-// Print out the mini xml tree
-///////////////////////////////////////////////////////////////////////////////
-int const tabsize = 4;
-
-void tab(int indent)
+namespace client
 {
- for (int i = 0; i < indent; ++i)
- std::cout << ' ';
+ ///////////////////////////////////////////////////////////////////////////
+ // Print out the mini xml tree
+ ///////////////////////////////////////////////////////////////////////////
+ int const tabsize = 4;
+
+ void tab(int indent)
+ {
+ for (int i = 0; i < indent; ++i)
+ std::cout << ' ';
+ }
+
+ struct mini_xml_printer
+ {
+ mini_xml_printer(int indent = 0)
+ : indent(indent)
+ {
+ }
+
+ void operator()(mini_xml const& xml) const;
+
+ int indent;
+ };
+
+ struct mini_xml_node_printer : boost::static_visitor<>
+ {
+ mini_xml_node_printer(int indent = 0)
+ : indent(indent)
+ {
+ }
+
+ void operator()(mini_xml const& xml) const
+ {
+ mini_xml_printer(indent+tabsize)(xml);
+ }
+
+ void operator()(std::string const& text) const
+ {
+ tab(indent+tabsize);
+ std::cout << "text: \"" << text << '"' << std::endl;
+ }
+
+ int indent;
+ };
+
+ void mini_xml_printer::operator()(mini_xml const& xml) const
+ {
+ tab(indent);
+ std::cout << "tag: " << xml.name << std::endl;
+ tab(indent);
+ std::cout << '{' << std::endl;
+
+ BOOST_FOREACH(mini_xml_node const& node, xml.children)
+ {
+ boost::apply_visitor(mini_xml_node_printer(indent), node);
+ }
+
+ tab(indent);
+ std::cout << '}' << std::endl;
+ }
+
+ ///////////////////////////////////////////////////////////////////////////
+ // Our mini XML grammar definition
+ ///////////////////////////////////////////////////////////////////////////
+ //[tutorial_xml2_grammar
+ template <typename Iterator>
+ struct mini_xml_grammar
+ : qi::grammar<Iterator, mini_xml(), qi::locals<std::string>, ascii::space_type>
+ {
+ mini_xml_grammar()
+ : mini_xml_grammar::base_type(xml)
+ {
+ using qi::lit;
+ using qi::lexeme;
+ using ascii::char_;
+ using ascii::string;
+ using namespace qi::labels;
+
+ text %= lexeme[+(char_ - '<')];
+ node %= xml | text;
+
+ start_tag %=
+ '<'
+ >> !lit('/')
+ >> lexeme[+(char_ - '>')]
+ >> '>'
+ ;
+
+ end_tag =
+ "</"
+ >> string(_r1)
+ >> '>'
+ ;
+
+ xml %=
+ start_tag[_a = _1]
+ >> *node
+ >> end_tag(_a)
+ ;
+ }
+
+ qi::rule<Iterator, mini_xml(), qi::locals<std::string>, ascii::space_type> xml;
+ qi::rule<Iterator, mini_xml_node(), ascii::space_type> node;
+ qi::rule<Iterator, std::string(), ascii::space_type> text;
+ qi::rule<Iterator, std::string(), ascii::space_type> start_tag;
+ qi::rule<Iterator, void(std::string), ascii::space_type> end_tag;
+ };
+ //]
 }
 
-struct mini_xml_printer
-{
- mini_xml_printer(int indent = 0)
- : indent(indent)
- {
- }
-
- void operator()(mini_xml const& xml) const;
-
- int indent;
-};
-
-struct mini_xml_node_printer : boost::static_visitor<>
-{
- mini_xml_node_printer(int indent = 0)
- : indent(indent)
- {
- }
-
- void operator()(mini_xml const& xml) const
- {
- mini_xml_printer(indent+tabsize)(xml);
- }
-
- void operator()(std::string const& text) const
- {
- tab(indent+tabsize);
- std::cout << "text: \"" << text << '"' << std::endl;
- }
-
- int indent;
-};
-
-void mini_xml_printer::operator()(mini_xml const& xml) const
-{
- tab(indent);
- std::cout << "tag: " << xml.name << std::endl;
- tab(indent);
- std::cout << '{' << std::endl;
-
- BOOST_FOREACH(mini_xml_node const& node, xml.children)
- {
- boost::apply_visitor(mini_xml_node_printer(indent), node);
- }
-
- tab(indent);
- std::cout << '}' << std::endl;
-}
-
-///////////////////////////////////////////////////////////////////////////////
-// Our mini XML grammar definition
-///////////////////////////////////////////////////////////////////////////////
-//[tutorial_xml2_grammar
-template <typename Iterator>
-struct mini_xml_grammar
- : grammar<Iterator, mini_xml(), locals<std::string>, space_type>
-{
- mini_xml_grammar()
- : mini_xml_grammar::base_type(xml)
- {
- text %= lexeme[+(char_ - '<')];
- node %= xml | text;
-
- start_tag %=
- '<'
- >> !char_('/')
- >> lexeme[+(char_ - '>')]
- >> '>'
- ;
-
- end_tag =
- "</"
- >> lit(_r1)
- >> '>'
- ;
-
- xml %=
- start_tag[_a = _1]
- >> *node
- >> end_tag(_a)
- ;
- }
-
- rule<Iterator, mini_xml(), locals<std::string>, space_type> xml;
- rule<Iterator, mini_xml_node(), space_type> node;
- rule<Iterator, std::string(), space_type> text;
- rule<Iterator, std::string(), space_type> start_tag;
- rule<Iterator, void(std::string), space_type> end_tag;
-};
-//]
-
 ///////////////////////////////////////////////////////////////////////////////
 // Main program
 ///////////////////////////////////////////////////////////////////////////////
@@ -198,20 +204,21 @@
         std::istream_iterator<char>(),
         std::back_inserter(storage));
 
- typedef mini_xml_grammar<std::string::const_iterator> mini_xml_grammar;
+ typedef client::mini_xml_grammar<std::string::const_iterator> mini_xml_grammar;
     mini_xml_grammar xml; // Our grammar
- mini_xml ast; // our tree
+ client::mini_xml ast; // Our tree
 
+ using boost::spirit::ascii::space;
     std::string::const_iterator iter = storage.begin();
     std::string::const_iterator end = storage.end();
- bool r = phrase_parse(iter, end, xml, ast, space);
+ bool r = phrase_parse(iter, end, xml, space, ast);
 
     if (r && iter == end)
     {
         std::cout << "-------------------------\n";
         std::cout << "Parsing succeeded\n";
         std::cout << "-------------------------\n";
- mini_xml_printer printer;
+ client::mini_xml_printer printer;
         printer(ast);
         return 0;
     }

Modified: branches/release/libs/spirit/example/qi/mini_xml3.cpp
==============================================================================
--- branches/release/libs/spirit/example/qi/mini_xml3.cpp (original)
+++ branches/release/libs/spirit/example/qi/mini_xml3.cpp 2009-09-14 12:45:39 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)
@@ -28,165 +28,174 @@
 #include <string>
 #include <vector>
 
-using namespace boost::spirit;
-using namespace boost::spirit::qi;
-using namespace boost::spirit::ascii;
-using namespace boost::spirit::arg_names;
-
-namespace fusion = boost::fusion;
-namespace phoenix = boost::phoenix;
-
-using phoenix::at_c;
-using phoenix::push_back;
-using phoenix::val;
-using phoenix::construct;
-
-///////////////////////////////////////////////////////////////////////////////
-// Our mini XML tree representation
-///////////////////////////////////////////////////////////////////////////////
-struct mini_xml;
-
-typedef
- boost::variant<
- boost::recursive_wrapper<mini_xml>
- , std::string
- >
-mini_xml_node;
-
-struct mini_xml
+namespace client
 {
- std::string name; // tag name
- std::vector<mini_xml_node> children; // children
-};
+ namespace fusion = boost::fusion;
+ namespace phoenix = boost::phoenix;
+ namespace qi = boost::spirit::qi;
+ namespace ascii = boost::spirit::ascii;
+
+ ///////////////////////////////////////////////////////////////////////////
+ // Our mini XML tree representation
+ ///////////////////////////////////////////////////////////////////////////
+ struct mini_xml;
+
+ typedef
+ boost::variant<
+ boost::recursive_wrapper<mini_xml>
+ , std::string
+ >
+ mini_xml_node;
+
+ struct mini_xml
+ {
+ std::string name; // tag name
+ std::vector<mini_xml_node> children; // children
+ };
+}
 
 // We need to tell fusion about our mini_xml struct
 // to make it a first-class fusion citizen
 BOOST_FUSION_ADAPT_STRUCT(
- mini_xml,
+ client::mini_xml,
     (std::string, name)
- (std::vector<mini_xml_node>, children)
+ (std::vector<client::mini_xml_node>, children)
 )
 
-///////////////////////////////////////////////////////////////////////////////
-// Print out the mini xml tree
-///////////////////////////////////////////////////////////////////////////////
-int const tabsize = 4;
-
-void tab(int indent)
+namespace client
 {
- for (int i = 0; i < indent; ++i)
- std::cout << ' ';
+ ///////////////////////////////////////////////////////////////////////////
+ // Print out the mini xml tree
+ ///////////////////////////////////////////////////////////////////////////
+ int const tabsize = 4;
+
+ void tab(int indent)
+ {
+ for (int i = 0; i < indent; ++i)
+ std::cout << ' ';
+ }
+
+ struct mini_xml_printer
+ {
+ mini_xml_printer(int indent = 0)
+ : indent(indent)
+ {
+ }
+
+ void operator()(mini_xml const& xml) const;
+
+ int indent;
+ };
+
+ struct mini_xml_node_printer : boost::static_visitor<>
+ {
+ mini_xml_node_printer(int indent = 0)
+ : indent(indent)
+ {
+ }
+
+ void operator()(mini_xml const& xml) const
+ {
+ mini_xml_printer(indent+tabsize)(xml);
+ }
+
+ void operator()(std::string const& text) const
+ {
+ tab(indent+tabsize);
+ std::cout << "text: \"" << text << '"' << std::endl;
+ }
+
+ int indent;
+ };
+
+ void mini_xml_printer::operator()(mini_xml const& xml) const
+ {
+ tab(indent);
+ std::cout << "tag: " << xml.name << std::endl;
+ tab(indent);
+ std::cout << '{' << std::endl;
+
+ BOOST_FOREACH(mini_xml_node const& node, xml.children)
+ {
+ boost::apply_visitor(mini_xml_node_printer(indent), node);
+ }
+
+ tab(indent);
+ std::cout << '}' << std::endl;
+ }
+
+ ///////////////////////////////////////////////////////////////////////////
+ // Our mini XML grammar definition
+ ///////////////////////////////////////////////////////////////////////////
+ //[tutorial_xml3_grammar
+ template <typename Iterator>
+ struct mini_xml_grammar
+ : qi::grammar<Iterator, mini_xml(), qi::locals<std::string>, ascii::space_type>
+ {
+ mini_xml_grammar()
+ : mini_xml_grammar::base_type(xml, "xml")
+ {
+ using qi::lit;
+ using qi::lexeme;
+ using qi::on_error;
+ using qi::fail;
+ using ascii::char_;
+ using ascii::string;
+ using namespace qi::labels;
+
+ using phoenix::construct;
+ using phoenix::val;
+
+ text %= lexeme[+(char_ - '<')];
+ node %= xml | text;
+
+ start_tag %=
+ '<'
+ >> !lit('/')
+ > lexeme[+(char_ - '>')]
+ > '>'
+ ;
+
+ end_tag =
+ "</"
+ > string(_r1)
+ > '>'
+ ;
+
+ xml %=
+ start_tag[_a = _1]
+ > *node
+ > end_tag(_a)
+ ;
+
+ xml.name("xml");
+ node.name("node");
+ text.name("text");
+ start_tag.name("start_tag");
+ end_tag.name("end_tag");
+
+ on_error<fail>
+ (
+ xml
+ , std::cout
+ << val("Error! Expecting ")
+ << _4 // what failed?
+ << val(" here: \"")
+ << construct<std::string>(_3, _2) // iterators to error-pos, end
+ << val("\"")
+ << std::endl
+ );
+ }
+
+ qi::rule<Iterator, mini_xml(), qi::locals<std::string>, ascii::space_type> xml;
+ qi::rule<Iterator, mini_xml_node(), ascii::space_type> node;
+ qi::rule<Iterator, std::string(), ascii::space_type> text;
+ qi::rule<Iterator, std::string(), ascii::space_type> start_tag;
+ qi::rule<Iterator, void(std::string), ascii::space_type> end_tag;
+ };
+ //]
 }
 
-struct mini_xml_printer
-{
- mini_xml_printer(int indent = 0)
- : indent(indent)
- {
- }
-
- void operator()(mini_xml const& xml) const;
-
- int indent;
-};
-
-struct mini_xml_node_printer : boost::static_visitor<>
-{
- mini_xml_node_printer(int indent = 0)
- : indent(indent)
- {
- }
-
- void operator()(mini_xml const& xml) const
- {
- mini_xml_printer(indent+tabsize)(xml);
- }
-
- void operator()(std::string const& text) const
- {
- tab(indent+tabsize);
- std::cout << "text: \"" << text << '"' << std::endl;
- }
-
- int indent;
-};
-
-void mini_xml_printer::operator()(mini_xml const& xml) const
-{
- tab(indent);
- std::cout << "tag: " << xml.name << std::endl;
- tab(indent);
- std::cout << '{' << std::endl;
-
- BOOST_FOREACH(mini_xml_node const& node, xml.children)
- {
- boost::apply_visitor(mini_xml_node_printer(indent), node);
- }
-
- tab(indent);
- std::cout << '}' << std::endl;
-}
-
-///////////////////////////////////////////////////////////////////////////////
-// Our mini XML grammar definition
-///////////////////////////////////////////////////////////////////////////////
-//[tutorial_xml3_grammar
-template <typename Iterator>
-struct mini_xml_grammar
- : grammar<Iterator, mini_xml(), locals<std::string>, space_type>
-{
- mini_xml_grammar()
- : mini_xml_grammar::base_type(xml, "xml")
- {
- text %= lexeme[+(char_ - '<')];
- node %= xml | text;
-
- start_tag %=
- '<'
- >> !char_('/')
- > lexeme[+(char_ - '>')]
- > '>'
- ;
-
- end_tag =
- "</"
- > lit(_r1)
- > '>'
- ;
-
- xml %=
- start_tag[_a = _1]
- > *node
- > end_tag(_a)
- ;
-
- xml.name("xml");
- node.name("node");
- text.name("text");
- start_tag.name("start_tag");
- end_tag.name("end_tag");
-
- on_error<fail>
- (
- xml
- , std::cout
- << val("Error! Expecting ")
- << _4 // what failed?
- << val(" here: \"")
- << construct<std::string>(_3, _2) // iterators to error-pos, end
- << val("\"")
- << std::endl
- );
- }
-
- rule<Iterator, mini_xml(), locals<std::string>, space_type> xml;
- rule<Iterator, mini_xml_node(), space_type> node;
- rule<Iterator, std::string(), space_type> text;
- rule<Iterator, std::string(), space_type> start_tag;
- rule<Iterator, void(std::string), space_type> end_tag;
-};
-//]
-
 ///////////////////////////////////////////////////////////////////////////////
 // Main program
 ///////////////////////////////////////////////////////////////////////////////
@@ -219,20 +228,21 @@
         std::istream_iterator<char>(),
         std::back_inserter(storage));
 
- typedef mini_xml_grammar<std::string::const_iterator> mini_xml_grammar;
+ typedef client::mini_xml_grammar<std::string::const_iterator> mini_xml_grammar;
     mini_xml_grammar xml; // Our grammar
- mini_xml ast; // our tree
+ client::mini_xml ast; // Our tree
 
+ using boost::spirit::ascii::space;
     std::string::const_iterator iter = storage.begin();
     std::string::const_iterator end = storage.end();
- bool r = phrase_parse(iter, end, xml, ast, space);
+ bool r = phrase_parse(iter, end, xml, space, ast);
 
     if (r && iter == end)
     {
         std::cout << "-------------------------\n";
         std::cout << "Parsing succeeded\n";
         std::cout << "-------------------------\n";
- mini_xml_printer printer;
+ client::mini_xml_printer printer;
         printer(ast);
         return 0;
     }

Modified: branches/release/libs/spirit/example/qi/num_list1.cpp
==============================================================================
--- branches/release/libs/spirit/example/qi/num_list1.cpp (original)
+++ branches/release/libs/spirit/example/qi/num_list1.cpp 2009-09-14 12:45:39 EDT (Mon, 14 Sep 2009)
@@ -1,5 +1,5 @@
 /*=============================================================================
- Copyright (c) 2002-2007 Joel de Guzman
+ Copyright (c) 2002-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)
@@ -21,30 +21,34 @@
 #include <string>
 #include <vector>
 
-using namespace boost::phoenix;
-using namespace boost::spirit;
-using namespace boost::spirit::qi;
-using namespace boost::spirit::ascii;
-using namespace boost::spirit::arg_names;
-
-///////////////////////////////////////////////////////////////////////////////
-// Our number list parser
-///////////////////////////////////////////////////////////////////////////////
-//[tutorial_numlist1
-template <typename Iterator>
-bool parse_numbers(Iterator first, Iterator last)
+namespace client
 {
- bool r = phrase_parse(
- first, /*< start iterator >*/
- last, /*< end iterator >*/
- double_ >> *(',' >> double_), /*< the parser >*/
- space /*< the skip-parser >*/
- );
- if (first != last) // fail if we did not get a full match
- return false;
- return r;
+ namespace qi = boost::spirit::qi;
+ namespace ascii = boost::spirit::ascii;
+
+ ///////////////////////////////////////////////////////////////////////////
+ // Our number list parser
+ ///////////////////////////////////////////////////////////////////////////
+ //[tutorial_numlist1
+ template <typename Iterator>
+ bool parse_numbers(Iterator first, Iterator last)
+ {
+ using qi::double_;
+ using qi::phrase_parse;
+ using ascii::space;
+
+ bool r = phrase_parse(
+ first, /*< start iterator >*/
+ last, /*< end iterator >*/
+ double_ >> *(',' >> double_), /*< the parser >*/
+ space /*< the skip-parser >*/
+ );
+ if (first != last) // fail if we did not get a full match
+ return false;
+ return r;
+ }
+ //]
 }
-//]
 
 ////////////////////////////////////////////////////////////////////////////
 // Main program
@@ -65,7 +69,7 @@
         if (str.empty() || str[0] == 'q' || str[0] == 'Q')
             break;
 
- if (parse_numbers(str.begin(), str.end()))
+ if (client::parse_numbers(str.begin(), str.end()))
         {
             std::cout << "-------------------------\n";
             std::cout << "Parsing succeeded\n";

Modified: branches/release/libs/spirit/example/qi/num_list2.cpp
==============================================================================
--- branches/release/libs/spirit/example/qi/num_list2.cpp (original)
+++ branches/release/libs/spirit/example/qi/num_list2.cpp 2009-09-14 12:45:39 EDT (Mon, 14 Sep 2009)
@@ -1,5 +1,5 @@
 /*=============================================================================
- Copyright (c) 2002-2007 Joel de Guzman
+ Copyright (c) 2002-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)
@@ -24,36 +24,44 @@
 #include <string>
 #include <vector>
 
-using namespace boost::phoenix;
-using namespace boost::spirit;
-using namespace boost::spirit::qi;
-using namespace boost::spirit::ascii;
-using namespace boost::spirit::arg_names;
-
-///////////////////////////////////////////////////////////////////////////////
-// Our number list compiler
-///////////////////////////////////////////////////////////////////////////////
-//[tutorial_numlist2
-template <typename Iterator>
-bool parse_numbers(Iterator first, Iterator last, std::vector<double>& v)
+namespace client
 {
- bool r = phrase_parse(first, last,
-
- // Begin grammar
- (
- double_[push_back(ref(v), _1)]
- >> *(',' >> double_[push_back(ref(v), _1)])
- )
- ,
- // End grammar
-
- space);
-
- if (first != last) // fail if we did not get a full match
- return false;
- return r;
+ namespace qi = boost::spirit::qi;
+ namespace ascii = boost::spirit::ascii;
+ namespace phoenix = boost::phoenix;
+
+ ///////////////////////////////////////////////////////////////////////////
+ // Our number list compiler
+ ///////////////////////////////////////////////////////////////////////////
+ //[tutorial_numlist2
+ template <typename Iterator>
+ bool parse_numbers(Iterator first, Iterator last, std::vector<double>& v)
+ {
+ using qi::double_;
+ using qi::phrase_parse;
+ using qi::_1;
+ using ascii::space;
+ using phoenix::push_back;
+ using phoenix::ref;
+
+ bool r = phrase_parse(first, last,
+
+ // Begin grammar
+ (
+ double_[push_back(ref(v), _1)]
+ >> *(',' >> double_[push_back(ref(v), _1)])
+ )
+ ,
+ // End grammar
+
+ space);
+
+ if (first != last) // fail if we did not get a full match
+ return false;
+ return r;
+ }
+ //]
 }
-//]
 
 ////////////////////////////////////////////////////////////////////////////
 // Main program
@@ -76,7 +84,7 @@
             break;
 
         std::vector<double> v;
- if (parse_numbers(str.begin(), str.end(), v))
+ if (client::parse_numbers(str.begin(), str.end(), v))
         {
             std::cout << "-------------------------\n";
             std::cout << "Parsing succeeded\n";

Modified: branches/release/libs/spirit/example/qi/num_list3.cpp
==============================================================================
--- branches/release/libs/spirit/example/qi/num_list3.cpp (original)
+++ branches/release/libs/spirit/example/qi/num_list3.cpp 2009-09-14 12:45:39 EDT (Mon, 14 Sep 2009)
@@ -1,5 +1,5 @@
 /*=============================================================================
- Copyright (c) 2002-2007 Joel de Guzman
+ Copyright (c) 2002-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)
@@ -24,35 +24,43 @@
 #include <string>
 #include <vector>
 
-using namespace boost::phoenix;
-using namespace boost::spirit;
-using namespace boost::spirit::qi;
-using namespace boost::spirit::ascii;
-using namespace boost::spirit::arg_names;
-
-///////////////////////////////////////////////////////////////////////////////
-// Our number list compiler
-///////////////////////////////////////////////////////////////////////////////
-//[tutorial_numlist3
-template <typename Iterator>
-bool parse_numbers(Iterator first, Iterator last, std::vector<double>& v)
+namespace client
 {
- bool r = phrase_parse(first, last,
-
- // Begin grammar
- (
- double_[push_back(ref(v), _1)] % ','
- )
- ,
- // End grammar
-
- space);
-
- if (first != last) // fail if we did not get a full match
- return false;
- return r;
+ namespace qi = boost::spirit::qi;
+ namespace ascii = boost::spirit::ascii;
+ namespace phoenix = boost::phoenix;
+
+ ///////////////////////////////////////////////////////////////////////////////
+ // Our number list compiler
+ ///////////////////////////////////////////////////////////////////////////////
+ //[tutorial_numlist3
+ template <typename Iterator>
+ bool parse_numbers(Iterator first, Iterator last, std::vector<double>& v)
+ {
+ using qi::double_;
+ using qi::phrase_parse;
+ using qi::_1;
+ using ascii::space;
+ using phoenix::push_back;
+ using phoenix::ref;
+
+ bool r = phrase_parse(first, last,
+
+ // Begin grammar
+ (
+ double_[push_back(ref(v), _1)] % ','
+ )
+ ,
+ // End grammar
+
+ space);
+
+ if (first != last) // fail if we did not get a full match
+ return false;
+ return r;
+ }
+ //]
 }
-//]
 
 ////////////////////////////////////////////////////////////////////////////
 // Main program
@@ -75,7 +83,7 @@
             break;
 
         std::vector<double> v;
- if (parse_numbers(str.begin(), str.end(), v))
+ if (client::parse_numbers(str.begin(), str.end(), v))
         {
             std::cout << "-------------------------\n";
             std::cout << "Parsing succeeded\n";

Modified: branches/release/libs/spirit/example/qi/num_list4.cpp
==============================================================================
--- branches/release/libs/spirit/example/qi/num_list4.cpp (original)
+++ branches/release/libs/spirit/example/qi/num_list4.cpp 2009-09-14 12:45:39 EDT (Mon, 14 Sep 2009)
@@ -1,5 +1,5 @@
 /*=============================================================================
- Copyright (c) 2002-2007 Joel de Guzman
+ Copyright (c) 2002-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)
@@ -24,35 +24,40 @@
 #include <string>
 #include <vector>
 
-using namespace boost::phoenix;
-using namespace boost::spirit;
-using namespace boost::spirit::qi;
-using namespace boost::spirit::ascii;
-using namespace boost::spirit::arg_names;
-
-///////////////////////////////////////////////////////////////////////////////
-// Our number list compiler
-///////////////////////////////////////////////////////////////////////////////
-//[tutorial_numlist4
-template <typename Iterator>
-bool parse_numbers(Iterator first, Iterator last, std::vector<double>& v)
+namespace client
 {
- bool r = phrase_parse(first, last,
+ namespace qi = boost::spirit::qi;
+ namespace ascii = boost::spirit::ascii;
 
- // Begin grammar
- (
- double_ % ','
- )
- ,
- // End grammar
-
- v, space);
-
- if (first != last) // fail if we did not get a full match
- return false;
- return r;
+ ///////////////////////////////////////////////////////////////////////////
+ // Our number list compiler
+ ///////////////////////////////////////////////////////////////////////////
+ //[tutorial_numlist4
+ template <typename Iterator>
+ bool parse_numbers(Iterator first, Iterator last, std::vector<double>& v)
+ {
+ using qi::double_;
+ using qi::phrase_parse;
+ using qi::_1;
+ using ascii::space;
+
+ bool r = phrase_parse(first, last,
+
+ // Begin grammar
+ (
+ double_ % ','
+ )
+ ,
+ // End grammar
+
+ space, v);
+
+ if (first != last) // fail if we did not get a full match
+ return false;
+ return r;
+ }
+ //]
 }
-//]
 
 ////////////////////////////////////////////////////////////////////////////
 // Main program
@@ -75,7 +80,7 @@
             break;
 
         std::vector<double> v;
- if (parse_numbers(str.begin(), str.end(), v))
+ if (client::parse_numbers(str.begin(), str.end(), v))
         {
             std::cout << "-------------------------\n";
             std::cout << "Parsing succeeded\n";

Modified: branches/release/libs/spirit/example/qi/roman.cpp
==============================================================================
--- branches/release/libs/spirit/example/qi/roman.cpp (original)
+++ branches/release/libs/spirit/example/qi/roman.cpp 2009-09-14 12:45:39 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)
@@ -21,113 +21,119 @@
 #include <iostream>
 #include <string>
 
-using namespace boost::spirit;
-using namespace boost::spirit::qi;
-using namespace boost::spirit::ascii;
-using namespace boost::spirit::arg_names;
-using boost::phoenix::ref;
-
-///////////////////////////////////////////////////////////////////////////////
-// Parse roman hundreds (100..900) numerals using the symbol table.
-// Notice that the data associated with each slot is the parser's attribute
-// (which is passed to attached semantic actions).
-///////////////////////////////////////////////////////////////////////////////
-//[tutorial_roman_hundreds
-struct hundreds_ : symbols<char, unsigned>
+namespace client
 {
- hundreds_()
+ namespace qi = boost::spirit::qi;
+ namespace ascii = boost::spirit::ascii;
+
+ ///////////////////////////////////////////////////////////////////////////////
+ // Parse roman hundreds (100..900) numerals using the symbol table.
+ // Notice that the data associated with each slot is the parser's attribute
+ // (which is passed to attached semantic actions).
+ ///////////////////////////////////////////////////////////////////////////////
+ //[tutorial_roman_hundreds
+ struct hundreds_ : qi::symbols<char, unsigned>
     {
- add
- ("C" , 100)
- ("CC" , 200)
- ("CCC" , 300)
- ("CD" , 400)
- ("D" , 500)
- ("DC" , 600)
- ("DCC" , 700)
- ("DCCC" , 800)
- ("CM" , 900)
- ;
- }
+ hundreds_()
+ {
+ add
+ ("C" , 100)
+ ("CC" , 200)
+ ("CCC" , 300)
+ ("CD" , 400)
+ ("D" , 500)
+ ("DC" , 600)
+ ("DCC" , 700)
+ ("DCCC" , 800)
+ ("CM" , 900)
+ ;
+ }
 
-} hundreds;
-//]
+ } hundreds;
+ //]
 
-///////////////////////////////////////////////////////////////////////////////
-// Parse roman tens (10..90) numerals using the symbol table.
-///////////////////////////////////////////////////////////////////////////////
-//[tutorial_roman_tens
-struct tens_ : symbols<char, unsigned>
-{
- tens_()
+ ///////////////////////////////////////////////////////////////////////////////
+ // Parse roman tens (10..90) numerals using the symbol table.
+ ///////////////////////////////////////////////////////////////////////////////
+ //[tutorial_roman_tens
+ struct tens_ : qi::symbols<char, unsigned>
     {
- add
- ("X" , 10)
- ("XX" , 20)
- ("XXX" , 30)
- ("XL" , 40)
- ("L" , 50)
- ("LX" , 60)
- ("LXX" , 70)
- ("LXXX" , 80)
- ("XC" , 90)
- ;
- }
+ tens_()
+ {
+ add
+ ("X" , 10)
+ ("XX" , 20)
+ ("XXX" , 30)
+ ("XL" , 40)
+ ("L" , 50)
+ ("LX" , 60)
+ ("LXX" , 70)
+ ("LXXX" , 80)
+ ("XC" , 90)
+ ;
+ }
 
-} tens;
-//]
+ } tens;
+ //]
 
-///////////////////////////////////////////////////////////////////////////////
-// Parse roman ones (1..9) numerals using the symbol table.
-///////////////////////////////////////////////////////////////////////////////
-//[tutorial_roman_ones
-struct ones_ : symbols<char, unsigned>
-{
- ones_()
+ ///////////////////////////////////////////////////////////////////////////////
+ // Parse roman ones (1..9) numerals using the symbol table.
+ ///////////////////////////////////////////////////////////////////////////////
+ //[tutorial_roman_ones
+ struct ones_ : qi::symbols<char, unsigned>
     {
- add
- ("I" , 1)
- ("II" , 2)
- ("III" , 3)
- ("IV" , 4)
- ("V" , 5)
- ("VI" , 6)
- ("VII" , 7)
- ("VIII" , 8)
- ("IX" , 9)
- ;
- }
+ ones_()
+ {
+ add
+ ("I" , 1)
+ ("II" , 2)
+ ("III" , 3)
+ ("IV" , 4)
+ ("V" , 5)
+ ("VI" , 6)
+ ("VII" , 7)
+ ("VIII" , 8)
+ ("IX" , 9)
+ ;
+ }
 
-} ones;
-//]
+ } ones;
+ //]
 
-///////////////////////////////////////////////////////////////////////////////
-// roman (numerals) grammar
-//
-// Note the use of the || operator. The expression
-// a || b reads match a or b and in sequence. Try
-// defining the roman numerals grammar in YACC or
-// PCCTS. Spirit rules! :-)
-///////////////////////////////////////////////////////////////////////////////
-//[tutorial_roman_grammar
-template <typename Iterator>
-struct roman : grammar<Iterator, unsigned()>
-{
- roman() : roman::base_type(start)
+ ///////////////////////////////////////////////////////////////////////////////
+ // roman (numerals) grammar
+ //
+ // Note the use of the || operator. The expression
+ // a || b reads match a or b and in sequence. Try
+ // defining the roman numerals grammar in YACC or
+ // PCCTS. Spirit rules! :-)
+ ///////////////////////////////////////////////////////////////////////////////
+ //[tutorial_roman_grammar
+ template <typename Iterator>
+ struct roman : qi::grammar<Iterator, unsigned()>
     {
- start = eps [_val = 0] >>
- (
- +char_('M') [_val += 1000]
- || hundreds [_val += _1]
- || tens [_val += _1]
- || ones [_val += _1]
- )
- ;
- }
+ roman() : roman::base_type(start)
+ {
+ using qi::eps;
+ using qi::lit;
+ using qi::_val;
+ using qi::_1;
+ using ascii::char_;
+
+ start = eps [_val = 0] >>
+ (
+ +lit('M') [_val += 1000]
+ || hundreds [_val += _1]
+ || tens [_val += _1]
+ || ones [_val += _1]
+ )
+ ;
+ }
 
- rule<Iterator, unsigned()> start;
-};
-//]
+ qi::rule<Iterator, unsigned()> start;
+ };
+ //]
+}
 
 ///////////////////////////////////////////////////////////////////////////////
 // Main program
@@ -141,7 +147,7 @@
     std::cout << "Type a Roman Numeral ...or [q or Q] to quit\n\n";
 
     typedef std::string::const_iterator iterator_type;
- typedef roman<iterator_type> roman;
+ typedef client::roman<iterator_type> roman;
 
     roman roman_parser; // Our grammar
 

Modified: branches/release/libs/spirit/example/qi/sum.cpp
==============================================================================
--- branches/release/libs/spirit/example/qi/sum.cpp (original)
+++ branches/release/libs/spirit/example/qi/sum.cpp 2009-09-14 12:45:39 EDT (Mon, 14 Sep 2009)
@@ -1,5 +1,5 @@
 /*=============================================================================
- Copyright (c) 2002-2007 Joel de Guzman
+ Copyright (c) 2002-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)
@@ -22,38 +22,44 @@
 #include <string>
 //]
 
-//[tutorial_adder_using
-using namespace boost::phoenix;
-using namespace boost::spirit;
-using namespace boost::spirit::qi;
-using namespace boost::spirit::ascii;
-using namespace boost::spirit::arg_names;
-//]
-
-///////////////////////////////////////////////////////////////////////////////
-// Our adder
-///////////////////////////////////////////////////////////////////////////////
-
-//[tutorial_adder
-template <typename Iterator>
-bool adder(Iterator first, Iterator last, double& n)
+namespace client
 {
- bool r = phrase_parse(first, last,
+ //[tutorial_adder_using
+ namespace qi = boost::spirit::qi;
+ namespace ascii = boost::spirit::ascii;
+ namespace phoenix = boost::phoenix;
+
+ using qi::double_;
+ using qi::_1;
+ using ascii::space;
+ using phoenix::ref;
+ //]
+
+ ///////////////////////////////////////////////////////////////////////////
+ // Our adder
+ ///////////////////////////////////////////////////////////////////////////
+
+ //[tutorial_adder
+ template <typename Iterator>
+ bool adder(Iterator first, Iterator last, double& n)
+ {
+ bool r = qi::phrase_parse(first, last,
 
- // Begin grammar
- (
- double_[ref(n) = _1] >> *(',' >> double_[ref(n) += _1])
- )
- ,
- // End grammar
-
- space);
-
- if (first != last) // fail if we did not get a full match
- return false;
- return r;
+ // Begin grammar
+ (
+ double_[ref(n) = _1] >> *(',' >> double_[ref(n) += _1])
+ )
+ ,
+ // End grammar
+
+ space);
+
+ if (first != last) // fail if we did not get a full match
+ return false;
+ return r;
+ }
+ //]
 }
-//]
 
 ////////////////////////////////////////////////////////////////////////////
 // Main program
@@ -76,7 +82,7 @@
             break;
 
         double n;
- if (adder(str.begin(), str.end(), n))
+ if (client::adder(str.begin(), str.end(), n))
         {
             std::cout << "-------------------------\n";
             std::cout << "Parsing succeeded\n";

Modified: branches/release/libs/spirit/index.html
==============================================================================
--- branches/release/libs/spirit/index.html (original)
+++ branches/release/libs/spirit/index.html 2009-09-14 12:45:39 EDT (Mon, 14 Sep 2009)
@@ -1,13 +1,13 @@
 <!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
 <html>
   <head>
- <meta http-equiv="refresh" content="0; URL=classic/index.html">
+ <meta http-equiv="refresh" content="0; URL=doc/html/index.html">
   </head>
   <body>
- Automatic redirection failed, click this
- link &nbsp;<hr>
+ Automatic redirection failed, click this
+ link &nbsp;<hr>
     <p>© Copyright Beman Dawes, 2001</p>
- <p>Distributed under the Boost Software License, Version 1.0. (See
+ <p>Distributed under the Boost Software License, Version 1.0. (See
     accompanying file <a href="../../LICENSE_1_0.txt">
     LICENSE_1_0.txt</a> or copy at
     <a href="http://www.boost.org/LICENSE_1_0.txt">www.boost.org/LICENSE_1_0.txt</a>)</p>

Modified: branches/release/libs/spirit/phoenix/test/algorithm/querying.cpp
==============================================================================
--- branches/release/libs/spirit/phoenix/test/algorithm/querying.cpp (original)
+++ branches/release/libs/spirit/phoenix/test/algorithm/querying.cpp 2009-09-14 12:45:39 EDT (Mon, 14 Sep 2009)
@@ -10,8 +10,24 @@
 #include <boost/spirit/home/phoenix/stl/algorithm/querying.hpp>
 #include <boost/spirit/include/phoenix_core.hpp>
 #include <boost/detail/lightweight_test.hpp>
+#include <boost/assign/list_of.hpp>
+
+#include <boost/config.hpp>
+
+#ifdef BOOST_HAS_HASH
+#include BOOST_HASH_SET_HEADER
+#include BOOST_HASH_MAP_HEADER
+#define BOOST_PHOENIX_HAS_HASH
+#define BOOST_PHOENIX_HASH_NAMESPACE BOOST_STD_EXTENSION_NAMESPACE
+#elif defined(BOOST_DINKUMWARE_STDLIB)
+#include <hash_set>
+#include <hash_map>
+#define BOOST_PHOENIX_HAS_HASH
+#define BOOST_PHOENIX_HASH_NAMESPACE stdext
+#endif
 
 #include <set>
+#include <map>
 #include <functional>
 
 namespace
@@ -44,6 +60,19 @@
         std::set<int> s(array, array + 3);
         BOOST_TEST(find(arg1, 2)(s) == s.find(2));
 
+ std::map<int, int> m = boost::assign::map_list_of(0, 1)(2, 3)(4, 5);
+ BOOST_TEST(find(arg1, 2)(m) == m.find(2));
+
+#ifdef BOOST_PHOENIX_HAS_HASH
+
+ BOOST_PHOENIX_HASH_NAMESPACE::hash_set<int> hs(array, array + 3);
+ BOOST_TEST(find(arg1, 2)(hs) == hs.find(2));
+
+ BOOST_PHOENIX_HASH_NAMESPACE::hash_map<int, int> hm = boost::assign::map_list_of(0, 1)(2, 3)(4, 5);
+ BOOST_TEST(find(arg1, 2)(hm) == hm.find(2));
+
+#endif
+
         return;
     }
 

Copied: branches/release/libs/spirit/repository/doc/html/index.html (from r56184, /trunk/libs/spirit/repository/doc/html/index.html)
==============================================================================
--- /trunk/libs/spirit/repository/doc/html/index.html (original)
+++ branches/release/libs/spirit/repository/doc/html/index.html 2009-09-14 12:45:39 EDT (Mon, 14 Sep 2009)
@@ -34,7 +34,7 @@
 <div><p class="copyright">Copyright © 2001-2009 Joel
       de Guzman, Hartmut Kaiser</p></div>
 <div><div class="legalnotice" title="Legal Notice">
-<a name="id3124824"></a><p>
+<a name="id633780"></a><p>
         Distributed under the Boost Software License, Version 1.0. (See accompanying
         file LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt)
       </p>
@@ -80,7 +80,7 @@
 </div>
 </div>
 <table xmlns:rev="http://www.cs.rpi.edu/~gregod/boost/tools/doc/revision" width="100%"><tr>
-<td align="left"><p><small>Last revised: August 14, 2009 at 20:59:13 GMT</small></p></td>
+<td align="left"><p><small>Last revised: September 14, 2009 at 15:07:11 GMT</small></p></td>
 <td align="right"><div class="copyright-footer"></div></td>
 </tr></table>
 <hr>

Copied: branches/release/libs/spirit/repository/doc/html/spirit_repository/karma_components/directives/karma_confix_generator.html (from r56184, /trunk/libs/spirit/repository/doc/html/spirit_repository/karma_components/directives/karma_confix_generator.html)
==============================================================================
--- /trunk/libs/spirit/repository/doc/html/spirit_repository/karma_components/directives/karma_confix_generator.html (original)
+++ branches/release/libs/spirit/repository/doc/html/spirit_repository/karma_components/directives/karma_confix_generator.html 2009-09-14 12:45:39 EDT (Mon, 14 Sep 2009)
@@ -28,7 +28,7 @@
         Confix Generator</a>
 </h4></div></div></div>
 <a name="spirit_repository.karma_components.directives.karma_confix_generator.description"></a><h6>
-<a name="id3184629"></a>
+<a name="id650657"></a>
           <a class="link" href="karma_confix_generator.html#spirit_repository.karma_components.directives.karma_confix_generator.description">Description</a>
         </h6>
 <p>
@@ -93,20 +93,20 @@
           tag using a simple: <code class="computeroutput"><span class="identifier">ol</span><span class="special">[</span><span class="string">"Some text"</span><span class="special">]</span></code> (which results in <code class="computeroutput"><span class="special">&lt;</span><span class="identifier">ol</span><span class="special">&gt;</span><span class="identifier">Some</span> <span class="identifier">text</span><span class="special">&lt;/</span><span class="identifier">ol</span><span class="special">&gt;</span></code>).
         </p>
 <a name="spirit_repository.karma_components.directives.karma_confix_generator.header"></a><h6>
-<a name="id3185765"></a>
+<a name="id651553"></a>
           <a class="link" href="karma_confix_generator.html#spirit_repository.karma_components.directives.karma_confix_generator.header">Header</a>
         </h6>
 <pre class="programlisting"><span class="comment">// forwards to &lt;boost/spirit/repository/home/karma/directive/confix.hpp&gt;
 </span><span class="preprocessor">#include</span> <span class="special">&lt;</span><span class="identifier">boost</span><span class="special">/</span><span class="identifier">spirit</span><span class="special">/</span><span class="identifier">repository</span><span class="special">/</span><span class="identifier">include</span><span class="special">/</span><span class="identifier">karma_confix</span><span class="special">.</span><span class="identifier">hpp</span><span class="special">&gt;</span>
 </pre>
 <a name="spirit_repository.karma_components.directives.karma_confix_generator.synopsis"></a><h6>
-<a name="id3185868"></a>
+<a name="id651626"></a>
           <a class="link" href="karma_confix_generator.html#spirit_repository.karma_components.directives.karma_confix_generator.synopsis">Synopsis</a>
         </h6>
 <pre class="programlisting"><span class="identifier">confix</span><span class="special">(</span><span class="identifier">prefix</span><span class="special">,</span> <span class="identifier">suffix</span><span class="special">)[</span><span class="identifier">subject</span><span class="special">]</span>
 </pre>
 <a name="spirit_repository.karma_components.directives.karma_confix_generator.parameters"></a><h6>
-<a name="id3185937"></a>
+<a name="id651674"></a>
           <a class="link" href="karma_confix_generator.html#spirit_repository.karma_components.directives.karma_confix_generator.parameters">Parameters</a>
         </h6>
 <div class="informaltable"><table class="table">
@@ -175,7 +175,7 @@
           All three parameters can be arbitrary complex generators themselves.
         </p>
 <a name="spirit_repository.karma_components.directives.karma_confix_generator.attribute"></a><h6>
-<a name="id3186135"></a>
+<a name="id651833"></a>
           <a class="link" href="karma_confix_generator.html#spirit_repository.karma_components.directives.karma_confix_generator.attribute">Attribute</a>
         </h6>
 <p>
@@ -202,7 +202,7 @@
           </p></td></tr>
 </table></div>
 <a name="spirit_repository.karma_components.directives.karma_confix_generator.example"></a><h6>
-<a name="id3186374"></a>
+<a name="id652008"></a>
           <a class="link" href="karma_confix_generator.html#spirit_repository.karma_components.directives.karma_confix_generator.example">Example</a>
         </h6>
 <p>
@@ -211,7 +211,7 @@
           styles and a function prototype (for the full example code see here: confix.cpp)
         </p>
 <a name="spirit_repository.karma_components.directives.karma_confix_generator.prerequisites"></a><h6>
-<a name="id3186422"></a>
+<a name="id652038"></a>
           <a class="link" href="karma_confix_generator.html#spirit_repository.karma_components.directives.karma_confix_generator.prerequisites">Prerequisites</a>
         </h6>
 <p>
@@ -249,7 +249,7 @@
 <p>
         </p>
 <a name="spirit_repository.karma_components.directives.karma_confix_generator.generating_different_comment_styles"></a><h6>
-<a name="id3186734"></a>
+<a name="id652281"></a>
           <a class="link" href="karma_confix_generator.html#spirit_repository.karma_components.directives.karma_confix_generator.generating_different_comment_styles">Generating
           Different Comment Styles</a>
         </h6>
@@ -301,7 +301,7 @@
           */</span> </code>.
         </p>
 <a name="spirit_repository.karma_components.directives.karma_confix_generator.generating_a_function_prototype"></a><h6>
-<a name="id3187117"></a>
+<a name="id652583"></a>
           <a class="link" href="karma_confix_generator.html#spirit_repository.karma_components.directives.karma_confix_generator.generating_a_function_prototype">Generating
           a Function Prototype</a>
         </h6>

Copied: branches/release/libs/spirit/repository/doc/html/spirit_repository/karma_components/nonterminal/subrule.html (from r56184, /trunk/libs/spirit/repository/doc/html/spirit_repository/karma_components/nonterminal/subrule.html)
==============================================================================
--- /trunk/libs/spirit/repository/doc/html/spirit_repository/karma_components/nonterminal/subrule.html (original)
+++ branches/release/libs/spirit/repository/doc/html/spirit_repository/karma_components/nonterminal/subrule.html 2009-09-14 12:45:39 EDT (Mon, 14 Sep 2009)
@@ -27,7 +27,7 @@
         Karma subrules</a>
 </h4></div></div></div>
 <a name="spirit_repository.karma_components.nonterminal.subrule.description"></a><h6>
-<a name="id3187545"></a>
+<a name="id652916"></a>
           <a class="link" href="subrule.html#spirit_repository.karma_components.nonterminal.subrule.description">Description</a>
         </h6>
 <p>
@@ -89,21 +89,21 @@
           parts), whereas the rest can use rules and grammars.
         </p>
 <a name="spirit_repository.karma_components.nonterminal.subrule.header"></a><h6>
-<a name="id3187893"></a>
+<a name="id653178"></a>
           <a class="link" href="subrule.html#spirit_repository.karma_components.nonterminal.subrule.header">Header</a>
         </h6>
 <pre class="programlisting"><span class="comment">// forwards to &lt;boost/spirit/repository/home/karma/nonterminal/subrule.hpp&gt;
 </span><span class="preprocessor">#include</span> <span class="special">&lt;</span><span class="identifier">boost</span><span class="special">/</span><span class="identifier">spirit</span><span class="special">/</span><span class="identifier">repository</span><span class="special">/</span><span class="identifier">include</span><span class="special">/</span><span class="identifier">karma_subrule</span><span class="special">.</span><span class="identifier">hpp</span><span class="special">&gt;</span>
 </pre>
 <a name="spirit_repository.karma_components.nonterminal.subrule.synopsis__declaration_"></a><h6>
-<a name="id3187995"></a>
+<a name="id653254"></a>
           <a class="link" href="subrule.html#spirit_repository.karma_components.nonterminal.subrule.synopsis__declaration_">Synopsis
           (declaration)</a>
         </h6>
 <pre class="programlisting"><span class="identifier">subrule</span><span class="special">&lt;</span><span class="identifier">ID</span><span class="special">,</span> <span class="identifier">A1</span><span class="special">,</span> <span class="identifier">A2</span><span class="special">&gt;</span> <span class="identifier">sr</span><span class="special">(</span><span class="identifier">name</span><span class="special">);</span>
 </pre>
 <a name="spirit_repository.karma_components.nonterminal.subrule.parameters__declaration_"></a><h6>
-<a name="id3188083"></a>
+<a name="id653319"></a>
           <a class="link" href="subrule.html#spirit_repository.karma_components.nonterminal.subrule.parameters__declaration_">Parameters
           (declaration)</a>
         </h6>
@@ -173,7 +173,7 @@
 </tbody>
 </table></div>
 <a name="spirit_repository.karma_components.nonterminal.subrule.synopsis__usage_"></a><h6>
-<a name="id3188243"></a>
+<a name="id653448"></a>
           <a class="link" href="subrule.html#spirit_repository.karma_components.nonterminal.subrule.synopsis__usage_">Synopsis
           (usage)</a>
         </h6>
@@ -202,7 +202,7 @@
 <span class="special">)(</span><span class="identifier">a1</span><span class="special">,</span> <span class="identifier">a2</span><span class="special">,</span> <span class="special">...)</span> <span class="comment">// Arguments to group, i.e. to start subrule srA
 </span></pre>
 <a name="spirit_repository.karma_components.nonterminal.subrule.parameters__usage_"></a><h6>
-<a name="id3188535"></a>
+<a name="id653684"></a>
           <a class="link" href="subrule.html#spirit_repository.karma_components.nonterminal.subrule.parameters__usage_">Parameters
           (usage)</a>
         </h6>
@@ -326,7 +326,7 @@
 </tbody>
 </table></div>
 <a name="spirit_repository.karma_components.nonterminal.subrule.groups"></a><h6>
-<a name="id3188914"></a>
+<a name="id653998"></a>
           <a class="link" href="subrule.html#spirit_repository.karma_components.nonterminal.subrule.groups">Groups</a>
         </h6>
 <p>
@@ -371,7 +371,7 @@
 </span><span class="special">;</span>
 </pre>
 <a name="spirit_repository.karma_components.nonterminal.subrule.attributes"></a><h6>
-<a name="id3189408"></a>
+<a name="id654392"></a>
           <a class="link" href="subrule.html#spirit_repository.karma_components.nonterminal.subrule.attributes">Attributes</a>
         </h6>
 <p>
@@ -400,7 +400,7 @@
           </li>
 </ul></div>
 <a name="spirit_repository.karma_components.nonterminal.subrule.locals"></a><h6>
-<a name="id3189517"></a>
+<a name="id654465"></a>
           <a class="link" href="subrule.html#spirit_repository.karma_components.nonterminal.subrule.locals">Locals</a>
         </h6>
 <p>
@@ -410,7 +410,7 @@
           refer to the subrule's locals, if present.
         </p>
 <a name="spirit_repository.karma_components.nonterminal.subrule.example"></a><h6>
-<a name="id3189567"></a>
+<a name="id654501"></a>
           <a class="link" href="subrule.html#spirit_repository.karma_components.nonterminal.subrule.example">Example</a>
         </h6>
 <p>
@@ -482,7 +482,7 @@
           <a href="../../../../../example/karma/mini_xml_karma_sr.cpp" target="_top">../../example/karma/mini_xml_karma_sr.cpp</a>
         </p>
 <a name="spirit_repository.karma_components.nonterminal.subrule.performance"></a><h6>
-<a name="id3190500"></a>
+<a name="id656351"></a>
           <a class="link" href="subrule.html#spirit_repository.karma_components.nonterminal.subrule.performance">Performance</a>
         </h6>
 <p>
@@ -493,7 +493,7 @@
           subrules is very similar, so performance is very similar too).
         </p>
 <a name="spirit_repository.karma_components.nonterminal.subrule.notes"></a><h6>
-<a name="id3190549"></a>
+<a name="id656388"></a>
           <a class="link" href="subrule.html#spirit_repository.karma_components.nonterminal.subrule.notes">Notes</a>
         </h6>
 <p>

Copied: branches/release/libs/spirit/repository/doc/html/spirit_repository/preface.html (from r56184, /trunk/libs/spirit/repository/doc/html/spirit_repository/preface.html)
==============================================================================
--- /trunk/libs/spirit/repository/doc/html/spirit_repository/preface.html (original)
+++ branches/release/libs/spirit/repository/doc/html/spirit_repository/preface.html 2009-09-14 12:45:39 EDT (Mon, 14 Sep 2009)
@@ -27,7 +27,7 @@
 <a name="spirit_repository.preface"></a><a class="link" href="preface.html" title="Preface">Preface</a>
 </h2></div></div></div>
 <a name="spirit_repository.preface.the_spirit_repository"></a><h4>
-<a name="id3124865"></a>
+<a name="id633810"></a>
       <a class="link" href="preface.html#spirit_repository.preface.the_spirit_repository">The Spirit
       Repository</a>
     </h4>
@@ -77,7 +77,7 @@
       core library.
     </p>
 <a name="spirit_repository.preface.how_to_use_this_manual"></a><h4>
-<a name="id3127347"></a>
+<a name="id633899"></a>
       <a class="link" href="preface.html#spirit_repository.preface.how_to_use_this_manual">How to use
       this manual</a>
     </h4>
@@ -86,7 +86,7 @@
       icons precede some text to indicate:
     </p>
 <div class="table">
-<a name="id3127367"></a><p class="title"><b>Table 1. Icons</b></p>
+<a name="id633912"></a><p class="title"><b>Table 1. Icons</b></p>
 <div class="table-contents"><table class="table" summary="Icons">
 <colgroup>
 <col>
@@ -207,7 +207,7 @@
       Tools</a>.
     </p>
 <a name="spirit_repository.preface.support"></a><h4>
-<a name="id3123102"></a>
+<a name="id634153"></a>
       <a class="link" href="preface.html#spirit_repository.preface.support">Support</a>
     </h4>
 <p>

Copied: branches/release/libs/spirit/repository/doc/html/spirit_repository/qi_components/directives/confix.html (from r56184, /trunk/libs/spirit/repository/doc/html/spirit_repository/qi_components/directives/confix.html)
==============================================================================
--- /trunk/libs/spirit/repository/doc/html/spirit_repository/qi_components/directives/confix.html (original)
+++ branches/release/libs/spirit/repository/doc/html/spirit_repository/qi_components/directives/confix.html 2009-09-14 12:45:39 EDT (Mon, 14 Sep 2009)
@@ -28,7 +28,7 @@
         Qi Confix Parser Directive</a>
 </h4></div></div></div>
 <a name="spirit_repository.qi_components.directives.confix.description"></a><h6>
-<a name="id3173646"></a>
+<a name="id639049"></a>
           <a class="link" href="confix.html#spirit_repository.qi_components.directives.confix.description">Description</a>
         </h6>
 <p>
@@ -95,20 +95,20 @@
           </p></td></tr>
 </table></div>
 <a name="spirit_repository.qi_components.directives.confix.header"></a><h6>
-<a name="id3174604"></a>
+<a name="id639817"></a>
           <a class="link" href="confix.html#spirit_repository.qi_components.directives.confix.header">Header</a>
         </h6>
 <pre class="programlisting"><span class="comment">// forwards to &lt;boost/spirit/repository/home/qi/directive/confix.hpp&gt;
 </span><span class="preprocessor">#include</span> <span class="special">&lt;</span><span class="identifier">boost</span><span class="special">/</span><span class="identifier">spirit</span><span class="special">/</span><span class="identifier">repository</span><span class="special">/</span><span class="identifier">include</span><span class="special">/</span><span class="identifier">qi_confix</span><span class="special">.</span><span class="identifier">hpp</span><span class="special">&gt;</span>
 </pre>
 <a name="spirit_repository.qi_components.directives.confix.synopsis"></a><h6>
-<a name="id3174704"></a>
+<a name="id639895"></a>
           <a class="link" href="confix.html#spirit_repository.qi_components.directives.confix.synopsis">Synopsis</a>
         </h6>
 <pre class="programlisting"><span class="identifier">confix</span><span class="special">(</span><span class="identifier">prefix</span><span class="special">,</span> <span class="identifier">suffix</span><span class="special">)[</span><span class="identifier">subject</span><span class="special">]</span>
 </pre>
 <a name="spirit_repository.qi_components.directives.confix.parameters"></a><h6>
-<a name="id3174771"></a>
+<a name="id639948"></a>
           <a class="link" href="confix.html#spirit_repository.qi_components.directives.confix.parameters">Parameters</a>
         </h6>
 <div class="informaltable"><table class="table">
@@ -172,7 +172,7 @@
           All three parameters can be arbitrarily complex parsers themselves.
         </p>
 <a name="spirit_repository.qi_components.directives.confix.attribute"></a><h6>
-<a name="id3174935"></a>
+<a name="id640089"></a>
           <a class="link" href="confix.html#spirit_repository.qi_components.directives.confix.attribute">Attribute</a>
         </h6>
 <p>
@@ -198,7 +198,7 @@
           </p></td></tr>
 </table></div>
 <a name="spirit_repository.qi_components.directives.confix.example"></a><h6>
-<a name="id3175247"></a>
+<a name="id640327"></a>
           <a class="link" href="confix.html#spirit_repository.qi_components.directives.confix.example">Example</a>
         </h6>
 <p>
@@ -208,7 +208,7 @@
           see confix.cpp)
         </p>
 <a name="spirit_repository.qi_components.directives.confix.prerequisites"></a><h6>
-<a name="id3175294"></a>
+<a name="id640362"></a>
           <a class="link" href="confix.html#spirit_repository.qi_components.directives.confix.prerequisites">Prerequisites</a>
         </h6>
 <p>
@@ -251,7 +251,7 @@
 <p>
         </p>
 <a name="spirit_repository.qi_components.directives.confix.parsing_different_comment_styles"></a><h6>
-<a name="id3175817"></a>
+<a name="id640779"></a>
           <a class="link" href="confix.html#spirit_repository.qi_components.directives.confix.parsing_different_comment_styles">Parsing
           Different Comment Styles</a>
         </h6>
@@ -311,7 +311,7 @@
           This is a comment */</span> </code>".
         </p>
 <a name="spirit_repository.qi_components.directives.confix.parsing_tagged_data"></a><h6>
-<a name="id3176526"></a>
+<a name="id642454"></a>
           <a class="link" href="confix.html#spirit_repository.qi_components.directives.confix.parsing_tagged_data">Parsing
           Tagged Data</a>
         </h6>

Copied: branches/release/libs/spirit/repository/doc/html/spirit_repository/qi_components/directives/distinct.html (from r56184, /trunk/libs/spirit/repository/doc/html/spirit_repository/qi_components/directives/distinct.html)
==============================================================================
--- /trunk/libs/spirit/repository/doc/html/spirit_repository/qi_components/directives/distinct.html (original)
+++ branches/release/libs/spirit/repository/doc/html/spirit_repository/qi_components/directives/distinct.html 2009-09-14 12:45:39 EDT (Mon, 14 Sep 2009)
@@ -28,7 +28,7 @@
         Qi Distinct Parser Directive</a>
 </h4></div></div></div>
 <a name="spirit_repository.qi_components.directives.distinct.description"></a><h6>
-<a name="id3176965"></a>
+<a name="id642807"></a>
           <a class="link" href="distinct.html#spirit_repository.qi_components.directives.distinct.description">Description</a>
         </h6>
 <p>
@@ -144,20 +144,20 @@
           above.
         </p>
 <a name="spirit_repository.qi_components.directives.distinct.header"></a><h6>
-<a name="id3178526"></a>
+<a name="id644044"></a>
           <a class="link" href="distinct.html#spirit_repository.qi_components.directives.distinct.header">Header</a>
         </h6>
 <pre class="programlisting"><span class="comment">// forwards to &lt;boost/spirit/repository/home/qi/directive/distinct.hpp&gt;
 </span><span class="preprocessor">#include</span> <span class="special">&lt;</span><span class="identifier">boost</span><span class="special">/</span><span class="identifier">spirit</span><span class="special">/</span><span class="identifier">repository</span><span class="special">/</span><span class="identifier">include</span><span class="special">/</span><span class="identifier">qi_distinct</span><span class="special">.</span><span class="identifier">hpp</span><span class="special">&gt;</span>
 </pre>
 <a name="spirit_repository.qi_components.directives.distinct.synopsis"></a><h6>
-<a name="id3178628"></a>
+<a name="id644122"></a>
           <a class="link" href="distinct.html#spirit_repository.qi_components.directives.distinct.synopsis">Synopsis</a>
         </h6>
 <pre class="programlisting"><span class="identifier">distinct</span><span class="special">(</span><span class="identifier">tail</span><span class="special">)[</span><span class="identifier">subject</span><span class="special">]</span>
 </pre>
 <a name="spirit_repository.qi_components.directives.distinct.parameters"></a><h6>
-<a name="id3178684"></a>
+<a name="id644166"></a>
           <a class="link" href="distinct.html#spirit_repository.qi_components.directives.distinct.parameters">Parameters</a>
         </h6>
 <div class="informaltable"><table class="table">
@@ -210,7 +210,7 @@
           All two parameters can be arbitrary complex parsers themselves.
         </p>
 <a name="spirit_repository.qi_components.directives.distinct.attribute"></a><h6>
-<a name="id3178801"></a>
+<a name="id644270"></a>
           <a class="link" href="distinct.html#spirit_repository.qi_components.directives.distinct.attribute">Attribute</a>
         </h6>
 <p>
@@ -224,7 +224,7 @@
 <pre class="programlisting"><span class="identifier">a</span><span class="special">:</span> <span class="identifier">A</span><span class="special">,</span> <span class="identifier">b</span><span class="special">:</span> <span class="identifier">B</span> <span class="special">--&gt;</span> <span class="identifier">distinct</span><span class="special">(</span><span class="identifier">b</span><span class="special">)[</span><span class="identifier">a</span><span class="special">]:</span> <span class="identifier">A</span>
 </pre>
 <a name="spirit_repository.qi_components.directives.distinct.example"></a><h6>
-<a name="id3178953"></a>
+<a name="id644396"></a>
           <a class="link" href="distinct.html#spirit_repository.qi_components.directives.distinct.example">Example</a>
         </h6>
 <p>
@@ -232,7 +232,7 @@
           parser. distinct.cpp)
         </p>
 <a name="spirit_repository.qi_components.directives.distinct.prerequisites"></a><h6>
-<a name="id3178997"></a>
+<a name="id644428"></a>
           <a class="link" href="distinct.html#spirit_repository.qi_components.directives.distinct.prerequisites">Prerequisites</a>
         </h6>
 <p>
@@ -269,7 +269,7 @@
 <p>
         </p>
 <a name="spirit_repository.qi_components.directives.distinct.using_the_distinct_directive_to_match_keywords"></a><h6>
-<a name="id3179306"></a>
+<a name="id644672"></a>
           <a class="link" href="distinct.html#spirit_repository.qi_components.directives.distinct.using_the_distinct_directive_to_match_keywords">Using
           The Distinct Directive to Match keywords</a>
         </h6>

Copied: branches/release/libs/spirit/repository/doc/html/spirit_repository/qi_components/nonterminal/subrule.html (from r56184, /trunk/libs/spirit/repository/doc/html/spirit_repository/qi_components/nonterminal/subrule.html)
==============================================================================
--- /trunk/libs/spirit/repository/doc/html/spirit_repository/qi_components/nonterminal/subrule.html (original)
+++ branches/release/libs/spirit/repository/doc/html/spirit_repository/qi_components/nonterminal/subrule.html 2009-09-14 12:45:39 EDT (Mon, 14 Sep 2009)
@@ -28,7 +28,7 @@
         Qi subrules</a>
 </h4></div></div></div>
 <a name="spirit_repository.qi_components.nonterminal.subrule.description"></a><h6>
-<a name="id3180460"></a>
+<a name="id645606"></a>
           <a class="link" href="subrule.html#spirit_repository.qi_components.nonterminal.subrule.description">Description</a>
         </h6>
 <p>
@@ -101,21 +101,21 @@
           most performance-critical parts), whereas the rest can use rules and grammars.
         </p>
 <a name="spirit_repository.qi_components.nonterminal.subrule.header"></a><h6>
-<a name="id3180947"></a>
+<a name="id645994"></a>
           <a class="link" href="subrule.html#spirit_repository.qi_components.nonterminal.subrule.header">Header</a>
         </h6>
 <pre class="programlisting"><span class="comment">// forwards to &lt;boost/spirit/repository/home/qi/nonterminal/subrule.hpp&gt;
 </span><span class="preprocessor">#include</span> <span class="special">&lt;</span><span class="identifier">boost</span><span class="special">/</span><span class="identifier">spirit</span><span class="special">/</span><span class="identifier">repository</span><span class="special">/</span><span class="identifier">include</span><span class="special">/</span><span class="identifier">qi_subrule</span><span class="special">.</span><span class="identifier">hpp</span><span class="special">&gt;</span>
 </pre>
 <a name="spirit_repository.qi_components.nonterminal.subrule.synopsis__declaration_"></a><h6>
-<a name="id3181050"></a>
+<a name="id646070"></a>
           <a class="link" href="subrule.html#spirit_repository.qi_components.nonterminal.subrule.synopsis__declaration_">Synopsis
           (declaration)</a>
         </h6>
 <pre class="programlisting"><span class="identifier">subrule</span><span class="special">&lt;</span><span class="identifier">ID</span><span class="special">,</span> <span class="identifier">A1</span><span class="special">,</span> <span class="identifier">A2</span><span class="special">&gt;</span> <span class="identifier">sr</span><span class="special">(</span><span class="identifier">name</span><span class="special">);</span>
 </pre>
 <a name="spirit_repository.qi_components.nonterminal.subrule.parameters__declaration_"></a><h6>
-<a name="id3181138"></a>
+<a name="id646134"></a>
           <a class="link" href="subrule.html#spirit_repository.qi_components.nonterminal.subrule.parameters__declaration_">Parameters
           (declaration)</a>
         </h6>
@@ -185,7 +185,7 @@
 </tbody>
 </table></div>
 <a name="spirit_repository.qi_components.nonterminal.subrule.synopsis__usage_"></a><h6>
-<a name="id3181298"></a>
+<a name="id646264"></a>
           <a class="link" href="subrule.html#spirit_repository.qi_components.nonterminal.subrule.synopsis__usage_">Synopsis
           (usage)</a>
         </h6>
@@ -214,7 +214,7 @@
 <span class="special">)(</span><span class="identifier">a1</span><span class="special">,</span> <span class="identifier">a2</span><span class="special">,</span> <span class="special">...)</span> <span class="comment">// Arguments to group, i.e. to start subrule srA
 </span></pre>
 <a name="spirit_repository.qi_components.nonterminal.subrule.parameters__usage_"></a><h6>
-<a name="id3181592"></a>
+<a name="id646499"></a>
           <a class="link" href="subrule.html#spirit_repository.qi_components.nonterminal.subrule.parameters__usage_">Parameters
           (usage)</a>
         </h6>
@@ -338,7 +338,7 @@
 </tbody>
 </table></div>
 <a name="spirit_repository.qi_components.nonterminal.subrule.groups"></a><h6>
-<a name="id3181968"></a>
+<a name="id647921"></a>
           <a class="link" href="subrule.html#spirit_repository.qi_components.nonterminal.subrule.groups">Groups</a>
         </h6>
 <p>
@@ -383,7 +383,7 @@
 </span><span class="special">;</span>
 </pre>
 <a name="spirit_repository.qi_components.nonterminal.subrule.attributes"></a><h6>
-<a name="id3182471"></a>
+<a name="id648322"></a>
           <a class="link" href="subrule.html#spirit_repository.qi_components.nonterminal.subrule.attributes">Attributes</a>
         </h6>
 <p>
@@ -411,7 +411,7 @@
           </li>
 </ul></div>
 <a name="spirit_repository.qi_components.nonterminal.subrule.locals"></a><h6>
-<a name="id3182580"></a>
+<a name="id648398"></a>
           <a class="link" href="subrule.html#spirit_repository.qi_components.nonterminal.subrule.locals">Locals</a>
         </h6>
 <p>
@@ -421,7 +421,7 @@
           refer to the subrule's locals, if present.
         </p>
 <a name="spirit_repository.qi_components.nonterminal.subrule.example"></a><h6>
-<a name="id3182630"></a>
+<a name="id648434"></a>
           <a class="link" href="subrule.html#spirit_repository.qi_components.nonterminal.subrule.example">Example</a>
         </h6>
 <p>
@@ -521,7 +521,7 @@
           <a href="../../../../../example/qi/mini_xml2_sr.cpp" target="_top">../../example/qi/mini_xml2_sr.cpp</a>
         </p>
 <a name="spirit_repository.qi_components.nonterminal.subrule.performance"></a><h6>
-<a name="id3184181"></a>
+<a name="id649704"></a>
           <a class="link" href="subrule.html#spirit_repository.qi_components.nonterminal.subrule.performance">Performance</a>
         </h6>
 <p>
@@ -529,7 +529,7 @@
           examples to subrules, with various compilers.
         </p>
 <div class="table">
-<a name="id3184201"></a><p class="title"><b>Table 2. Subrules performance</b></p>
+<a name="id649720"></a><p class="title"><b>Table 2. Subrules performance</b></p>
 <div class="table-contents"><table class="table" summary="Subrules performance">
 <colgroup>
 <col>
@@ -776,7 +776,7 @@
           </li>
 </ul></div>
 <a name="spirit_repository.qi_components.nonterminal.subrule.notes"></a><h6>
-<a name="id3184547"></a>
+<a name="id650605"></a>
           <a class="link" href="subrule.html#spirit_repository.qi_components.nonterminal.subrule.notes">Notes</a>
         </h6>
 <p>

Copied: branches/release/libs/spirit/repository/doc/html/spirit_repository/qi_components/primitive/flush_multi_pass.html (from r56184, /trunk/libs/spirit/repository/doc/html/spirit_repository/qi_components/primitive/flush_multi_pass.html)
==============================================================================
--- /trunk/libs/spirit/repository/doc/html/spirit_repository/qi_components/primitive/flush_multi_pass.html (original)
+++ branches/release/libs/spirit/repository/doc/html/spirit_repository/qi_components/primitive/flush_multi_pass.html 2009-09-14 12:45:39 EDT (Mon, 14 Sep 2009)
@@ -28,7 +28,7 @@
         Qi flush_multi_pass parser</a>
 </h4></div></div></div>
 <a name="spirit_repository.qi_components.primitive.flush_multi_pass.description"></a><h6>
-<a name="id3123216"></a>
+<a name="id634230"></a>
           <a class="link" href="flush_multi_pass.html#spirit_repository.qi_components.primitive.flush_multi_pass.description">Description</a>
         </h6>
 <p>
@@ -53,20 +53,20 @@
           <code class="computeroutput"><span class="identifier">eps</span></code>).
         </p>
 <a name="spirit_repository.qi_components.primitive.flush_multi_pass.header"></a><h6>
-<a name="id3123386"></a>
+<a name="id634338"></a>
           <a class="link" href="flush_multi_pass.html#spirit_repository.qi_components.primitive.flush_multi_pass.header">Header</a>
         </h6>
 <pre class="programlisting"><span class="comment">// forwards to &lt;boost/spirit/repository/home/qi/primitive/flush_multi_pass.hpp&gt;
 </span><span class="preprocessor">#include</span> <span class="special">&lt;</span><span class="identifier">boost</span><span class="special">/</span><span class="identifier">spirit</span><span class="special">/</span><span class="identifier">repository</span><span class="special">/</span><span class="identifier">include</span><span class="special">/</span><span class="identifier">qi_flush_multi_pass</span><span class="special">.</span><span class="identifier">hpp</span><span class="special">&gt;</span>
 </pre>
 <a name="spirit_repository.qi_components.primitive.flush_multi_pass.synopsis"></a><h6>
-<a name="id3172292"></a>
+<a name="id634411"></a>
           <a class="link" href="flush_multi_pass.html#spirit_repository.qi_components.primitive.flush_multi_pass.synopsis">Synopsis</a>
         </h6>
 <pre class="programlisting"><span class="identifier">flush_multi_pass</span>
 </pre>
 <a name="spirit_repository.qi_components.primitive.flush_multi_pass.parameters"></a><h6>
-<a name="id3172327"></a>
+<a name="id634433"></a>
           <a class="link" href="flush_multi_pass.html#spirit_repository.qi_components.primitive.flush_multi_pass.parameters">Parameters</a>
         </h6>
 <p>
@@ -74,7 +74,7 @@
           not require any parameters.
         </p>
 <a name="spirit_repository.qi_components.primitive.flush_multi_pass.attribute"></a><h6>
-<a name="id3172365"></a>
+<a name="id634457"></a>
           <a class="link" href="flush_multi_pass.html#spirit_repository.qi_components.primitive.flush_multi_pass.attribute">Attribute</a>
         </h6>
 <p>
@@ -84,7 +84,7 @@
 <pre class="programlisting"><span class="identifier">flush_multi_pass</span> <span class="special">--&gt;</span> <span class="identifier">unused</span>
 </pre>
 <a name="spirit_repository.qi_components.primitive.flush_multi_pass.example"></a><h6>
-<a name="id3172437"></a>
+<a name="id634506"></a>
           <a class="link" href="flush_multi_pass.html#spirit_repository.qi_components.primitive.flush_multi_pass.example">Example</a>
         </h6>
 <p>
@@ -96,7 +96,7 @@
           a function prototype (for the full example code see here: flush_multi_pass.cpp)
         </p>
 <a name="spirit_repository.qi_components.primitive.flush_multi_pass.prerequisites"></a><h6>
-<a name="id3172486"></a>
+<a name="id634538"></a>
           <a class="link" href="flush_multi_pass.html#spirit_repository.qi_components.primitive.flush_multi_pass.prerequisites">Prerequisites</a>
         </h6>
 <p>
@@ -133,7 +133,7 @@
 <p>
         </p>
 <a name="spirit_repository.qi_components.primitive.flush_multi_pass.clearing_the_internal_buffer"></a><h6>
-<a name="id3172763"></a>
+<a name="id634754"></a>
           <a class="link" href="flush_multi_pass.html#spirit_repository.qi_components.primitive.flush_multi_pass.clearing_the_internal_buffer">Clearing
           the internal buffer</a>
         </h6>

Modified: branches/release/libs/spirit/test/Jamfile
==============================================================================
--- branches/release/libs/spirit/test/Jamfile (original)
+++ branches/release/libs/spirit/test/Jamfile 2009-09-14 12:45:39 EDT (Mon, 14 Sep 2009)
@@ -1,38 +1,43 @@
 #==============================================================================
-# Copyright (c) 2001-2007 Joel de Guzman
-# Copyright (c) 2001-2008 Hartmut Kaiser
+# Copyright (c) 2001-2009 Joel de Guzman
+# Copyright (c) 2001-2009 Hartmut Kaiser
 #
 # 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)
 #==============================================================================
-
-# bring in rules for testing
-import testing ;
-
-project # spirit_v2-tests
- : requirements
+project spirit_v2x/test
+ : requirements
+ <include>.
         <toolset>gcc:<cxxflags>-ftemplate-depth-300
         <toolset>darwin:<cxxflags>-ftemplate-depth-300
+# <toolset>gcc:<linkflags>-Wl,--enable-auto-import
+# <toolset>darwin:<linkflags>-Wl,--enable-auto-import
+ :
+ :
     ;
 
+path-constant LEX_DIR : $(BOOST_ROOT)/libs/spirit/test/lex ;
+
+# bring in rules for testing
+import testing ;
+
 {
     test-suite spirit_v2 :
 
     # run Qi tests
     [ run qi/actions.cpp : : : : ]
     [ run qi/alternative.cpp : : : : ]
+ [ run qi/attr.cpp : : : : ]
     [ run qi/and_predicate.cpp : : : : ]
     [ run qi/binary.cpp : : : : ]
     [ run qi/char.cpp : : : : ]
     [ run qi/char_class.cpp : : : : ]
- [ run qi/confix.cpp : : : : ]
- [ run qi/debug.cpp : : : : ]
+ #[ run qi/debug.cpp : : : : ]
     [ run qi/difference.cpp : : : : ]
     [ run qi/end.cpp : : : : ]
     [ run qi/eps.cpp : : : : ]
     [ run qi/expect.cpp : : : : ]
- [ run qi/functor.cpp : : : : ]
     [ run qi/grammar.cpp : : : : ]
     [ run qi/int.cpp : : : : ]
     [ run qi/kleene.cpp : : : : ]
@@ -40,39 +45,44 @@
     [ run qi/lexeme.cpp : : : : ]
     [ run qi/lit.cpp : : : : ]
     [ run qi/list.cpp : : : : ]
+ [ run qi/match_manip.cpp : : : : ]
+ [ run qi/match_manip_attr.cpp : : : : ]
     [ run qi/no_case.cpp : : : : ]
- [ run qi/none.cpp : : : : ]
     [ run qi/not_predicate.cpp : : : : ]
     [ run qi/optional.cpp : : : : ]
+ [ run qi/parse_attr.cpp : : : : ]
     [ run qi/permutation.cpp : : : : ]
     [ run qi/plus.cpp : : : : ]
     [ run qi/range_run.cpp : : : : ]
     [ run qi/raw.cpp : : : : ]
     [ run qi/real.cpp : : : : ]
+ [ run qi/repeat.cpp : : : : ]
     [ run qi/rule.cpp : : : : ]
     [ run qi/sequence.cpp : : : : ]
     [ run qi/sequential_or.cpp : : : : ]
+ [ run qi/skip.cpp : : : : ]
     [ run qi/symbols.cpp : : : : ]
+ [ run qi/terminal_ex.cpp : : : : ]
     [ run qi/tst.cpp : : : : ]
     [ run qi/uint.cpp : : : : ]
- [ run qi/match_manip.cpp : : : : ]
-
- [ compile-fail qi/grammar_fail.cpp : : ]
- [ compile-fail qi/rule_fail.cpp : : ]
 
     # run Karma tests
     [ run karma/actions.cpp : : : : karma_actions ]
+ [ run karma/and_predicate.cpp : : : : karma_and_predicate ]
     [ run karma/alternative.cpp : : : : karma_alternative ]
     [ run karma/binary.cpp : : : : karma_binary ]
+ [ run karma/buffer.cpp : : : : karma_buffer ]
     [ run karma/case_handling.cpp : : : : ]
     [ run karma/center_alignment.cpp : : : : ]
     [ run karma/char.cpp : : : : karma_char ]
- [ run karma/confix.cpp : : : : karma_confix ]
+ [ run karma/char_class.cpp : : : : karma_char_class ]
     [ run karma/delimiter.cpp : : : : ]
     [ run karma/eol.cpp : : : : karma_eol ]
     [ run karma/eps.cpp : : : : karma_eps ]
     [ run karma/format_manip.cpp : : : : ]
- [ run karma/functor.cpp : : : : karma_functor ]
+ [ run karma/format_manip_attr.cpp : : : : ]
+ [ run karma/format_pointer_container.cpp : : : : ]
+ [ run karma/generate_attr.cpp : : : : ]
     [ run karma/grammar.cpp : : : : karma_grammar ]
     [ run karma/int_numerics.cpp : : : : ]
     [ run karma/kleene.cpp : : : : karma_kleene ]
@@ -80,33 +90,41 @@
     [ run karma/left_alignment.cpp : : : : ]
     [ run karma/list.cpp : : : : karma_list ]
     [ run karma/lit.cpp : : : : karma_lit ]
- [ run karma/none.cpp : : : : karma_none ]
+ [ run karma/maxwidth.cpp : : : : ]
+ [ run karma/not_predicate.cpp : : : : karma_not_predicate ]
+ [ run karma/omit.cpp : : : : karma_omit ]
     [ run karma/optional.cpp : : : : karma_optional ]
     [ run karma/pattern.cpp : : : : karma_pattern ]
     [ run karma/pattern2.cpp : : : : karma_pattern2 ]
+ [ run karma/plus.cpp : : : : karma_plus ]
     [ run karma/real_numerics.cpp : : : : ]
+ [ run karma/repeat.cpp : : : : karma_repeat ]
     [ run karma/right_alignment.cpp : : : : ]
     [ run karma/sequence.cpp : : : : karma_sequence ]
+ [ run karma/stream.cpp : : : : karma_stream ]
+ [ run karma/tricky_alignment.cpp : : : : ]
 
     [ compile-fail karma/grammar_fail.cpp : : karma_grammar_fail ]
     [ compile-fail karma/rule_fail.cpp : : karma_rule_fail ]
 
- # run support tests
- [ run support/hold_any.cpp : : : : ]
-# the multi_pass tests are not completed yet
-# [ run support/multi_pass_compile.cpp : : : : ]
-# [ run support/multi_pass.cpp : : : : ]
-
- # run lexer tests
+ # run Lex tests
     [ run lex/lexertl1.cpp : : : : ]
     [ run lex/lexertl2.cpp : : : : ]
     [ run lex/lexertl3.cpp : : : : ]
     [ run lex/lexertl4.cpp : : : : ]
     [ run lex/lexertl5.cpp : : : : ]
     [ run lex/state_switcher_test.cpp : : : : ]
+ [ run lex/lexer_state_switcher.cpp : : : : ]
+ [ run lex/set_token_value.cpp : : : : ]
+ [ run lex/dedent_handling_phoenix.cpp : : : : ]
+ [ run lex/set_token_value_phoenix.cpp : : : : ]
+
+ [ run lex/regression001.cpp : : : : lex_regression001 ]
+ [ run lex/regression002.cpp : : : : lex_regression002 ]
+ [ run lex/regression003_generate.cpp : $(LEX_DIR)/matlib_static.h : : : lex_regression003_generate ]
+ [ run lex/regression003.cpp : : : <dependency>.//lex_regression003_generate : lex_regression003 ]
 
     ;
 
 }
 
-

Modified: branches/release/libs/spirit/test/karma/actions.cpp
==============================================================================
--- branches/release/libs/spirit/test/karma/actions.cpp (original)
+++ branches/release/libs/spirit/test/karma/actions.cpp 2009-09-14 12:45:39 EDT (Mon, 14 Sep 2009)
@@ -1,6 +1,6 @@
 /*=============================================================================
     Copyright (c) 2001-2009 Hartmut Kaiser
- Copyright (c) 2001-2008 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)
@@ -9,16 +9,19 @@
 #include <boost/config/warning_disable.hpp>
 #include <boost/detail/lightweight_test.hpp>
 
-#include <boost/spirit/include/karma.hpp>
-#include <boost/lambda/lambda.hpp>
+#include <boost/spirit/include/karma_char.hpp>
+#include <boost/spirit/include/karma_numeric.hpp>
+#include <boost/spirit/include/karma_action.hpp>
+#include <boost/spirit/include/karma_generate.hpp>
+#include <boost/spirit/include/karma_operator.hpp>
 #include <boost/bind.hpp>
-#include <boost/function_output_iterator.hpp>
+#include <boost/lambda/lambda.hpp>
 
 #include <sstream>
 #include "test.hpp"
 
 using namespace spirit_test;
-using namespace boost::spirit;
+using boost::spirit::unused_type;
 
 void read1(int& i)
 {
@@ -35,6 +38,12 @@
     i = 42;
 }
 
+void read3_fail(int& i, unused_type, bool& pass)
+{
+ i = 42;
+ pass = false;
+}
+
 struct read_action
 {
     void operator()(int& i, unused_type, unused_type) const
@@ -46,32 +55,68 @@
 ///////////////////////////////////////////////////////////////////////////////
 int main()
 {
- using namespace boost::spirit::ascii;
+ using boost::spirit::karma::int_;
+ {
+ BOOST_TEST(test("42", int_[&read1]));
+ BOOST_TEST(test_delimited("42 ", int_[&read1], ' '));
+ BOOST_TEST(test("42", int_[&read2]));
+ BOOST_TEST(test_delimited("42 ", int_[&read2], ' '));
+ BOOST_TEST(test("42", int_[&read3]));
+ BOOST_TEST(test_delimited("42 ", int_[&read3], ' '));
+ BOOST_TEST(!test("42", int_[&read3_fail]));
+ BOOST_TEST(!test_delimited("42 ", int_[&read3_fail], ' '));
+ }
+
+ {
+ BOOST_TEST(test("42", int_[read_action()]));
+ BOOST_TEST(test_delimited("42 ", int_[read_action()], ' '));
+ }
+
+ {
+ BOOST_TEST(test("42", int_[boost::bind(&read1, _1)]));
+ BOOST_TEST(test_delimited("42 ", int_[boost::bind(&read1, _1)], ' '));
+ BOOST_TEST(test("42", int_[boost::bind(&read2, _1, _2)]));
+ BOOST_TEST(test_delimited("42 ", int_[boost::bind(&read2, _1, _2)], ' '));
+ BOOST_TEST(test("42", int_[boost::bind(&read3, _1, _2, _3)]));
+ BOOST_TEST(test_delimited("42 ", int_[boost::bind(&read3, _1, _2, _3)], ' '));
+ }
+
+ {
+ namespace lambda = boost::lambda;
+ {
+ std::stringstream strm("42");
+ BOOST_TEST(test("42", int_[strm >> lambda::_1]));
+ }
+ {
+ std::stringstream strm("42");
+ BOOST_TEST(test_delimited("42 ", int_[strm >> lambda::_1], ' '));
+ }
+ }
 
     {
         BOOST_TEST(test("{42}", '{' << int_[&read1] << '}'));
- BOOST_TEST(test_delimited("{ 42 } ", '{' << int_[&read1] << '}', space));
+ BOOST_TEST(test_delimited("{ 42 } ", '{' << int_[&read1] << '}', ' '));
         BOOST_TEST(test("{42}", '{' << int_[&read2] << '}'));
- BOOST_TEST(test_delimited("{ 42 } ", '{' << int_[&read2] << '}', space));
+ BOOST_TEST(test_delimited("{ 42 } ", '{' << int_[&read2] << '}', ' '));
         BOOST_TEST(test("{42}", '{' << int_[&read3] << '}'));
- BOOST_TEST(test_delimited("{ 42 } ", '{' << int_[&read3] << '}', space));
+ BOOST_TEST(test_delimited("{ 42 } ", '{' << int_[&read3] << '}', ' '));
     }
 
     {
         BOOST_TEST(test("{42}", '{' << int_[read_action()] << '}'));
- BOOST_TEST(test_delimited("{ 42 } ", '{' << int_[read_action()] << '}', space));
+ BOOST_TEST(test_delimited("{ 42 } ", '{' << int_[read_action()] << '}', ' '));
     }
 
     {
         BOOST_TEST(test("{42}", '{' << int_[boost::bind(&read1, _1)] << '}'));
         BOOST_TEST(test_delimited("{ 42 } ",
- '{' << int_[boost::bind(&read1, _1)] << '}', space));
+ '{' << int_[boost::bind(&read1, _1)] << '}', ' '));
         BOOST_TEST(test("{42}", '{' << int_[boost::bind(&read2, _1, _2)] << '}'));
         BOOST_TEST(test_delimited("{ 42 } ",
- '{' << int_[boost::bind(&read2, _1, _2)] << '}', space));
+ '{' << int_[boost::bind(&read2, _1, _2)] << '}', ' '));
         BOOST_TEST(test("{42}", '{' << int_[boost::bind(&read3, _1, _2, _3)] << '}'));
         BOOST_TEST(test_delimited("{ 42 } ",
- '{' << int_[boost::bind(&read3, _1, _2, _3)] << '}', space));
+ '{' << int_[boost::bind(&read3, _1, _2, _3)] << '}', ' '));
     }
 
     {
@@ -83,7 +128,7 @@
         {
             std::stringstream strm("42");
             BOOST_TEST(test_delimited("{ 42 } ",
- '{' << int_[strm >> lambda::_1] << '}', space));
+ '{' << int_[strm >> lambda::_1] << '}', ' '));
         }
     }
 

Modified: branches/release/libs/spirit/test/karma/alternative.cpp
==============================================================================
--- branches/release/libs/spirit/test/karma/alternative.cpp (original)
+++ branches/release/libs/spirit/test/karma/alternative.cpp 2009-09-14 12:45:39 EDT (Mon, 14 Sep 2009)
@@ -8,6 +8,7 @@
 #include <boost/config/warning_disable.hpp>
 #include <boost/detail/lightweight_test.hpp>
 
+#include <boost/spirit/include/karma_auxiliary.hpp>
 #include <boost/spirit/include/karma_char.hpp>
 #include <boost/spirit/include/karma_string.hpp>
 #include <boost/spirit/include/karma_numeric.hpp>
@@ -25,65 +26,101 @@
 {
     using namespace boost;
     using namespace boost::spirit;
-
+ using namespace boost::spirit::ascii;
+
     {
- {
- BOOST_TEST(test("x", char_('x') | char_('i')));
- BOOST_TEST(test("xi", char_('x') << char_('i') | char_('i')));
-
- variant<int, char> v (10);
- BOOST_TEST(test("10", char_ | int_, v));
- BOOST_TEST(test("a", char_('a') | char_ | int_, v));
-
- v = 'c';
- BOOST_TEST(test("c", char_ | int_, v));
- BOOST_TEST(test("a", char_('a') | char_ | int_, v));
- }
-
- {
- // test if alternatives with all components having unused
- // parameter return attributes them self
- fusion::vector<char, char> v('a', 'b');
- BOOST_TEST(test("axb", char_ << (char_('x') | char_('i')) << char_, v));
- BOOST_TEST(test("axib",
- char_ << (char_('x') << char_('i') | char_('i')) << char_, v));
- }
-
- {
- BOOST_TEST(test_delimited("x ", char_('x') | char_('i'), char_(' ')));
- BOOST_TEST(test_delimited("x i ",
- char_('x') << char_('i') | char_('i'), char_(' ')));
-
- variant<int, char> v (10);
- BOOST_TEST(test_delimited("10 ", char_ | int_, v, char_(' ')));
-
- v = 'c';
- BOOST_TEST(test_delimited("c ", char_ | int_, v, char_(' ')));
- }
-
- {
- // if nothing matches, the first explicit alternative will be chosen
- variant<double, char const*> v (10.0);
- BOOST_TEST(test("11", char_ | int_(11), v));
- BOOST_TEST(test("10.0", double_ | int_(11), v));
- BOOST_TEST(!test("", char_ | int_, v));
-
- v = "c";
- BOOST_TEST(test("11", char_ | int_(11), v));
- BOOST_TEST(test("11", double_ | int_(11), v));
- BOOST_TEST(!test("", char_ | int_, v));
- }
-
- {
- // if nothing matches, the first explicit alternative will be chosen
- variant<double, char const*> v (10.0);
- BOOST_TEST(test_delimited("11 ", char_ | int_(11), v, char_(' ')));
-
- v = "c";
- BOOST_TEST(test_delimited("11 ", char_ | int_(11), v, char_(' ')));
- }
+ BOOST_TEST(test("x", char_('x') | char_('i')));
+ BOOST_TEST(test("xi", char_('x') << char_('i') | char_('i')));
+ BOOST_TEST(test("i", char_('i') | char_('x') << char_('i')));
+
+ variant<int, char> v (10);
+ BOOST_TEST(test("10", char_ | int_, v));
+ BOOST_TEST(test("10", int_ | char_, v));
+ BOOST_TEST(test("a", lit('a') | char_ | int_, v));
+ BOOST_TEST(test("a", char_ | lit('a') | int_, v));
+ BOOST_TEST(test("10", int_ | lit('a') | char_, v));
+
+ v = 'c';
+ BOOST_TEST(test("c", char_ | int_, v));
+ BOOST_TEST(test("a", lit('a') | char_ | int_, v));
+ BOOST_TEST(test("c", char_ | lit('a') | int_, v));
+ BOOST_TEST(test("a", int_ | lit('a') | char_, v));
+ BOOST_TEST(test("c", int_ | char_ | lit('a'), v));
     }
-
+
+ {
+ // test if alternatives with all components having unused
+ // attribute generate first alternative
+ fusion::vector<char, char> v('a', 'b');
+ BOOST_TEST(test("axb", char_ << (lit('x') | lit('i')) << char_, v));
+ BOOST_TEST(test("axib",
+ char_ << (lit('x') << lit('i') | lit('i')) << char_, v));
+ }
+
+ {
+ BOOST_TEST(test_delimited("x ", char_('x') | char_('i'), char_(' ')));
+ BOOST_TEST(test_delimited("x i ",
+ char_('x') << char_('i') | char_('i'), char_(' ')));
+ BOOST_TEST(test_delimited("i ",
+ char_('i') | char_('x') << char_('i'), char_(' ')));
+
+ variant<int, char> v (10);
+ BOOST_TEST(test_delimited("10 ", char_ | int_, v, char_(' ')));
+ BOOST_TEST(test_delimited("10 ", int_ | char_, v, char_(' ')));
+ BOOST_TEST(test_delimited("a ", lit('a') | char_ | int_, v, char_(' ')));
+ BOOST_TEST(test_delimited("a ", char_ | lit('a') | int_, v, char_(' ')));
+ BOOST_TEST(test_delimited("10 ", int_ | lit('a') | char_, v, char_(' ')));
+
+ v = 'c';
+ BOOST_TEST(test_delimited("c ", char_ | int_, v, char_(' ')));
+ BOOST_TEST(test_delimited("a ", lit('a') | char_ | int_, v, char_(' ')));
+ BOOST_TEST(test_delimited("c ", char_ | lit('a') | int_, v, char_(' ')));
+ BOOST_TEST(test_delimited("a ", int_ | lit('a') | char_, v, char_(' ')));
+ BOOST_TEST(test_delimited("c ", int_ | char_ | lit('a'), v, char_(' ')));
+ }
+
+ {
+ // if nothing matches, the first explicit alternative will be chosen
+ variant<double, char const*> v (10.0);
+ BOOST_TEST(test("11", char_ | lit(11), v));
+ BOOST_TEST(test("11", lit(11) | char_ , v));
+ BOOST_TEST(test("10.0", double_ | lit(11), v));
+ BOOST_TEST(test("11", lit(11) | double_, v));
+ BOOST_TEST(!test("", char_ | int_, v));
+
+ v = "c";
+ BOOST_TEST(test("11", char_ | lit(11), v));
+ BOOST_TEST(test("11", double_ | lit(11), v));
+ BOOST_TEST(!test("", char_ | int_, v));
+ }
+
+ {
+ // if nothing matches, the first explicit alternative will be chosen
+ variant<double, char const*> v (10.0);
+ BOOST_TEST(test_delimited("11 ", char_ | lit(11), v, char_(' ')));
+ BOOST_TEST(test_delimited("11 ", lit(11) | char_ , v, char_(' ')));
+ BOOST_TEST(test_delimited("10.0 ", double_ | lit(11), v, char_(' ')));
+ BOOST_TEST(test_delimited("11 ", lit(11) | double_, v, char_(' ')));
+ BOOST_TEST(!test_delimited("", char_ | int_, v, char_(' ')));
+
+ v = "c";
+ BOOST_TEST(test_delimited("11 ", char_ | lit(11), v, char_(' ')));
+ BOOST_TEST(test_delimited("11 ", double_ | lit(11), v, char_(' ')));
+ BOOST_TEST(!test_delimited("", char_ | int_, v, char_(' ')));
+ }
+
+ {
+ std::vector<int> v;
+ BOOST_TEST(test("[]", '[' << (int_ % ", ") << ']' | "[]", v));
+ BOOST_TEST(test("[]", '[' << -(int_ % ", ") << ']', v));
+ BOOST_TEST(test("[]", '[' << ((int_ % ", ") | eps) << ']', v));
+
+ v.push_back(5);
+ v.push_back(5);
+ v.push_back(5);
+ BOOST_TEST(test("[5, 5, 5]", '[' << (int_ % ", ") << ']' | "[]", v));
+ }
+
     return boost::report_errors();
 }
 

Modified: branches/release/libs/spirit/test/karma/binary.cpp
==============================================================================
--- branches/release/libs/spirit/test/karma/binary.cpp (original)
+++ branches/release/libs/spirit/test/karma/binary.cpp 2009-09-14 12:45:39 EDT (Mon, 14 Sep 2009)
@@ -6,7 +6,6 @@
 #include <boost/config/warning_disable.hpp>
 #include <boost/detail/lightweight_test.hpp>
 
-#include <boost/spirit/include/support_argument.hpp>
 #include <boost/spirit/include/karma_binary.hpp>
 #include <boost/spirit/include/karma_generate.hpp>
 
@@ -20,11 +19,10 @@
 {
     using namespace boost::spirit;
     using namespace boost::phoenix;
- using namespace boost::spirit::arg_names;
 
     { // test native endian binaries
 #ifdef BOOST_LITTLE_ENDIAN
- BOOST_TEST(binary_test("\x01", 1, byte, 0x01));
+ BOOST_TEST(binary_test("\x01", 1, byte_, 0x01));
         BOOST_TEST(binary_test("\x01\x02", 2, word, 0x0201));
         BOOST_TEST(binary_test("\x01\x02\x03\x04", 4, dword, 0x04030201));
 #ifdef BOOST_HAS_LONG_LONG
@@ -32,7 +30,7 @@
             0x0807060504030201LL));
 #endif
 
- BOOST_TEST(binary_test_delimited("\x01\x00\x00\x00", 4, byte, 0x01, pad(4)));
+ BOOST_TEST(binary_test_delimited("\x01\x00\x00\x00", 4, byte_, 0x01, pad(4)));
         BOOST_TEST(binary_test_delimited("\x01\x02\x00\x00", 4, word, 0x0201, pad(4)));
         BOOST_TEST(binary_test_delimited("\x01\x02\x03\x04", 4, dword, 0x04030201, pad(4)));
 #ifdef BOOST_HAS_LONG_LONG
@@ -42,7 +40,7 @@
 
 #else // BOOST_LITTLE_ENDIAN
 
- BOOST_TEST(binary_test("\x01", 1, byte, 0x01));
+ BOOST_TEST(binary_test("\x01", 1, byte_, 0x01));
         BOOST_TEST(binary_test("\x01\x02", 2, word, 0x0102));
         BOOST_TEST(binary_test("\x01\x02\x03\x04", 4, dword, 0x01020304));
 #ifdef BOOST_HAS_LONG_LONG
@@ -50,7 +48,7 @@
             0x0102030405060708LL));
 #endif
 
- BOOST_TEST(binary_test_delimited("\x01\x00\x00\x00", 4, byte, 0x01, pad(4)));
+ BOOST_TEST(binary_test_delimited("\x01\x00\x00\x00", 4, byte_, 0x01, pad(4)));
         BOOST_TEST(binary_test_delimited("\x01\x02\x00\x00", 4, word, 0x0102, pad(4)));
         BOOST_TEST(binary_test_delimited("\x01\x02\x03\x04", 4, dword, 0x01020304, pad(4)));
 #ifdef BOOST_HAS_LONG_LONG
@@ -62,7 +60,7 @@
 
     { // test native endian binaries
 #ifdef BOOST_LITTLE_ENDIAN
- BOOST_TEST(binary_test("\x01", 1, byte(0x01)));
+ BOOST_TEST(binary_test("\x01", 1, byte_(0x01)));
         BOOST_TEST(binary_test("\x01\x02", 2, word(0x0201)));
         BOOST_TEST(binary_test("\x01\x02\x03\x04", 4, dword(0x04030201)));
 #ifdef BOOST_HAS_LONG_LONG
@@ -70,7 +68,7 @@
             qword(0x0807060504030201LL)));
 #endif
 #else
- BOOST_TEST(binary_test("\x01", 1, byte(0x01)));
+ BOOST_TEST(binary_test("\x01", 1, byte_(0x01)));
         BOOST_TEST(binary_test("\x01\x02", 2, word(0x0102)));
         BOOST_TEST(binary_test("\x01\x02\x03\x04", 4, dword(0x01020304)));
 #ifdef BOOST_HAS_LONG_LONG
@@ -86,6 +84,8 @@
 #ifdef BOOST_HAS_LONG_LONG
         BOOST_TEST(binary_test("\x01\x02\x03\x04\x05\x06\x07\x08", 8, big_qword,
             0x0102030405060708LL));
+ BOOST_TEST(binary_test_delimited("\x01\x02\x03\x04\x05\x06\x07\x08\x00\x00",
+ 10, big_qword, 0x0102030405060708LL, pad(10)));
 #endif
     }
 
@@ -95,6 +95,8 @@
 #ifdef BOOST_HAS_LONG_LONG
         BOOST_TEST(binary_test("\x01\x02\x03\x04\x05\x06\x07\x08", 8,
             big_qword(0x0102030405060708LL)));
+ BOOST_TEST(binary_test_delimited("\x01\x02\x03\x04\x05\x06\x07\x08\x00\x00",
+ 10, big_qword(0x0102030405060708LL), pad(10)));
 #endif
     }
 
@@ -104,6 +106,8 @@
 #ifdef BOOST_HAS_LONG_LONG
         BOOST_TEST(binary_test("\x01\x02\x03\x04\x05\x06\x07\x08", 8, little_qword,
             0x0807060504030201LL));
+ BOOST_TEST(binary_test_delimited("\x01\x02\x03\x04\x05\x06\x07\x08\x00\x00",
+ 10, little_qword, 0x0807060504030201LL, pad(10)));
 #endif
     }
 
@@ -113,6 +117,8 @@
 #ifdef BOOST_HAS_LONG_LONG
         BOOST_TEST(binary_test("\x01\x02\x03\x04\x05\x06\x07\x08", 8,
             little_qword(0x0807060504030201LL)));
+ BOOST_TEST(binary_test_delimited("\x01\x02\x03\x04\x05\x06\x07\x08\x00\x00",
+ 10, little_qword(0x0807060504030201LL), pad(10)));
 #endif
     }
 

Modified: branches/release/libs/spirit/test/karma/case_handling.cpp
==============================================================================
--- branches/release/libs/spirit/test/karma/case_handling.cpp (original)
+++ branches/release/libs/spirit/test/karma/case_handling.cpp 2009-09-14 12:45:39 EDT (Mon, 14 Sep 2009)
@@ -23,11 +23,9 @@
 
     {
         using namespace boost::spirit::ascii;
-
+
         BOOST_TEST(test("x", lower['X']));
         BOOST_TEST(test("x", lower['x']));
- BOOST_TEST(test(L"x", lower[L'X']));
- BOOST_TEST(test(L"x", lower[L'x']));
 
         BOOST_TEST(test("x", lower[char_], 'X'));
         BOOST_TEST(test("x", lower[char_], 'x'));
@@ -36,141 +34,233 @@
 
         BOOST_TEST(test(" ", lower[space]));
         BOOST_TEST(test("\t", lower[space], '\t'));
- BOOST_TEST(test("\t", lower[space('\t')]));
-
+
         BOOST_TEST(test("x", lower[lower['X']]));
         BOOST_TEST(test("x", lower[lower['x']]));
- BOOST_TEST(test(L"x", lower[lower[L'X']]));
- BOOST_TEST(test(L"x", lower[lower[L'x']]));
 
         BOOST_TEST(test("x", lower[lower[char_]], 'X'));
         BOOST_TEST(test("x", lower[lower[char_]], 'x'));
         BOOST_TEST(test("x", lower[lower[char_('X')]]));
         BOOST_TEST(test("x", lower[lower[char_('x')]]));
-
+
         BOOST_TEST(test(" ", lower[lower[space]]));
         BOOST_TEST(test("\t", lower[lower[space]], '\t'));
- BOOST_TEST(test("\t", lower[lower[space('\t')]]));
 
         BOOST_TEST(test("X", upper[lower['X']]));
         BOOST_TEST(test("X", upper[lower['x']]));
- BOOST_TEST(test(L"X", upper[lower[L'X']]));
- BOOST_TEST(test(L"X", upper[lower[L'x']]));
 
         BOOST_TEST(test("X", upper[lower[char_]], 'X'));
         BOOST_TEST(test("X", upper[lower[char_]], 'x'));
         BOOST_TEST(test("X", upper[lower[char_('X')]]));
         BOOST_TEST(test("X", upper[lower[char_('x')]]));
-
+
         BOOST_TEST(test(" ", upper[lower[space]]));
         BOOST_TEST(test("\t", upper[lower[space]], '\t'));
- BOOST_TEST(test("\t", upper[lower[space('\t')]]));
 
         BOOST_TEST(test("X", upper['X']));
         BOOST_TEST(test("X", upper['x']));
- BOOST_TEST(test(L"X", upper[L'X']));
- BOOST_TEST(test(L"X", upper[L'x']));
 
         BOOST_TEST(test("X", upper[char_], 'X'));
         BOOST_TEST(test("X", upper[char_], 'x'));
         BOOST_TEST(test("X", upper[char_('X')]));
         BOOST_TEST(test("X", upper[char_('x')]));
-
+
         BOOST_TEST(test(" ", upper[space]));
         BOOST_TEST(test("\t", upper[space], '\t'));
- BOOST_TEST(test("\t", upper[space('\t')]));
 
         BOOST_TEST(test("x", lower[upper['X']]));
         BOOST_TEST(test("x", lower[upper['x']]));
- BOOST_TEST(test(L"x", lower[upper[L'X']]));
- BOOST_TEST(test(L"x", lower[upper[L'x']]));
 
         BOOST_TEST(test("x", lower[upper[char_]], 'X'));
         BOOST_TEST(test("x", lower[upper[char_]], 'x'));
         BOOST_TEST(test("x", lower[upper[char_('X')]]));
         BOOST_TEST(test("x", lower[upper[char_('x')]]));
-
+
         BOOST_TEST(test(" ", lower[upper[space]]));
         BOOST_TEST(test("\t", lower[upper[space]], '\t'));
- BOOST_TEST(test("\t", lower[upper[space('\t')]]));
 
         BOOST_TEST(test("X", upper[upper['X']]));
         BOOST_TEST(test("X", upper[upper['x']]));
- BOOST_TEST(test(L"X", upper[upper[L'X']]));
- BOOST_TEST(test(L"X", upper[upper[L'x']]));
 
         BOOST_TEST(test("X", upper[upper[char_]], 'X'));
         BOOST_TEST(test("X", upper[upper[char_]], 'x'));
         BOOST_TEST(test("X", upper[upper[char_('X')]]));
         BOOST_TEST(test("X", upper[upper[char_('x')]]));
-
+
         BOOST_TEST(test(" ", upper[upper[space]]));
         BOOST_TEST(test("\t", upper[upper[space]], '\t'));
- BOOST_TEST(test("\t", upper[upper[space('\t')]]));
+ }
+
+ {
+ using namespace boost::spirit::standard_wide;
+
+ BOOST_TEST(test(L"x", lower[L'X']));
+ BOOST_TEST(test(L"x", lower[L'x']));
+
+ BOOST_TEST(test(L"x", lower[char_], L'X'));
+ BOOST_TEST(test(L"x", lower[char_], L'x'));
+ BOOST_TEST(test(L"x", lower[char_(L'X')]));
+ BOOST_TEST(test(L"x", lower[char_(L'x')]));
+
+ BOOST_TEST(test(L" ", lower[space]));
+ BOOST_TEST(test(L"\t", lower[space], L'\t'));
+
+ BOOST_TEST(test(L"x", lower[lower[L'X']]));
+ BOOST_TEST(test(L"x", lower[lower[L'x']]));
+
+ BOOST_TEST(test(L"x", lower[lower[char_]], L'X'));
+ BOOST_TEST(test(L"x", lower[lower[char_]], L'x'));
+ BOOST_TEST(test(L"x", lower[lower[char_(L'X')]]));
+ BOOST_TEST(test(L"x", lower[lower[char_(L'x')]]));
+
+ BOOST_TEST(test(L" ", lower[lower[space]]));
+ BOOST_TEST(test(L"\t", lower[lower[space]], L'\t'));
+
+ BOOST_TEST(test(L"X", upper[lower[L'X']]));
+ BOOST_TEST(test(L"X", upper[lower[L'x']]));
+
+ BOOST_TEST(test(L"X", upper[lower[char_]], L'X'));
+ BOOST_TEST(test(L"X", upper[lower[char_]], L'x'));
+ BOOST_TEST(test(L"X", upper[lower[char_(L'X')]]));
+ BOOST_TEST(test(L"X", upper[lower[char_(L'x')]]));
+
+ BOOST_TEST(test(L" ", upper[lower[space]]));
+ BOOST_TEST(test(L"\t", upper[lower[space]], L'\t'));
+
+ BOOST_TEST(test(L"X", upper[L'X']));
+ BOOST_TEST(test(L"X", upper[L'x']));
+
+ BOOST_TEST(test(L"X", upper[char_], L'X'));
+ BOOST_TEST(test(L"X", upper[char_], L'x'));
+ BOOST_TEST(test(L"X", upper[char_(L'X')]));
+ BOOST_TEST(test(L"X", upper[char_(L'x')]));
+
+ BOOST_TEST(test(L" ", upper[space]));
+ BOOST_TEST(test(L"\t", upper[space], L'\t'));
+
+ BOOST_TEST(test(L"x", lower[upper[L'X']]));
+ BOOST_TEST(test(L"x", lower[upper[L'x']]));
+
+ BOOST_TEST(test(L"x", lower[upper[char_]], L'X'));
+ BOOST_TEST(test(L"x", lower[upper[char_]], L'x'));
+ BOOST_TEST(test(L"x", lower[upper[char_(L'X')]]));
+ BOOST_TEST(test(L"x", lower[upper[char_(L'x')]]));
+
+ BOOST_TEST(test(L" ", lower[upper[space]]));
+ BOOST_TEST(test(L"\t", lower[upper[space]], L'\t'));
+
+ BOOST_TEST(test(L"X", upper[upper[L'X']]));
+ BOOST_TEST(test(L"X", upper[upper[L'x']]));
+
+ BOOST_TEST(test(L"X", upper[upper[char_]], L'X'));
+ BOOST_TEST(test(L"X", upper[upper[char_]], L'x'));
+ BOOST_TEST(test(L"X", upper[upper[char_(L'X')]]));
+ BOOST_TEST(test(L"X", upper[upper[char_(L'x')]]));
+
+ BOOST_TEST(test(L" ", upper[upper[space]]));
+ BOOST_TEST(test(L"\t", upper[upper[space]], L'\t'));
+ }
+
+ {
+ using namespace boost::spirit::iso8859_1;
+
+ BOOST_TEST(test("ä", lower['Ä']));
+ BOOST_TEST(test("ä", lower['ä']));
+
+ BOOST_TEST(test("Ä", upper['Ä']));
+ BOOST_TEST(test("Ä", upper['ä']));
     }
 
     {
         using namespace boost::spirit::ascii;
-
+
         BOOST_TEST(test("a1- ", lower["a1- "]));
         BOOST_TEST(test("a1- ", lower["a1- "]));
         BOOST_TEST(test("a1- ", lower["a1- "]));
         BOOST_TEST(test("a1- ", lower["A1- "]));
-
- BOOST_TEST(test("a1- ", lower[lit], "a1- "));
- BOOST_TEST(test("a1- ", lower[lit], "A1- "));
+
+ BOOST_TEST(test("a1- ", lower[string], "a1- "));
+ BOOST_TEST(test("a1- ", lower[string], "A1- "));
         BOOST_TEST(test("a1- ", lower[lit("a1- ")]));
         BOOST_TEST(test("a1- ", lower[lit("A1- ")]));
+ BOOST_TEST(test("a1- ", lower[string("a1- ")]));
+ BOOST_TEST(test("a1- ", lower[string("A1- ")]));
 
         BOOST_TEST(test("a1- ", lower[lower["a1- "]]));
         BOOST_TEST(test("a1- ", lower[lower["a1- "]]));
         BOOST_TEST(test("a1- ", lower[lower["a1- "]]));
         BOOST_TEST(test("a1- ", lower[lower["A1- "]]));
-
- BOOST_TEST(test("a1- ", lower[lower[lit]], "a1- "));
- BOOST_TEST(test("a1- ", lower[lower[lit]], "A1- "));
+
+ BOOST_TEST(test("a1- ", lower[lower[string]], "a1- "));
+ BOOST_TEST(test("a1- ", lower[lower[string]], "A1- "));
         BOOST_TEST(test("a1- ", lower[lower[lit("a1- ")]]));
         BOOST_TEST(test("a1- ", lower[lower[lit("A1- ")]]));
-
+ BOOST_TEST(test("a1- ", lower[lower[string("a1- ")]]));
+ BOOST_TEST(test("a1- ", lower[lower[string("A1- ")]]));
+
         BOOST_TEST(test("A1- ", upper[lower["a1- "]]));
         BOOST_TEST(test("A1- ", upper[lower["a1- "]]));
         BOOST_TEST(test("A1- ", upper[lower["a1- "]]));
         BOOST_TEST(test("A1- ", upper[lower["A1- "]]));
-
- BOOST_TEST(test("A1- ", upper[lower[lit]], "a1- "));
- BOOST_TEST(test("A1- ", upper[lower[lit]], "A1- "));
+
+ BOOST_TEST(test("A1- ", upper[lower[string]], "a1- "));
+ BOOST_TEST(test("A1- ", upper[lower[string]], "A1- "));
         BOOST_TEST(test("A1- ", upper[lower[lit("a1- ")]]));
         BOOST_TEST(test("A1- ", upper[lower[lit("A1- ")]]));
-
+ BOOST_TEST(test("A1- ", upper[lower[string("a1- ")]]));
+ BOOST_TEST(test("A1- ", upper[lower[string("A1- ")]]));
+
         BOOST_TEST(test("A1- ", upper["a1- "]));
         BOOST_TEST(test("A1- ", upper["a1- "]));
         BOOST_TEST(test("A1- ", upper["a1- "]));
         BOOST_TEST(test("A1- ", upper["A1- "]));
-
- BOOST_TEST(test("A1- ", upper[lit], "a1- "));
- BOOST_TEST(test("A1- ", upper[lit], "A1- "));
+
+ BOOST_TEST(test("A1- ", upper[string], "a1- "));
+ BOOST_TEST(test("A1- ", upper[string], "A1- "));
         BOOST_TEST(test("A1- ", upper[lit("a1- ")]));
         BOOST_TEST(test("A1- ", upper[lit("A1- ")]));
-
+
         BOOST_TEST(test("a1- ", lower[upper["a1- "]]));
         BOOST_TEST(test("a1- ", lower[upper["a1- "]]));
         BOOST_TEST(test("a1- ", lower[upper["a1- "]]));
         BOOST_TEST(test("a1- ", lower[upper["A1- "]]));
-
- BOOST_TEST(test("a1- ", lower[upper[lit]], "a1- "));
- BOOST_TEST(test("a1- ", lower[upper[lit]], "A1- "));
+
+ BOOST_TEST(test("a1- ", lower[upper[string]], "a1- "));
+ BOOST_TEST(test("a1- ", lower[upper[string]], "A1- "));
         BOOST_TEST(test("a1- ", lower[upper[lit("a1- ")]]));
         BOOST_TEST(test("a1- ", lower[upper[lit("A1- ")]]));
-
+ BOOST_TEST(test("a1- ", lower[upper[string("a1- ")]]));
+ BOOST_TEST(test("a1- ", lower[upper[string("A1- ")]]));
+
         BOOST_TEST(test("A1- ", upper[upper["a1- "]]));
         BOOST_TEST(test("A1- ", upper[upper["a1- "]]));
         BOOST_TEST(test("A1- ", upper[upper["a1- "]]));
         BOOST_TEST(test("A1- ", upper[upper["A1- "]]));
-
- BOOST_TEST(test("A1- ", upper[upper[lit]], "a1- "));
- BOOST_TEST(test("A1- ", upper[upper[lit]], "A1- "));
+
+ BOOST_TEST(test("A1- ", upper[upper[string]], "a1- "));
+ BOOST_TEST(test("A1- ", upper[upper[string]], "A1- "));
         BOOST_TEST(test("A1- ", upper[upper[lit("a1- ")]]));
         BOOST_TEST(test("A1- ", upper[upper[lit("A1- ")]]));
+ BOOST_TEST(test("A1- ", upper[upper[string("a1- ")]]));
+ BOOST_TEST(test("A1- ", upper[upper[string("A1- ")]]));
+ }
+
+ {
+ using namespace boost::spirit::iso8859_1;
+
+ BOOST_TEST(test("ää", lower["Ää"]));
+ BOOST_TEST(test("ää", lower["Ää"]));
+
+ BOOST_TEST(test("ÄÄ", upper["Ää"]));
+ BOOST_TEST(test("ÄÄ", upper["Ää"]));
+ }
+
+ {
+ using namespace boost::spirit::ascii;
+ using boost::phoenix::val;
+
+ BOOST_TEST(test("x", lower[val('X')]));
+ BOOST_TEST(test("x", lower[val('x')]));
     }
 
     return boost::report_errors();

Modified: branches/release/libs/spirit/test/karma/center_alignment.cpp
==============================================================================
--- branches/release/libs/spirit/test/karma/center_alignment.cpp (original)
+++ branches/release/libs/spirit/test/karma/center_alignment.cpp 2009-09-14 12:45:39 EDT (Mon, 14 Sep 2009)
@@ -17,19 +17,19 @@
 
 #include "test.hpp"
 
-using namespace spirit_test;
-
 ///////////////////////////////////////////////////////////////////////////////
 int
 main()
 {
+ using namespace spirit_test;
     using namespace boost::spirit;
+ using namespace boost::spirit::ascii;
 
     {
         BOOST_TEST(test(" x ", center[char_('x')]));
         BOOST_TEST(test(" x ", center[char_], 'x'));
         BOOST_TEST(test(" x ", center['x']));
-
+
         BOOST_TEST(test(" x ", center(10)[char_('x')]));
         BOOST_TEST(test(" x ", center(10)[char_], 'x'));
         BOOST_TEST(test(" x ", center(10)['x']));
@@ -45,36 +45,39 @@
         BOOST_TEST(test(" x ", center(11)[char_('x')]));
 
         BOOST_TEST(test(" abc ", center[lit("abc")]));
- BOOST_TEST(test(" abc ", center[lit], "abc"));
+ BOOST_TEST(test(" abc ", center[string], "abc"));
                               
         BOOST_TEST(test(" abc ", center(10)[lit("abc")]));
- BOOST_TEST(test(" abc ", center(10)[lit], "abc"));
+ BOOST_TEST(test(" abc ", center(10)[string], "abc"));
         BOOST_TEST(test(" abc ", center(10)["abc"]));
 
+ BOOST_TEST(test(" abc ", center(11)[lit("abc")]));
+ BOOST_TEST(test(" ab ", center(11)[lit("ab")]));
+
         BOOST_TEST(test("****abc***", center(10, char_('*'))[lit("abc")]));
- BOOST_TEST(test("****abc***", center(10, '*')[lit], "abc"));
+ BOOST_TEST(test("****abc***", center(10, '*')[string], "abc"));
         BOOST_TEST(test("****abc***", center(10, '*')["abc"]));
 
         BOOST_TEST(test("****abc***", center(char_('*'))[lit("abc")]));
- BOOST_TEST(test("****abc***", center(char_('*'))[lit], "abc"));
+ BOOST_TEST(test("****abc***", center(char_('*'))[string], "abc"));
         BOOST_TEST(test("****abc***", center(char_('*'))["abc"]));
 
         BOOST_TEST(test(" abc ", center(11)[lit("abc")]));
 
         BOOST_TEST(test(" 100 ", center[int_(100)]));
         BOOST_TEST(test(" 100 ", center[int_], 100));
-
+
         BOOST_TEST(test(" 100 ", center(10)[int_(100)]));
         BOOST_TEST(test(" 100 ", center(10)[int_], 100));
-
+
         BOOST_TEST(test("****100***", center(10, char_('*'))[int_(100)]));
         BOOST_TEST(test("****100***", center(10, '*')[int_], 100));
-
+
         BOOST_TEST(test(" 100 ", center(11)[int_(100)]));
 
         BOOST_TEST(test("****100***", center(char_('*'))[int_(100)]));
         BOOST_TEST(test("****100***", center(char_('*'))[int_], 100));
     }
-
+
     return boost::report_errors();
 }

Modified: branches/release/libs/spirit/test/karma/char.cpp
==============================================================================
--- branches/release/libs/spirit/test/karma/char.cpp (original)
+++ branches/release/libs/spirit/test/karma/char.cpp 2009-09-14 12:45:39 EDT (Mon, 14 Sep 2009)
@@ -8,7 +8,6 @@
 #include <boost/config/warning_disable.hpp>
 #include <boost/detail/lightweight_test.hpp>
 
-#include <boost/spirit/include/support_argument.hpp>
 #include <boost/spirit/include/karma_char.hpp>
 #include <boost/spirit/include/karma_generate.hpp>
 #include <boost/spirit/include/karma_action.hpp>
@@ -27,125 +26,230 @@
 {
     using namespace boost::spirit;
     using namespace boost::phoenix;
- using namespace boost::spirit::arg_names;
-
+
     {
         using namespace boost::spirit::ascii;
-
- BOOST_TEST(test(" ", space));
- BOOST_TEST(test(L" ", space));
- BOOST_TEST(!test("\t", space));
- BOOST_TEST(!test(L"\t", space));
-
- BOOST_TEST(test(" ", space(' ')));
- BOOST_TEST(test(L" ", space(L' ')));
- BOOST_TEST(test("\t", space('\t')));
- BOOST_TEST(test(L"\t", space(L'\t')));
-
- BOOST_TEST(test(" ", space(' '), '\t'));
- BOOST_TEST(test(L" ", space(' '), L'\t'));
- BOOST_TEST(test("\t", space('\t'), ' '));
- BOOST_TEST(test(L"\t", space('\t'), L' '));
-
- BOOST_TEST(test(" ", space, ' '));
- BOOST_TEST(test(L" ", space, L' '));
- BOOST_TEST(test("\t", space, '\t'));
- BOOST_TEST(test(L"\t", space, L'\t'));
- }
-
- {
+
         BOOST_TEST(test("x", 'x'));
         BOOST_TEST(test(L"x", L'x'));
         BOOST_TEST(!test("x", 'y'));
         BOOST_TEST(!test(L"x", L'y'));
-
+
+ BOOST_TEST(test("x", "x"));
+ BOOST_TEST(test(L"x", L"x"));
+ BOOST_TEST(!test("x", "y"));
+ BOOST_TEST(!test(L"x", L"y"));
+
         BOOST_TEST(test("x", char_, 'x'));
         BOOST_TEST(test(L"x", char_, L'x'));
         BOOST_TEST(!test("x", char_, 'y'));
         BOOST_TEST(!test(L"x", char_, L'y'));
-
+
         BOOST_TEST(test("x", char_('x')));
         BOOST_TEST(!test("x", char_('y')));
+
+ BOOST_TEST(test("x", char_('x'), 'x'));
+ BOOST_TEST(!test("", char_('y'), 'x'));
+
+ BOOST_TEST(test("x", char_("x")));
+
+ BOOST_TEST(test("a", char_('a', 'z'), 'a'));
+ BOOST_TEST(test("b", char_('a', 'z'), 'b'));
+ BOOST_TEST(!test("", char_('a', 'z'), 'A'));
+
+ BOOST_TEST(test("a", char_("a-z"), 'a'));
+ BOOST_TEST(test("b", char_("a-z"), 'b'));
+ BOOST_TEST(!test("", char_("a-z"), 'A'));
+
+#if defined(KARMA_FAIL_COMPILATION)
+ BOOST_TEST(test("x", char_)); // anychar without a parameter doesn't make any sense
+ BOOST_TEST(test("", char_('a', 'z'))); // char sets without attribute neither
+#endif
+
+ BOOST_TEST(!test("", ~char_('x')));
+
+ BOOST_TEST(!test("", ~char_('x'), 'x'));
+ BOOST_TEST(test("x", ~char_('y'), 'x'));
+
+ BOOST_TEST(!test("", ~char_("x")));
+
+ BOOST_TEST(!test("", ~char_('a', 'z'), 'a'));
+ BOOST_TEST(!test("", ~char_('a', 'z'), 'b'));
+ BOOST_TEST(test("A", ~char_('a', 'z'), 'A'));
+
+ BOOST_TEST(!test("", ~char_("a-z"), 'a'));
+ BOOST_TEST(!test("", ~char_("a-z"), 'b'));
+ BOOST_TEST(test("A", ~char_("a-z"), 'A'));
+
+ BOOST_TEST(test("x", ~~char_('x')));
+ BOOST_TEST(!test("x", ~~char_('y')));
+
+ BOOST_TEST(test("x", ~~char_('x'), 'x'));
+ BOOST_TEST(!test("", ~~char_('y'), 'x'));
+
+ BOOST_TEST(test("x", ~~char_("x")));
+
+ BOOST_TEST(test("a", ~~char_('a', 'z'), 'a'));
+ BOOST_TEST(test("b", ~~char_('a', 'z'), 'b'));
+ BOOST_TEST(!test("", ~~char_('a', 'z'), 'A'));
+
+ BOOST_TEST(test("a", ~~char_("a-z"), 'a'));
+ BOOST_TEST(test("b", ~~char_("a-z"), 'b'));
+ BOOST_TEST(!test("", ~~char_("a-z"), 'A'));
+ }
+
+ {
+ using namespace boost::spirit::standard_wide;
+
+ BOOST_TEST(test(L"x", 'x'));
+ BOOST_TEST(test(L"x", L'x'));
+ BOOST_TEST(!test(L"x", 'y'));
+ BOOST_TEST(!test(L"x", L'y'));
+
+ BOOST_TEST(test(L"x", "x"));
+ BOOST_TEST(test(L"x", L"x"));
+ BOOST_TEST(!test(L"x", "y"));
+ BOOST_TEST(!test(L"x", L"y"));
+
+ BOOST_TEST(test(L"x", char_, 'x'));
+ BOOST_TEST(test(L"x", char_, L'x'));
+ BOOST_TEST(!test(L"x", char_, 'y'));
+ BOOST_TEST(!test(L"x", char_, L'y'));
+
+ BOOST_TEST(test(L"x", char_('x')));
         BOOST_TEST(test(L"x", char_(L'x')));
+ BOOST_TEST(!test(L"x", char_('y')));
         BOOST_TEST(!test(L"x", char_(L'y')));
 
-// BOOST_TEST(test("x", char_("x")));
-// BOOST_TEST(test(L"x", char_(L"x")));
+ BOOST_TEST(test(L"x", char_(L'x'), L'x'));
+ BOOST_TEST(!test(L"", char_('y'), L'x'));
+
+ BOOST_TEST(test(L"x", char_(L"x")));
 
 #if defined(KARMA_FAIL_COMPILATION)
         BOOST_TEST(test("x", char_)); // anychar without a parameter doesn't make any sense
 #endif
+
+ BOOST_TEST(!test(L"", ~char_('x')));
+ BOOST_TEST(!test(L"", ~char_(L'x')));
+
+ BOOST_TEST(!test(L"", ~char_(L'x'), L'x'));
+ BOOST_TEST(test(L"x", ~char_('y'), L'x'));
+
+ BOOST_TEST(!test(L"", ~char_(L"x")));
     }
 
     {
- BOOST_TEST(test(L"x", L'x'));
- BOOST_TEST(test(L"x", 'x'));
+ using namespace boost::spirit::ascii;
+
+ BOOST_TEST(test(" ", space));
+ BOOST_TEST(test(L" ", space));
+ BOOST_TEST(!test("\t", space));
+ BOOST_TEST(!test(L"\t", space));
+
+ BOOST_TEST(test(" ", space, ' '));
+ BOOST_TEST(test(L" ", space, L' '));
+ BOOST_TEST(test("\t", space, '\t'));
+ BOOST_TEST(test(L"\t", space, L'\t'));
+
+ BOOST_TEST(!test("", space, 'x'));
+ BOOST_TEST(!test(L"", space, L'x'));
+
+ BOOST_TEST(!test(" ", ~space, ' '));
+ BOOST_TEST(!test(L" ", ~space, L' '));
+
+ BOOST_TEST(test("x", ~space, 'x'));
+ BOOST_TEST(test(L"x", ~space, L'x'));
+ }
+
+ {
+ using namespace boost::spirit::standard_wide;
+
+ BOOST_TEST(test(" ", space));
+ BOOST_TEST(test(L" ", space));
+ BOOST_TEST(!test("\t", space));
+ BOOST_TEST(!test(L"\t", space));
 
- BOOST_TEST(test(L"x", wchar, L'x'));
- BOOST_TEST(test(L"x", wchar, 'x'));
+ BOOST_TEST(test(" ", space, ' '));
+ BOOST_TEST(test(L" ", space, L' '));
+ BOOST_TEST(test("\t", space, '\t'));
+ BOOST_TEST(test(L"\t", space, L'\t'));
 
- BOOST_TEST(test(L"x", wchar(L'x')));
- BOOST_TEST(test(L"x", wchar('x')));
+ BOOST_TEST(!test("", space, 'x'));
+ BOOST_TEST(!test(L"", space, L'x'));
     }
-
+
     {
         using namespace boost::spirit::ascii;
-
+
         BOOST_TEST(test_delimited("x ", 'x', ' '));
         BOOST_TEST(test_delimited(L"x ", L'x', L' '));
         BOOST_TEST(!test_delimited("x ", 'y', ' '));
         BOOST_TEST(!test_delimited(L"x ", L'y', L' '));
 
- BOOST_TEST(test_delimited("x ", 'x', space));
- BOOST_TEST(test_delimited(L"x ", L'x', space(L' ')));
- BOOST_TEST(!test_delimited("x ", 'y', space));
- BOOST_TEST(!test_delimited(L"x ", L'y', space(L' ')));
-
- BOOST_TEST(test_delimited("x ", char_, 'x', space));
- BOOST_TEST(test_delimited(L"x ", char_, L'x', space(L' ')));
- BOOST_TEST(!test_delimited("x ", char_, 'y', space));
- BOOST_TEST(!test_delimited(L"x ", char_, L'y', space(L' ')));
-
- BOOST_TEST(test_delimited("x ", char_('x'), space));
- BOOST_TEST(!test_delimited("x ", char_('y'), space(L' ')));
- BOOST_TEST(test_delimited(L"x ", char_(L'x'), space));
- BOOST_TEST(!test_delimited(L"x ", char_(L'y'), space(L' ')));
-
-// BOOST_TEST(test_delimited("x ", char_("x"), space));
+ BOOST_TEST(test_delimited("x ", 'x', ' '));
+ BOOST_TEST(test_delimited(L"x ", L'x', L' '));
+ BOOST_TEST(!test_delimited("x ", 'y', ' '));
+ BOOST_TEST(!test_delimited(L"x ", L'y', L' '));
 
-#if defined(KARMA_FAIL_COMPILATION)
- BOOST_TEST(test_delimited("x ", char_, space)); // anychar without a parameter doesn't make any sense
-#endif
- }
-
- {
- BOOST_TEST(test_delimited(L"x ", L'x', wchar(' ')));
- BOOST_TEST(test_delimited(L"x ", 'x', wchar(' ')));
+ BOOST_TEST(test_delimited("x ", char_, 'x', ' '));
+ BOOST_TEST(test_delimited(L"x ", char_, L'x', L' '));
+ BOOST_TEST(!test_delimited("x ", char_, 'y', ' '));
+ BOOST_TEST(!test_delimited(L"x ", char_, L'y', L' '));
+
+ BOOST_TEST(test_delimited("x ", char_('x'), ' '));
+ BOOST_TEST(!test_delimited("x ", char_('y'), ' '));
 
- BOOST_TEST(test_delimited(L"x ", wchar, L'x', wchar(' ')));
- BOOST_TEST(test_delimited(L"x ", wchar, 'x', wchar(' ')));
+ BOOST_TEST(test_delimited("x ", char_('x'), 'x', ' '));
+ BOOST_TEST(!test_delimited("", char_('y'), 'x', ' '));
+
+ BOOST_TEST(test_delimited("x ", char_("x"), ' '));
 
- BOOST_TEST(test_delimited(L"x ", wchar(L'x'), wchar(' ')));
- BOOST_TEST(test_delimited(L"x ", wchar('x'), wchar(' ')));
-
 #if defined(KARMA_FAIL_COMPILATION)
- BOOST_TEST(test_delimited("x ", char_, space)); // anychar without a parameter doesn't make any sense
+ BOOST_TEST(test_delimited("x ", char_, ' ')); // anychar without a parameter doesn't make any sense
 #endif
     }
-
+
+ { // pre-delimiting
+ {
+ std::string generated;
+ std::back_insert_iterator<std::string> it(generated);
+ BOOST_TEST(karma::generate_delimited(it, '_', '^'
+ , karma::delimit_flag::predelimit));
+ BOOST_TEST(generated == "^_^");
+ }
+ {
+ using namespace boost::spirit::standard_wide;
+ std::basic_string<wchar_t> generated;
+ std::back_insert_iterator<std::basic_string<wchar_t> > it(generated);
+ BOOST_TEST(karma::generate_delimited(it, char_, L'.'
+ , karma::delimit_flag::predelimit, L'x'));
+ BOOST_TEST(generated == L".x.");
+ }
+ }
+
     // action tests
     {
+ using namespace boost::spirit::ascii;
+
         BOOST_TEST(test("x", char_[_1 = val('x')]));
- BOOST_TEST(test(L"x", wchar[_1 = val(L'x')]));
         BOOST_TEST(!test("x", char_[_1 = val('y')]));
- BOOST_TEST(!test(L"x", wchar[_1 = val(L'y')]));
     }
 
     { // lazy chars
+ namespace ascii = boost::spirit::ascii;
+ namespace wide = boost::spirit::standard_wide;
 
         using namespace boost::phoenix;
- BOOST_TEST((test("x", char_(val('x')))));
- BOOST_TEST((test(L"x", char_(val(L'x')))));
+
+ BOOST_TEST((test("x", ascii::char_(val('x')))));
+ BOOST_TEST((test(L"x", wide::char_(val(L'x')))));
+
+ BOOST_TEST((test("x", ascii::char_(val('x')), 'x')));
+ BOOST_TEST((test(L"x", wide::char_(val(L'x')), L'x')));
+
+ BOOST_TEST((!test("", ascii::char_(val('y')), 'x')));
+ BOOST_TEST((!test(L"", wide::char_(val(L'y')), L'x')));
     }
 
     return boost::report_errors();

Deleted: branches/release/libs/spirit/test/karma/confix.cpp
==============================================================================
--- branches/release/libs/spirit/test/karma/confix.cpp 2009-09-14 12:45:39 EDT (Mon, 14 Sep 2009)
+++ (empty file)
@@ -1,83 +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)
-
-#include <boost/config/warning_disable.hpp>
-#include <boost/detail/lightweight_test.hpp>
-#include <boost/spirit/include/karma_auxiliary.hpp>
-#include <boost/spirit/include/karma_char.hpp>
-#include <boost/spirit/include/karma_string.hpp>
-#include <boost/spirit/include/karma_generate.hpp>
-
-#include <iostream>
-#include "test.hpp"
-
-namespace html
-{
- ///////////////////////////////////////////////////////////////////////////////
- // define a HTML tag helper generator
- template <typename Char, typename Traits, typename Allocator>
- inline boost::spirit::confix_spec<std::basic_string<Char, Traits, Allocator> >
- tag (std::basic_string<Char, Traits, Allocator> const& tagname)
- {
- typedef std::basic_string<Char, Traits, Allocator> string_type;
- return boost::spirit::confix_spec<string_type>(
- string_type("<") + tagname + ">", string_type("</") + tagname + ">");
- }
-
- inline boost::spirit::confix_spec<std::string>
- tag (char const* tagname)
- {
- return tag(std::string(tagname));
- }
-
- typedef boost::spirit::confix_spec<std::string> html_tag_type;
-
- html_tag_type const ol = tag("ol");
-}
-
-///////////////////////////////////////////////////////////////////////////////
-int
-main()
-{
- using namespace spirit_test;
- using namespace boost::spirit;
- using namespace boost::spirit::ascii;
-
- {
- BOOST_TEST((test("<tag>a</tag>",
- confix("<tag>", "</tag>")[char_('a')])));
- BOOST_TEST((test("// some C++ comment\n",
- confix(lit("//"), eol)[" some C++ comment"])));
- BOOST_TEST((test("<ol>some text</ol>", html::ol["some text"])));
- }
-
- {
- BOOST_TEST((test(L"<tag>a</tag>",
- confix(L"<tag>", L"</tag>")[wchar(L'a')])));
- BOOST_TEST((test(L"// some C++ comment\n",
- confix(wlit(L"//"), eol)[L" some C++ comment"])));
- BOOST_TEST((test(L"<ol>some text</ol>", html::ol[L"some text"])));
- }
-
- {
- BOOST_TEST((test_delimited("<tag> a </tag> ",
- confix("<tag>", "</tag>")[char_('a')], space)));
- BOOST_TEST((test_delimited("// some C++ comment \n ",
- confix(lit("//"), eol)["some C++ comment"], space)));
- BOOST_TEST((test_delimited("<ol> some text </ol> ",
- html::ol["some text"], space)));
- }
-
- {
- BOOST_TEST((test_delimited(L"<tag> a </tag> ",
- confix(L"<tag>", L"</tag>")[wchar(L'a')], space)));
- BOOST_TEST((test_delimited(L"// some C++ comment \n ",
- confix(wlit(L"//"), eol)[L"some C++ comment"], space)));
- BOOST_TEST((test_delimited(L"<ol> some text </ol> ",
- html::ol[L"some text"], space)));
- }
-
- return boost::report_errors();
-}

Modified: branches/release/libs/spirit/test/karma/delimiter.cpp
==============================================================================
--- branches/release/libs/spirit/test/karma/delimiter.cpp (original)
+++ branches/release/libs/spirit/test/karma/delimiter.cpp 2009-09-14 12:45:39 EDT (Mon, 14 Sep 2009)
@@ -22,7 +22,8 @@
 main()
 {
     using namespace boost::spirit;
-
+ using namespace boost::spirit::ascii;
+
     {
         BOOST_TEST(test("a b ", delimit[char_('a') << 'b']));
         BOOST_TEST(test("a*b*", delimit('*')[char_('a') << 'b']));
@@ -40,7 +41,7 @@
         BOOST_TEST(test_delimited("a b*c*d ",
             char_('a') << delimit('*')[char_('b') << 'c'] << 'd', char_(' ')));
     }
-
+
     {
         BOOST_TEST(test("ab", verbatim[char_('a') << 'b']));
         BOOST_TEST(test("abcd",
@@ -51,6 +52,15 @@
         BOOST_TEST(test_delimited("a bc d ",
             char_('a') << verbatim[char_('b') << 'c'] << 'd', char_(' ')));
     }
-
+
+ {
+ // The doubled delimiters at the end are generated by the 'b' generator
+ // and the verbatim[] directive. Currently, there is no easy way to
+ // avoid this.
+ BOOST_TEST(test("a b ", delimit[verbatim[delimit[char_('a') << 'b']]]));
+ BOOST_TEST(test_delimited("a*b**",
+ verbatim[delimit[char_('a') << 'b']], char_('*')));
+ }
+
     return boost::report_errors();
 }

Modified: branches/release/libs/spirit/test/karma/eps.cpp
==============================================================================
--- branches/release/libs/spirit/test/karma/eps.cpp (original)
+++ branches/release/libs/spirit/test/karma/eps.cpp 2009-09-14 12:45:39 EDT (Mon, 14 Sep 2009)
@@ -1,11 +1,16 @@
-// Copyright (c) 2001-2009 Hartmut Kaiser
+// Copyright (c) 2001-2007 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)
 
 #include <boost/config/warning_disable.hpp>
 #include <boost/detail/lightweight_test.hpp>
+
 #include <boost/spirit/include/karma_auxiliary.hpp>
+#include <boost/spirit/include/karma_char.hpp>
+#include <boost/spirit/include/karma_numeric.hpp>
+#include <boost/spirit/include/karma_generate.hpp>
+#include <boost/spirit/include/karma_operator.hpp>
 #include <boost/spirit/include/phoenix_core.hpp>
 
 #include <iostream>
@@ -14,19 +19,41 @@
 int
 main()
 {
- using spirit_test::test;
+ using namespace spirit_test;
     using namespace boost::spirit;
 
     {
+ using namespace boost::spirit::ascii;
+
         BOOST_TEST(test("", eps));
+ BOOST_TEST(test_delimited(" ", eps, space));
+
+ BOOST_TEST(!test("", !eps));
+ BOOST_TEST(!test_delimited(" ", !eps, space));
     }
 
- { // test action
+ { // test direct argument
+ using namespace boost::phoenix;
+
+ BOOST_TEST(test("", eps(true)));
+ BOOST_TEST(!test("", eps(false)));
+ }
 
+ { // test action
         using namespace boost::phoenix;
+
         BOOST_TEST(test("", eps(val(true))));
         BOOST_TEST(!test("", eps(val(false))));
     }
 
+ { // test no delimiter when argument is false
+ using namespace boost::spirit::ascii;
+
+ std::string generated;
+ std::back_insert_iterator<std::string> outit(generated);
+ BOOST_TEST(!karma::generate_delimited(outit, eps(false), space));
+ BOOST_TEST(generated.empty());
+ }
+
     return boost::report_errors();
 }

Modified: branches/release/libs/spirit/test/karma/format_manip.cpp
==============================================================================
--- branches/release/libs/spirit/test/karma/format_manip.cpp (original)
+++ branches/release/libs/spirit/test/karma/format_manip.cpp 2009-09-14 12:45:39 EDT (Mon, 14 Sep 2009)
@@ -15,7 +15,6 @@
 #include <vector>
 #include <list>
 
-#include <boost/static_assert.hpp>
 #include <boost/detail/lightweight_test.hpp>
 #include <boost/assign/std/vector.hpp>
 #include <boost/assign/std/list.hpp>
@@ -24,30 +23,20 @@
 template <typename Char, typename Expr>
 bool test(Char const *expected, Expr const& xpr)
 {
- namespace spirit = boost::spirit;
- typedef
- spirit::traits::is_component<spirit::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<spirit::karma::domain, Expr>::type
- component;
- typedef typename component::director director;
-
- component c = spirit::as_component(spirit::karma::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 karma expression.
+ BOOST_SPIRIT_ASSERT_MATCH(boost::spirit::karma::domain, Expr);
 
     std::ostringstream ostrm;
- ostrm << c;
+ ostrm << boost::spirit::compile<boost::spirit::karma::domain>(xpr);
     return ostrm.good() && ostrm.str() == expected;
 }
 
-template <typename Char, typename Expr, typename Parameter, typename Delimiter>
+template <typename Char, typename Expr, typename Copy, typename Delimiter
+ , typename Attribute>
 bool test(Char const *expected,
- boost::spirit::karma::detail::format_manip<Expr, Parameter, Delimiter> const& fm)
+ boost::spirit::karma::detail::format_manip<Expr, Copy, Delimiter, Attribute> const& fm)
 {
     std::ostringstream ostrm;
     ostrm << fm;
@@ -60,7 +49,6 @@
 {
     using namespace boost::spirit;
     using namespace boost::spirit::ascii;
- using namespace boost::spirit::arg_names;
     using namespace boost::spirit::karma;
 
     namespace fusion = boost::fusion;
@@ -68,6 +56,9 @@
 
     {
         BOOST_TEST(test( "a",
+ char_('a')
+ ));
+ BOOST_TEST(test( "a",
             char_[_1 = val('a')]
         ));
         BOOST_TEST(test( "a",
@@ -80,10 +71,10 @@
             format(char_, 'a')
         ));
         BOOST_TEST(test( "a ",
- format_delimited(char_, 'a', space)
+ format_delimited(char_, space, 'a')
         ));
     }
-
+
     {
         BOOST_TEST(test( "ab",
             char_[_1 = val('a')] << char_[_1 = val('b')]
@@ -94,17 +85,17 @@
         BOOST_TEST(test( "a b ",
             format_delimited(char_[_1 = val('a')] << char_[_1 = val('b')], space)
         ));
-
+
         fusion::vector<char, char> t('a', 'b');
 
         BOOST_TEST(test( "ab",
             format(char_ << char_, t)
         ));
         BOOST_TEST(test( "a b ",
- format_delimited(char_ << char_, t, space)
+ format_delimited(char_ << char_, space, t)
         ));
     }
-
+
     {
         BOOST_TEST(test( "abc",
             char_[_1 = 'a'] << char_[_1 = 'b'] << char_[_1 = 'c']
@@ -122,7 +113,7 @@
             format(char_ << char_ << char_, t)
         ));
         BOOST_TEST(test( "a b c ",
- format_delimited(char_ << char_ << char_, t, space)
+ format_delimited(char_ << char_ << char_, space, t)
         ));
     }
 
@@ -137,7 +128,7 @@
             format(char_ << int_, t)
         ));
         BOOST_TEST(test( "a 2 ",
- format_delimited(char_ << int_, t, space)
+ format_delimited(char_ << int_, space, t)
         ));
     }
     
@@ -147,7 +138,7 @@
         // output all elements of a vector
         std::vector<char> v;
         v += 'a', 'b', 'c';
-
+
         BOOST_TEST(test( "abc",
             (*char_)[_1 = v]
         ));
@@ -155,7 +146,7 @@
             format(*char_, v)
         ));
         BOOST_TEST(test( "a b c ",
- format_delimited(*char_, v, space)
+ format_delimited(*char_, space, v)
         ));
 
         // output a comma separated list of vector elements
@@ -172,13 +163,13 @@
             format(char_ % ',', v)
         ));
         BOOST_TEST(test( "a , b , c ",
- format_delimited(char_ % ',', v, space)
+ format_delimited(char_ % ',', space, v)
         ));
 
         // output all elements of a list
         std::list<char> l;
         l += 'a', 'b', 'c';
-
+
 // BOOST_TEST(test( "abc",
 // (*char_)[_1 = l]
 // ));
@@ -192,7 +183,7 @@
             format(*char_, l)
         ));
         BOOST_TEST(test( "a b c ",
- format_delimited(*char_, l, space)
+ format_delimited(*char_, space, l)
         ));
     }
 

Modified: branches/release/libs/spirit/test/karma/grammar.cpp
==============================================================================
--- branches/release/libs/spirit/test/karma/grammar.cpp (original)
+++ branches/release/libs/spirit/test/karma/grammar.cpp 2009-09-14 12:45:39 EDT (Mon, 14 Sep 2009)
@@ -6,9 +6,6 @@
 #include <boost/config/warning_disable.hpp>
 #include <boost/detail/lightweight_test.hpp>
 
-// include this first to make rules have placeholders (e.g. r._1)
-#include <boost/spirit/include/support_argument.hpp>
-
 #include <boost/spirit/include/karma_operator.hpp>
 #include <boost/spirit/include/karma_char.hpp>
 #include <boost/spirit/include/karma_string.hpp>
@@ -52,7 +49,6 @@
     }
 
     { // direct access to the rules
-
         num_list def;
         BOOST_TEST(test_delimited("123 ", def.num1, space));
         BOOST_TEST(test_delimited("123 , 456 , 789 ", def.start, space));

Modified: branches/release/libs/spirit/test/karma/grammar_fail.cpp
==============================================================================
--- branches/release/libs/spirit/test/karma/grammar_fail.cpp (original)
+++ branches/release/libs/spirit/test/karma/grammar_fail.cpp 2009-09-14 12:45:39 EDT (Mon, 14 Sep 2009)
@@ -6,6 +6,7 @@
 =============================================================================*/
 
 #include <boost/config/warning_disable.hpp>
+
 #include <boost/spirit/include/karma_operator.hpp>
 #include <boost/spirit/include/karma_char.hpp>
 #include <boost/spirit/include/karma_string.hpp>
@@ -19,29 +20,27 @@
 using namespace boost::spirit::karma;
 using namespace boost::spirit::ascii;
 
-struct num_list : grammar<char const*, rule<char const*> >
+typedef spirit_test::output_iterator<char>::type outiter_type;
+
+struct num_list : grammar<outiter_type, rule<outiter_type> >
 {
- num_list()
+ num_list() : num_list::base_type(start)
     {
- using boost::spirit::int_;
         start = int_(1) << ',' << int_(0);
     }
 
- rule<char const*, rule<char const*> > start;
+ rule<outiter_type, rule<outiter_type> > start;
 };
 
-// this test must fail compiling
+// this test must fail compiling as the rule is used with an incompatible
+// delimiter type
 int main()
 {
- using boost::make_function_output_iterator;
- using spirit_test::make_string_appender;
-
     std::string generated;
-
+
+ std::back_insert_iterator<std::string> outit(generated);
     num_list def;
- bool r = generate_delimited(
- make_function_output_iterator(make_string_appender(generated)),
- make_generator(def), char_('%') << '\n');
+ generate_delimited(outit, def, char_('%') << '\n');
 
     return 0;
 }

Modified: branches/release/libs/spirit/test/karma/int_numerics.cpp
==============================================================================
--- branches/release/libs/spirit/test/karma/int_numerics.cpp (original)
+++ branches/release/libs/spirit/test/karma/int_numerics.cpp 2009-09-14 12:45:39 EDT (Mon, 14 Sep 2009)
@@ -12,14 +12,13 @@
 #include <boost/mpl/for_each.hpp>
 #include <boost/mpl/if.hpp>
 #include <boost/mpl/bool.hpp>
+
 #include <boost/spirit/include/phoenix_core.hpp>
 #include <boost/spirit/include/phoenix_operator.hpp>
 #include <boost/spirit/include/phoenix_statement.hpp>
 
-#include <boost/spirit/include/support_argument.hpp>
 #include <boost/spirit/include/karma_char.hpp>
 #include <boost/spirit/include/karma_numeric.hpp>
-#include <boost/spirit/include/karma_generate.hpp>
 #include <boost/spirit/include/karma_directive.hpp>
 #include <boost/spirit/include/karma_action.hpp>
 
@@ -36,34 +35,45 @@
     {
         using namespace boost::spirit;
         using namespace boost::phoenix;
- using namespace boost::spirit::arg_names;
-
+
         T minval = (std::numeric_limits<T>::min)();
         T maxval = (std::numeric_limits<T>::max)();
-
+
         std::string expected_minval = boost::lexical_cast<std::string>(minval);
         std::string expected_maxval = boost::lexical_cast<std::string>(maxval);
-
+
         // create a correct generator type from the given integer type
         typedef typename
             boost::mpl::if_<
                 boost::mpl::bool_<std::numeric_limits<T>::is_signed>,
- karma::int_spec<T>,
- karma::uint_spec<T>
+ karma::int_generator<T>,
+ karma::uint_generator<T>
>::type
- int_spec_type;
-
- int_spec_type const gen = int_spec_type();
+ int_generator_type;
+
+ int_generator_type const gen = int_generator_type();
 
         BOOST_TEST(test(expected_maxval, gen, maxval));
         BOOST_TEST(test(expected_minval, gen, minval));
         BOOST_TEST(test(expected_maxval, gen(maxval)));
         BOOST_TEST(test(expected_minval, gen(minval)));
+ BOOST_TEST(test(expected_maxval, gen(maxval), maxval));
+ BOOST_TEST(test(expected_minval, gen(minval), minval));
+ BOOST_TEST(!test("", gen(maxval), maxval-1));
+ BOOST_TEST(!test("", gen(minval), minval+1));
+ BOOST_TEST(test(expected_maxval, lit(maxval)));
+ BOOST_TEST(test(expected_minval, lit(minval)));
 
         BOOST_TEST(test_delimited(expected_maxval + " ", gen, maxval, char(' ')));
         BOOST_TEST(test_delimited(expected_minval + " ", gen, minval, char(' ')));
         BOOST_TEST(test_delimited(expected_maxval + " ", gen(maxval), char(' ')));
         BOOST_TEST(test_delimited(expected_minval + " ", gen(minval), char(' ')));
+ BOOST_TEST(test_delimited(expected_maxval + " ", gen(maxval), maxval, char(' ')));
+ BOOST_TEST(test_delimited(expected_minval + " ", gen(minval), minval, char(' ')));
+ BOOST_TEST(!test_delimited("", gen(maxval), maxval-1, char(' ')));
+ BOOST_TEST(!test_delimited("", gen(minval), minval+1, char(' ')));
+ BOOST_TEST(test_delimited(expected_maxval + " ", lit(maxval), char(' ')));
+ BOOST_TEST(test_delimited(expected_minval + " ", lit(minval), char(' ')));
 
     // action tests
         BOOST_TEST(test(expected_maxval, gen[_1 = val(maxval)]));
@@ -76,10 +86,10 @@
 main()
 {
     using namespace boost::spirit;
-
+
     {
         using namespace boost::spirit::ascii;
-
+
         ///////////////////////////////////////////////////////////////////////
         // this is currently ambiguous with character literals
 // BOOST_TEST(test("0", 0));
@@ -136,11 +146,44 @@
         BOOST_TEST(test_delimited("-123 ", upper[int_(-123)], char_(' ')));
     }
 
+ { // literals, make sure there are no ambiguities
+ BOOST_TEST(test("0", lit(short(0))));
+ BOOST_TEST(test("0", lit(0)));
+ BOOST_TEST(test("0", lit(0L)));
+#ifdef BOOST_HAS_LONG_LONG
+ BOOST_TEST(test("0", lit(0LL)));
+#endif
+
+ BOOST_TEST(test("0", lit((unsigned short)0)));
+ BOOST_TEST(test("0", lit(0U)));
+ BOOST_TEST(test("0", lit(0UL)));
+#ifdef BOOST_HAS_LONG_LONG
+ BOOST_TEST(test("0", lit(0ULL)));
+#endif
+
+ BOOST_TEST(test("a", lit('a')));
+ BOOST_TEST(test("a", 'a'));
+ BOOST_TEST(test(L"a", L'a'));
+ }
+
+ { // lazy numerics
+ using namespace boost::phoenix;
+
+ BOOST_TEST(test("0", int_(val(0))));
+ BOOST_TEST(test("123", int_(val(123))));
+ BOOST_TEST(test("-123", int_(val(-123))));
+
+ int i1 = 0, i2 = 123, i3 = -123;
+ BOOST_TEST(test("0", int_(ref(i1))));
+ BOOST_TEST(test("123", int_(ref(i2))));
+ BOOST_TEST(test("-123", int_(ref(i3))));
+ }
+
     {
         using namespace boost::spirit::ascii;
-
- karma::int_spec<int, 10, true> const signed_int =
- karma::int_spec<int, 10, true>();
+
+ karma::int_generator<int, 10, true> const signed_int =
+ karma::int_generator<int, 10, true>();
 
         ///////////////////////////////////////////////////////////////////////
         BOOST_TEST(test(" 0", signed_int, 0));
@@ -191,54 +234,64 @@
         BOOST_TEST(test_delimited(" 0 ", upper[signed_int(0)], char_(' ')));
         BOOST_TEST(test_delimited("+123 ", upper[signed_int(123)], char_(' ')));
         BOOST_TEST(test_delimited("-123 ", upper[signed_int(-123)], char_(' ')));
+
+ using namespace boost::phoenix;
+
+ BOOST_TEST(test(" 0", signed_int(val(0))));
+ BOOST_TEST(test("+123", signed_int(val(123))));
+ BOOST_TEST(test("-123", signed_int(val(-123))));
+
+ int i1 = 0, i2 = 123, i3 = -123;
+ BOOST_TEST(test(" 0", signed_int(ref(i1))));
+ BOOST_TEST(test("+123", signed_int(ref(i2))));
+ BOOST_TEST(test("-123", signed_int(ref(i3))));
     }
 
     {
         ///////////////////////////////////////////////////////////////////////
- using boost::spirit::uint_;
         using namespace boost::spirit::ascii;
-
+
         BOOST_TEST(test("1234", uint_, 1234));
         BOOST_TEST(test("ff", hex, 0xff));
         BOOST_TEST(test("1234", oct, 01234));
         BOOST_TEST(test("11110000", bin, 0xf0));
-
+
         BOOST_TEST(test_delimited("1234 ", uint_, 1234, char_(' ')));
         BOOST_TEST(test_delimited("ff ", hex, 0xff, char_(' ')));
         BOOST_TEST(test_delimited("1234 ", oct, 01234, char_(' ')));
         BOOST_TEST(test_delimited("11110000 ", bin, 0xf0, char_(' ')));
-
+
         BOOST_TEST(test("1234", lower[uint_], 1234));
         BOOST_TEST(test("ff", lower[hex], 0xff));
         BOOST_TEST(test("1234", lower[oct], 01234));
         BOOST_TEST(test("11110000", lower[bin], 0xf0));
-
+
         BOOST_TEST(test_delimited("1234 ", lower[uint_], 1234, char_(' ')));
         BOOST_TEST(test_delimited("ff ", lower[hex], 0xff, char_(' ')));
         BOOST_TEST(test_delimited("1234 ", lower[oct], 01234, char_(' ')));
         BOOST_TEST(test_delimited("11110000 ", lower[bin], 0xf0, char_(' ')));
-
+
         BOOST_TEST(test("1234", upper[uint_], 1234));
         BOOST_TEST(test("FF", upper[hex], 0xff));
         BOOST_TEST(test("1234", upper[oct], 01234));
         BOOST_TEST(test("11110000", upper[bin], 0xf0));
-
+
         BOOST_TEST(test_delimited("1234 ", upper[uint_], 1234, char_(' ')));
         BOOST_TEST(test_delimited("FF ", upper[hex], 0xff, char_(' ')));
         BOOST_TEST(test_delimited("1234 ", upper[oct], 01234, char_(' ')));
         BOOST_TEST(test_delimited("11110000 ", upper[bin], 0xf0, char_(' ')));
-
+
         // no generator transformation should occur for uint_'s
         BOOST_TEST(test("1234", upper[upper[uint_]], 1234));
         BOOST_TEST(test("1234", upper[lower[uint_]], 1234));
         BOOST_TEST(test("1234", lower[upper[uint_]], 1234));
         BOOST_TEST(test("1234", lower[lower[uint_]], 1234));
-
+
         BOOST_TEST(test_delimited("1234 ", upper[upper[uint_]], 1234, char_(' ')));
         BOOST_TEST(test_delimited("1234 ", upper[lower[uint_]], 1234, char_(' ')));
         BOOST_TEST(test_delimited("1234 ", lower[upper[uint_]], 1234, char_(' ')));
         BOOST_TEST(test_delimited("1234 ", lower[lower[uint_]], 1234, char_(' ')));
-
+
         BOOST_TEST(test("FF", upper[upper[hex]], 0xff));
         BOOST_TEST(test("FF", upper[lower[hex]], 0xff));
         BOOST_TEST(test("ff", lower[upper[hex]], 0xff));
@@ -254,7 +307,7 @@
         BOOST_TEST(test("ff", hex(0xff)));
         BOOST_TEST(test("1234", oct(01234)));
         BOOST_TEST(test("11110000", bin(0xf0)));
-
+
         BOOST_TEST(test_delimited("1234 ", uint_(1234), char_(' ')));
         BOOST_TEST(test_delimited("ff ", hex(0xff), char_(' ')));
         BOOST_TEST(test_delimited("1234 ", oct(01234), char_(' ')));
@@ -264,22 +317,22 @@
         BOOST_TEST(test("ff", lower[hex(0xff)]));
         BOOST_TEST(test("1234", lower[oct(01234)]));
         BOOST_TEST(test("11110000", lower[bin(0xf0)]));
-
+
         BOOST_TEST(test_delimited("1234 ", lower[uint_(1234)], char_(' ')));
         BOOST_TEST(test_delimited("ff ", lower[hex(0xff)], char_(' ')));
         BOOST_TEST(test_delimited("1234 ", lower[oct(01234)], char_(' ')));
         BOOST_TEST(test_delimited("11110000 ", lower[bin(0xf0)], char_(' ')));
-
+
         BOOST_TEST(test("1234", upper[uint_(1234)]));
         BOOST_TEST(test("FF", upper[hex(0xff)]));
         BOOST_TEST(test("1234", upper[oct(01234)]));
         BOOST_TEST(test("11110000", upper[bin(0xf0)]));
-
+
         BOOST_TEST(test_delimited("1234 ", upper[uint_(1234)], char_(' ')));
         BOOST_TEST(test_delimited("FF ", upper[hex(0xff)], char_(' ')));
         BOOST_TEST(test_delimited("1234 ", upper[oct(01234)], char_(' ')));
         BOOST_TEST(test_delimited("11110000 ", upper[bin(0xf0)], char_(' ')));
-
+
         BOOST_TEST(test("FF", upper[upper[hex(0xff)]]));
         BOOST_TEST(test("FF", upper[lower[hex(0xff)]]));
         BOOST_TEST(test("ff", lower[upper[hex(0xff)]]));
@@ -301,7 +354,7 @@
         long, unsigned long
> integer_types;
     boost::mpl::for_each<integer_types>(test_minmax());
-
+
     return boost::report_errors();
 }
 

Modified: branches/release/libs/spirit/test/karma/kleene.cpp
==============================================================================
--- branches/release/libs/spirit/test/karma/kleene.cpp (original)
+++ branches/release/libs/spirit/test/karma/kleene.cpp 2009-09-14 12:45:39 EDT (Mon, 14 Sep 2009)
@@ -8,8 +8,6 @@
 
 #include <boost/assign/std/vector.hpp>
 
-#include <boost/spirit/include/support_argument.hpp>
-// #include <boost/spirit/include/support_pack.hpp>
 #include <boost/spirit/include/karma_char.hpp>
 #include <boost/spirit/include/karma_string.hpp>
 #include <boost/spirit/include/karma_numeric.hpp>
@@ -17,7 +15,6 @@
 #include <boost/spirit/include/karma_operator.hpp>
 #include <boost/spirit/include/karma_action.hpp>
 #include <boost/fusion/include/vector.hpp>
-#include <boost/spirit/include/support_unused.hpp>
 #include <boost/spirit/include/phoenix_core.hpp>
 #include <boost/spirit/include/phoenix_operator.hpp>
 #include <boost/spirit/include/phoenix_statement.hpp>
@@ -30,8 +27,19 @@
 int main()
 {
     using namespace boost::spirit;
+ using namespace boost::spirit::ascii;
     namespace fusion = boost::fusion;
-
+
+ {
+ std::string s1("aaaa");
+ BOOST_TEST(test("aaaa", *char_, s1));
+ BOOST_TEST(test_delimited("a a a a ", *char_, s1, ' '));
+
+ std::string s2("");
+ BOOST_TEST(test("", *char_, s2));
+ BOOST_TEST(test_delimited("", *char_, s2, ' '));
+ }
+
     {
         using namespace boost::assign;
 
@@ -41,72 +49,35 @@
         BOOST_TEST(test("abc", *char_, v));
         BOOST_TEST(test_delimited("a b c ", *char_, v, ' '));
     }
-
- {
- using namespace boost::assign;
 
- std::vector<char> v;
-
- // these need to fail, because the return value should be false
- BOOST_TEST(!test("", +char_, v));
- BOOST_TEST(!test_delimited("", +char_, v, ' '));
-
- v += 'a', 'b', 'c';
-
- BOOST_TEST(test("abc", +char_, v));
- BOOST_TEST(test_delimited("a b c ", +char_, v, ' '));
- }
-
     {
         using namespace boost::assign;
- using namespace boost::phoenix;
- using namespace boost::spirit::arg_names;
-
+
         std::vector<int> v;
         v += 10, 20, 30;
 
         BOOST_TEST(test("102030", *int_, v));
         BOOST_TEST(test_delimited("10, 20, 30, ", *int_, v, lit(", ")));
 
- typedef fusion::vector<int> fvec;
- std::vector<fvec> sv;
- sv += fvec(10), fvec(20), fvec(30);
-
- BOOST_TEST(test("10,20,30,", *(int_ << ','), sv));
- BOOST_TEST(test_delimited("10 , 20 , 30 , ", *(int_ << ','), sv, lit(" ")));
+ BOOST_TEST(test("10,20,30,", *(int_ << ','), v));
+ BOOST_TEST(test_delimited("10 , 20 , 30 , ", *(int_ << ','), v, lit(" ")));
  
         fusion::vector<char, char> cc ('a', 'c');
- BOOST_TEST(test("ac", char_ << *(char_(' ') << ',') << char_, cc));
+ BOOST_TEST(test("ac", char_ << *(lit(' ') << ',') << char_, cc));
         BOOST_TEST(test_delimited("a c ",
- char_ << *(char_(' ') << ',') << char_, cc, " "));
+ char_ << *(lit(' ') << ',') << char_, cc, " "));
     }
-
- {
- using namespace boost::assign;
- using namespace boost::phoenix;
- using namespace boost::spirit::arg_names;
-
- std::vector<int> v;
-
- BOOST_TEST(!test("", +int_, v));
- BOOST_TEST(!test_delimited("", +int_, v, lit(", ")));
 
- v += 10, 20, 30;
-
- BOOST_TEST(test("102030", +int_, v));
- BOOST_TEST(test_delimited("10, 20, 30, ", +int_, v, lit(", ")));
-
- typedef fusion::vector<int> fvec;
- std::vector<fvec> sv;
- sv += fvec(10), fvec(20), fvec(30);
+ { // actions
+ using namespace boost::assign;
+ namespace phx = boost::phoenix;
 
- BOOST_TEST(test("10,20,30,", +(int_ << ','), sv));
- BOOST_TEST(test_delimited("10 , 20 , 30 , ", +(int_ << ','), sv, lit(" ")));
+ std::vector<char> v;
+ v += 'a', 'b', 'c', 'd', 'e', 'f', 'g', 'h';
 
- fusion::vector<char, char> cc ('a', 'c');
- BOOST_TEST(!test("", char_ << +(char_(' ') << ',') << char_, cc));
- BOOST_TEST(!test_delimited("",
- char_ << +(char_(' ') << ',') << char_, cc, " "));
+ BOOST_TEST(test("abcdefgh", (*char_)[_1 = phx::ref(v)]));
+ BOOST_TEST(test_delimited("a b c d e f g h ",
+ (*char_ )[_1 = phx::ref(v)], space));
     }
 
     return boost::report_errors();

Modified: branches/release/libs/spirit/test/karma/lazy.cpp
==============================================================================
--- branches/release/libs/spirit/test/karma/lazy.cpp (original)
+++ branches/release/libs/spirit/test/karma/lazy.cpp 2009-09-14 12:45:39 EDT (Mon, 14 Sep 2009)
@@ -10,8 +10,8 @@
 #include <boost/spirit/include/karma_numeric.hpp>
 #include <boost/spirit/include/karma_auxiliary.hpp>
 #include <boost/spirit/include/karma_action.hpp>
-#include <boost/spirit/include/karma_nonterminal.hpp>
-#include <boost/spirit/include/karma_operator.hpp>
+// #include <boost/spirit/include/karma_nonterminal.hpp>
+// #include <boost/spirit/include/karma_operator.hpp>
 #include <boost/spirit/include/support_argument.hpp>
 #include <boost/spirit/include/phoenix_core.hpp>
 #include <boost/spirit/include/phoenix_operator.hpp>
@@ -22,31 +22,31 @@
 int
 main()
 {
+ namespace karma = boost::spirit::karma;
     using spirit_test::test;
     using namespace boost::spirit;
     using namespace boost::spirit::karma;
- using namespace boost::spirit::arg_names;
     namespace phx = boost::phoenix;
 
     {
- BOOST_TEST(test("123", lazy(phx::val(int_)), 123));
+ BOOST_TEST(test("123", karma::lazy(phx::val(int_)), 123));
     }
 
     {
         int result = 123;
- BOOST_TEST(test("123", lazy(phx::val(int_))[_1 = phx::ref(result)]));
+ BOOST_TEST(test("123", karma::lazy(phx::val(int_))[_1 = phx::ref(result)]));
     }
 
- {
- typedef spirit_test::output_iterator<char>::type outiter_type;
- rule<outiter_type, void(std::string)> r;
-
- r = char_('<') << lazy(_r1) << '>' << "</" << lazy(_r1) << '>';
-
- std::string tag("tag"), foo("foo");
- BOOST_TEST(test("<tag></tag>", r (phx::ref(tag))));
- BOOST_TEST(!test("<foo></bar>", r (phx::ref(foo))));
- }
+// {
+// typedef spirit_test::output_iterator<char>::type outiter_type;
+// rule<outiter_type, void(std::string)> r;
+//
+// r = char_('<') << karma::lazy(_r1) << '>' << "</" << karma::lazy(_r1) << '>';
+//
+// std::string tag("tag"), foo("foo");
+// BOOST_TEST(test("<tag></tag>", r (phx::ref(tag))));
+// BOOST_TEST(!test("<foo></bar>", r (phx::ref(foo))));
+// }
 
     return boost::report_errors();
 }

Modified: branches/release/libs/spirit/test/karma/left_alignment.cpp
==============================================================================
--- branches/release/libs/spirit/test/karma/left_alignment.cpp (original)
+++ branches/release/libs/spirit/test/karma/left_alignment.cpp 2009-09-14 12:45:39 EDT (Mon, 14 Sep 2009)
@@ -14,19 +14,19 @@
 
 #include "test.hpp"
 
-using namespace spirit_test;
-
 ///////////////////////////////////////////////////////////////////////////////
 int
 main()
 {
+ using namespace spirit_test;
     using namespace boost::spirit;
+ using namespace boost::spirit::ascii;
 
     {
         BOOST_TEST(test("x ", left_align[char_('x')]));
         BOOST_TEST(test("x ", left_align[char_], 'x'));
         BOOST_TEST(test("x ", left_align['x']));
-
+
         BOOST_TEST(test("x ", left_align(10)[char_('x')]));
         BOOST_TEST(test("x ", left_align(10)[char_], 'x'));
         BOOST_TEST(test("x ", left_align(10)['x']));
@@ -40,18 +40,18 @@
         BOOST_TEST(test("x*********", left_align(char_('*'))['x']));
 
         BOOST_TEST(test("abc ", left_align[lit("abc")]));
- BOOST_TEST(test("abc ", left_align[lit], "abc"));
-
+ BOOST_TEST(test("abc ", left_align[string], "abc"));
+
         BOOST_TEST(test("abc ", left_align(10)[lit("abc")]));
- BOOST_TEST(test("abc ", left_align(10)[lit], "abc"));
+ BOOST_TEST(test("abc ", left_align(10)[string], "abc"));
         BOOST_TEST(test("abc ", left_align(10)["abc"]));
 
         BOOST_TEST(test("abc*******", left_align(10, char_('*'))[lit("abc")]));
- BOOST_TEST(test("abc*******", left_align(10, '*')[lit], "abc"));
+ BOOST_TEST(test("abc*******", left_align(10, '*')[string], "abc"));
         BOOST_TEST(test("abc*******", left_align(10, '*')["abc"]));
 
         BOOST_TEST(test("abc*******", left_align(char_('*'))[lit("abc")]));
- BOOST_TEST(test("abc*******", left_align(char_('*'))[lit], "abc"));
+ BOOST_TEST(test("abc*******", left_align(char_('*'))[string], "abc"));
         BOOST_TEST(test("abc*******", left_align(char_('*'))["abc"]));
 
         BOOST_TEST(test("100 ", left_align[int_(100)]));

Modified: branches/release/libs/spirit/test/karma/list.cpp
==============================================================================
--- branches/release/libs/spirit/test/karma/list.cpp (original)
+++ branches/release/libs/spirit/test/karma/list.cpp 2009-09-14 12:45:39 EDT (Mon, 14 Sep 2009)
@@ -5,7 +5,6 @@
 
 #include <boost/config/warning_disable.hpp>
 #include <boost/detail/lightweight_test.hpp>
-#include <boost/utility/enable_if.hpp>
 
 #include <boost/spirit/include/karma_operator.hpp>
 #include <boost/spirit/include/karma_char.hpp>
@@ -13,11 +12,11 @@
 #include <boost/spirit/include/karma_numeric.hpp>
 #include <boost/spirit/include/karma_directive.hpp>
 #include <boost/spirit/include/karma_action.hpp>
-#include <boost/spirit/include/support_argument.hpp>
 #include <boost/spirit/include/phoenix_core.hpp>
 #include <boost/spirit/include/phoenix_operator.hpp>
 #include <boost/spirit/include/phoenix_object.hpp>
 #include <boost/spirit/include/phoenix_stl.hpp>
+
 #include <boost/assign/std/vector.hpp>
 
 #include <string>
@@ -38,7 +37,7 @@
 
     std::vector<char> v;
     v += 'a', 'b', 'c', 'd', 'e', 'f', 'g', 'h';
-
+
     {
         BOOST_TEST(test("a,b,c,d,e,f,g,h", char_ % ',', v));
         BOOST_TEST(test_delimited("a , b , c , d , e , f , g , h ",
@@ -54,7 +53,6 @@
 
     { // actions
         namespace phx = boost::phoenix;
- using boost::spirit::arg_names::_1;
 
         BOOST_TEST(test("a,b,c,d,e,f,g,h", (char_ % ',')[_1 = phx::ref(v)]));
         BOOST_TEST(test_delimited("a , b , c , d , e , f , g , h ",

Modified: branches/release/libs/spirit/test/karma/lit.cpp
==============================================================================
--- branches/release/libs/spirit/test/karma/lit.cpp (original)
+++ branches/release/libs/spirit/test/karma/lit.cpp 2009-09-14 12:45:39 EDT (Mon, 14 Sep 2009)
@@ -23,28 +23,42 @@
 main()
 {
     using namespace boost::spirit;
-
+
     {
+ using namespace boost::spirit::ascii;
+
         BOOST_TEST(test("a", lit('a')));
         BOOST_TEST(!test("a", lit('b')));
-
+
         BOOST_TEST(test("abc", "abc"));
         BOOST_TEST(!test("abcd", "abc"));
 
         BOOST_TEST(test("abc", lit("abc")));
         BOOST_TEST(!test("abcd", lit("abc")));
 
- BOOST_TEST(test("abc", lit, "abc"));
- BOOST_TEST(!test("abcd", lit, "abc"));
+ BOOST_TEST(test("abc", string, "abc"));
+ BOOST_TEST(!test("abcd", string, "abc"));
+
+ BOOST_TEST(test("abc", string("abc")));
+ BOOST_TEST(!test("abcd", string("abc")));
+
+ BOOST_TEST(test("abc", string("abc"), "abc"));
+ BOOST_TEST(!test("", string("abc"), "abcd"));
+ BOOST_TEST(!test("", string("abcd"), "abc"));
     }
-
+
     {
+ using namespace boost::spirit::ascii;
+
         std::string str("abc");
         BOOST_TEST(test("abc", lit(str)));
         BOOST_TEST(!test("abcd", lit(str)));
 
- BOOST_TEST(test("abc", lit, str));
- BOOST_TEST(!test("abcd", lit, str));
+ BOOST_TEST(test("abc", string(str)));
+ BOOST_TEST(!test("abcd", string(str)));
+
+ BOOST_TEST(test("abc", string, str));
+ BOOST_TEST(!test("abcd", string, str));
 
         BOOST_TEST(test("abc", str));
         BOOST_TEST(!test("abcd", str));
@@ -53,85 +67,102 @@
         BOOST_TEST(test(L"abc", lit(wstr)));
         BOOST_TEST(!test(L"abcd", lit(wstr)));
 
- BOOST_TEST(test(L"abc", lit, wstr));
- BOOST_TEST(!test(L"abcd", lit, wstr));
+ BOOST_TEST(test(L"abc", string, wstr));
+ BOOST_TEST(!test(L"abcd", string, wstr));
 
         BOOST_TEST(test(L"abc", wstr));
         BOOST_TEST(!test(L"abcd", wstr));
     }
-
+
     {
+ using namespace boost::spirit::ascii;
+
         BOOST_TEST(test(L"a", lit(L'a')));
         BOOST_TEST(!test(L"a", lit(L'b')));
-
+
         BOOST_TEST(test(L"abc", L"abc"));
         BOOST_TEST(test(L"abc", "abc"));
         BOOST_TEST(!test(L"abcd", L"abc"));
 
         BOOST_TEST(test(L"abc", lit(L"abc")));
- BOOST_TEST(test(L"abc", wlit(L"abc")));
         BOOST_TEST(!test(L"abcd", lit(L"abc")));
 
- BOOST_TEST(test(L"abc", lit, L"abc"));
- BOOST_TEST(test(L"abc", wlit, L"abc"));
- BOOST_TEST(!test(L"abcd", lit, L"abc"));
-
- BOOST_TEST(test(L"abc", lit, "abc"));
- BOOST_TEST(test(L"abc", wlit, "abc"));
- BOOST_TEST(!test(L"abcd", lit, "abc"));
+ BOOST_TEST(test(L"abc", string(L"abc")));
+ BOOST_TEST(!test(L"abcd", string(L"abc")));
+
+ BOOST_TEST(test(L"abc", string, L"abc"));
+ BOOST_TEST(!test(L"abcd", string, L"abc"));
+
+ BOOST_TEST(test(L"abc", string, "abc"));
+ BOOST_TEST(!test(L"abcd", string, "abc"));
     }
-
+
     {
+ using namespace boost::spirit::ascii;
+
         BOOST_TEST(test_delimited("a ", lit('a'), ' '));
         BOOST_TEST(!test_delimited("a ", lit('b'), ' '));
-
+
         BOOST_TEST(test_delimited("abc ", "abc", ' '));
         BOOST_TEST(!test_delimited("abcd ", "abc", ' '));
 
         BOOST_TEST(test_delimited("abc ", lit("abc"), ' '));
         BOOST_TEST(!test_delimited("abcd ", lit("abc"), ' '));
 
- BOOST_TEST(test_delimited("abc ", lit, "abc", ' '));
- BOOST_TEST(!test_delimited("abcd ", lit, "abc", ' '));
+ BOOST_TEST(test_delimited("abc ", string, "abc", ' '));
+ BOOST_TEST(!test_delimited("abcd ", string, "abc", ' '));
+
+ BOOST_TEST(test_delimited("abc ", string("abc"), ' '));
+ BOOST_TEST(!test_delimited("abcd ", string("abc"), ' '));
+
+ BOOST_TEST(test_delimited("abc ", string("abc"), "abc", ' '));
+ BOOST_TEST(!test_delimited("", string("abc"), "abcd", ' '));
+ BOOST_TEST(!test_delimited("", string("abcd"), "abc", ' '));
     }
-
+
     {
+ using namespace boost::spirit::ascii;
+
         BOOST_TEST(test_delimited(L"a ", lit(L'a'), ' '));
         BOOST_TEST(!test_delimited(L"a ", lit(L'b'), ' '));
-
+
         BOOST_TEST(test_delimited(L"abc ", L"abc", ' '));
         BOOST_TEST(!test_delimited(L"abcd ", L"abc", ' '));
 
         BOOST_TEST(test_delimited(L"abc ", lit(L"abc"), ' '));
- BOOST_TEST(test_delimited(L"abc ", wlit(L"abc"), ' '));
- BOOST_TEST(test_delimited(L"abc ", wlit("abc"), ' '));
         BOOST_TEST(!test_delimited(L"abcd ", lit(L"abc"), ' '));
 
- BOOST_TEST(test_delimited(L"abc ", lit, L"abc", ' '));
- BOOST_TEST(test_delimited(L"abc ", wlit, L"abc", ' '));
- BOOST_TEST(test_delimited(L"abc ", wlit, "abc", ' '));
- BOOST_TEST(!test_delimited(L"abcd ", lit, L"abc", ' '));
+ BOOST_TEST(test_delimited(L"abc ", string, L"abc", ' '));
+ BOOST_TEST(!test_delimited(L"abcd ", string, L"abc", ' '));
+
+ BOOST_TEST(test_delimited(L"abc ", string(L"abc"), ' '));
+ BOOST_TEST(!test_delimited(L"abcd ", string(L"abc"), ' '));
     }
 
     { // test action
-
- using namespace boost::phoenix;
- using boost::spirit::arg_names::_1;
+ namespace phx = boost::phoenix;
         using namespace boost::spirit::ascii;
-
+
         std::string str("abc");
- BOOST_TEST(test("abc", lit[_1 = ref(str)]));
- BOOST_TEST(test_delimited("abc ", lit[_1 = ref(str)], space));
+ BOOST_TEST(test("abc", string[_1 = phx::ref(str)]));
+ BOOST_TEST(test_delimited("abc ", string[_1 = phx::ref(str)], space));
     }
 
     { // lazy strings
+ namespace phx = boost::phoenix;
+ using namespace boost::spirit::ascii;
 
- using namespace boost::phoenix;
         std::basic_string<char> s("abc");
- BOOST_TEST((test("abc", lit(val(s)))));
+ BOOST_TEST((test("abc", lit(phx::val(s)))));
+ BOOST_TEST((test("abc", string(phx::val(s)))));
+
+ BOOST_TEST(test("abc", string(phx::val(s)), "abc"));
+ BOOST_TEST(!test("", string(phx::val(s)), "abcd"));
+ BOOST_TEST(!test("", string(phx::val(s)), "abc"));
 
         std::basic_string<wchar_t> ws(L"abc");
- BOOST_TEST((test(L"abc", lit(ref(ws)))));
+ BOOST_TEST((test(L"abc", lit(phx::ref(ws)))));
+ BOOST_TEST((test(L"abc", string(phx::ref(ws)))));
     }
 
     return boost::report_errors();

Deleted: branches/release/libs/spirit/test/karma/none.cpp
==============================================================================
--- branches/release/libs/spirit/test/karma/none.cpp 2009-09-14 12:45:39 EDT (Mon, 14 Sep 2009)
+++ (empty file)
@@ -1,33 +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)
-
-#include <boost/config/warning_disable.hpp>
-#include <boost/detail/lightweight_test.hpp>
-#include <boost/spirit/include/karma_auxiliary.hpp>
-#include <boost/spirit/include/karma_char.hpp>
-#include <boost/spirit/include/karma_generate.hpp>
-
-#include <iostream>
-#include "test.hpp"
-
-int
-main()
-{
- using namespace spirit_test;
- using namespace boost::spirit;
- using namespace boost::spirit::ascii;
-
- {
- BOOST_TEST((!test("", none, 1)));
- BOOST_TEST((!test("", none, "test")));
- }
-
- {
- BOOST_TEST((!test_delimited(" ", none, 1, space)));
- BOOST_TEST((!test_delimited(" ", none, "test", space)));
- }
-
- return boost::report_errors();
-}

Modified: branches/release/libs/spirit/test/karma/optional.cpp
==============================================================================
--- branches/release/libs/spirit/test/karma/optional.cpp (original)
+++ branches/release/libs/spirit/test/karma/optional.cpp 2009-09-14 12:45:39 EDT (Mon, 14 Sep 2009)
@@ -10,7 +10,6 @@
 #include <boost/spirit/include/karma_operator.hpp>
 #include <boost/spirit/include/karma_numeric.hpp>
 #include <boost/spirit/include/karma_action.hpp>
-#include <boost/spirit/include/support_argument.hpp>
 #include <boost/spirit/include/phoenix_core.hpp>
 #include <boost/spirit/include/phoenix_operator.hpp>
 
@@ -21,6 +20,7 @@
 {
     using namespace spirit_test;
     using namespace boost::spirit;
+ using namespace boost::spirit::ascii;
 
     {
         boost::optional<int> opt;
@@ -36,8 +36,6 @@
     }
 
     {
- using namespace boost::spirit::ascii;
-
         boost::optional<int> opt;
         BOOST_TEST(test_delimited("", -int_, opt, space));
 
@@ -46,8 +44,6 @@
     }
 
     {
- using namespace boost::spirit::ascii;
-
         int opt = 10;
         BOOST_TEST(test_delimited("10 ", -int_, opt, space));
     }
@@ -55,7 +51,6 @@
     { // test action
         using namespace boost::phoenix;
         namespace phoenix = boost::phoenix;
- using namespace boost::spirit::arg_names;
 
         boost::optional<int> n ;
         BOOST_TEST(test("", (-int_)[_1 = phoenix::ref(n)]));
@@ -67,7 +62,6 @@
     { // test action
         using namespace boost::phoenix;
         namespace phoenix = boost::phoenix;
- using namespace boost::spirit::arg_names;
 
         int n = 1234;
         BOOST_TEST(test("1234", (-int_)[_1 = phoenix::ref(n)]));
@@ -76,8 +70,6 @@
     { // test action
         using namespace boost::phoenix;
         namespace phoenix = boost::phoenix;
- using namespace boost::spirit::arg_names;
- using namespace boost::spirit::ascii;
 
         boost::optional<int> n;
         BOOST_TEST(test_delimited("", (-int_)[_1 = phoenix::ref(n)], space));
@@ -89,8 +81,6 @@
     { // test action
         using namespace boost::phoenix;
         namespace phoenix = boost::phoenix;
- using namespace boost::spirit::arg_names;
- using namespace boost::spirit::ascii;
 
         int n = 1234;
         BOOST_TEST(test_delimited("1234 ", (-int_)[_1 = phoenix::ref(n)], space));

Modified: branches/release/libs/spirit/test/karma/pattern.cpp
==============================================================================
--- branches/release/libs/spirit/test/karma/pattern.cpp (original)
+++ branches/release/libs/spirit/test/karma/pattern.cpp 2009-09-14 12:45:39 EDT (Mon, 14 Sep 2009)
@@ -6,9 +6,6 @@
 #include <boost/config/warning_disable.hpp>
 #include <boost/detail/lightweight_test.hpp>
 
-// include this first to make rules have placeholders (e.g. _r1)
-#include <boost/spirit/include/support_argument.hpp>
-
 #include <boost/spirit/include/karma_operator.hpp>
 #include <boost/spirit/include/karma_char.hpp>
 #include <boost/spirit/include/karma_auxiliary.hpp>
@@ -30,7 +27,6 @@
 {
     using namespace boost;
     using namespace boost::spirit;
- using namespace boost::spirit::arg_names;
     using namespace boost::spirit::karma;
     using namespace boost::spirit::ascii;
 
@@ -39,7 +35,7 @@
     // test rule parameter propagation
     {
         using boost::phoenix::at_c;
-
+
         rule<outiter_type, fusion::vector<char, int, double>()> start;
         fusion::vector<char, int, double> vec('a', 10, 12.4);
 
@@ -63,74 +59,115 @@
         BOOST_TEST(test("a1012.4", start, vec));
     }
 
- // basic tests with delimiter
     {
- rule<outiter_type, space_type> start;
+ using boost::phoenix::at_c;
+
+ rule<outiter_type, space_type, fusion::vector<char, int, double>()> start;
+ fusion::vector<char, int, double> vec('a', 10, 12.4);
+
+ start %= char_ << int_ << double_;
+ BOOST_TEST(test_delimited("a 10 12.4 ", start, vec, space));
 
- start = char_[_1 = 'a'] << int_[_1 = 10] << double_[_1 = 12.4];
- BOOST_TEST(test_delimited("a 10 12.4 ", start, space));
+ rule<outiter_type, space_type, char()> a;
+ rule<outiter_type, space_type, int()> b;
+ rule<outiter_type, space_type, double()> c;
 
- start = (char_ << int_ << double_)[_1 = 'a', _2 = 10, _3 = 12.4];
- BOOST_TEST(test_delimited("a 10 12.4 ", start, space));
+ a %= char_ << eps;
+ b %= int_;
+ c %= double_;
+ start = a[_1 = at_c<0>(_r0)] << b[_1 = at_c<1>(_r0)] << c[_1 = at_c<2>(_r0)];
+ BOOST_TEST(test_delimited("a 10 12.4 ", start, vec, space));
 
- rule<outiter_type, space_type> a, b, c;
- a = char_[_1 = 'a'];
- b = int_[_1 = 10];
- c = double_[_1 = 12.4];
+ start = (a << b << c)[_1 = at_c<0>(_r0), _2 = at_c<1>(_r0), _3 = at_c<2>(_r0)];
+ BOOST_TEST(test_delimited("a 10 12.4 ", start, vec, space));
 
- start = a << b << c;
- BOOST_TEST(test_delimited("a 10 12.4 ", start, space));
+ start %= a << b << c;
+ BOOST_TEST(test_delimited("a 10 12.4 ", start, vec, space));
     }
 
     // locals test
     {
         rule<outiter_type, locals<std::string> > start;
 
- start = lit[_1 = "abc", _a = _1] << int_[_1 = 10] << lit[_1 = _a];
+ start = string[_1 = "abc", _a = _1] << int_[_1 = 10] << string[_1 = _a];
         BOOST_TEST(test("abc10abc", start));
     }
 
- //~ { // alias tests
- //~ typedef variant<char, int, double> var_type;
- //~ fusion::vector<unused_type, var_type> v (unused, 'a');
+ {
+ rule<outiter_type, space_type, locals<std::string> > start;
 
- //~ rule<outiter_type, void(var_type)> d, start;
+ start = string[_1 = "abc", _a = _1] << int_[_1 = 10] << string[_1 = _a];
+ BOOST_TEST(test_delimited("abc 10 abc ", start, space));
+ }
 
- //~ d = start.alias(); // d will always track start
+ // alias tests
+ {
+ typedef variant<char, int, double> var_type;
+
+ rule<outiter_type, var_type()> d, start;
+
+ d = start.alias(); // d will always track start
+
+ start = (char_ | int_ | double_)[_1 = _val];
+
+ var_type v ('a');
+ BOOST_TEST(test("a", d, v));
+ v = 10;
+ BOOST_TEST(test("10", d, v));
+ v = 12.4;
+ BOOST_TEST(test("12.4", d, v));
+ }
 
- //~ start = (char_ | int_ | double_)[_1 = _r1];
- //~ BOOST_TEST(test("a", d, v));
+ {
+ typedef variant<char, int, double> var_type;
 
- //~ v = fusion::vector<unused_type, var_type>(unused, 10);
- //~ BOOST_TEST(test("10", d, v));
- //~ v = fusion::vector<unused_type, var_type>(unused, 12.4);
- //~ BOOST_TEST(test("12.4", d, v));
- //~ }
+ rule<outiter_type, space_type, var_type()> d, start;
 
- //~ { // copy tests
+ d = start.alias(); // d will always track start
 
- //~ rule<char const*> a, b, c, start;
+ start = (char_ | int_ | double_)[_1 = _val];
 
- //~ a = 'a';
- //~ b = 'b';
- //~ c = 'c';
+ var_type v ('a');
+ BOOST_TEST(test_delimited("a ", d, v, space));
+ v = 10;
+ BOOST_TEST(test_delimited("10 ", d, v, space));
+ v = 12.4;
+ BOOST_TEST(test_delimited("12.4 ", d, v, space));
+ }
 
- //~ // The FF is the dynamic equivalent of start = *(a | b | c);
- //~ start = a;
- //~ start = start.copy() | b;
- //~ start = start.copy() | c;
- //~ start = *(start.copy());
+ {
+ typedef variant<char, int, double> var_type;
 
- //~ BOOST_TEST(test("abcabcacb", start));
+ rule<outiter_type, var_type()> d, start;
 
- //~ // The FF is the dynamic equivalent of start = (a | b) >> (start | b);
- //~ start = b;
- //~ start = a | copy(start);
- //~ start = start.copy() >> (start | b);
+ d = start.alias(); // d will always track start
+
+ start %= char_ | int_ | double_;
+
+ var_type v ('a');
+ BOOST_TEST(test("a", d, v));
+ v = 10;
+ BOOST_TEST(test("10", d, v));
+ v = 12.4;
+ BOOST_TEST(test("12.4", d, v));
+ }
 
- //~ BOOST_TEST(test("aaaabababaaabbb", start));
- //~ BOOST_TEST(test("aaaabababaaabba", start, false));
- //~ }
+ {
+ typedef variant<char, int, double> var_type;
+
+ rule<outiter_type, space_type, var_type()> d, start;
+
+ d = start.alias(); // d will always track start
+
+ start %= char_ | int_ | double_;
+
+ var_type v ('a');
+ BOOST_TEST(test_delimited("a ", d, v, space));
+ v = 10;
+ BOOST_TEST(test_delimited("10 ", d, v, space));
+ v = 12.4;
+ BOOST_TEST(test_delimited("12.4 ", d, v, space));
+ }
 
     return boost::report_errors();
 }

Modified: branches/release/libs/spirit/test/karma/pattern2.cpp
==============================================================================
--- branches/release/libs/spirit/test/karma/pattern2.cpp (original)
+++ branches/release/libs/spirit/test/karma/pattern2.cpp 2009-09-14 12:45:39 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,9 +6,6 @@
 #include <boost/config/warning_disable.hpp>
 #include <boost/detail/lightweight_test.hpp>
 
-// include this first to make rules have placeholders (e.g. _r1)
-#include <boost/spirit/include/support_argument.hpp>
-
 #include <boost/spirit/include/karma_operator.hpp>
 #include <boost/spirit/include/karma_char.hpp>
 #include <boost/spirit/include/karma_auxiliary.hpp>
@@ -30,7 +27,6 @@
 {
     using namespace boost;
     using namespace boost::spirit;
- using namespace boost::spirit::arg_names;
     using namespace boost::spirit::karma;
     using namespace boost::spirit::ascii;
 
@@ -55,16 +51,35 @@
         BOOST_TEST(test("a1012.4", start));
     }
 
+ // basic tests with delimiter
+ {
+ rule<outiter_type, space_type> start;
+
+ start = char_[_1 = 'a'] << int_[_1 = 10] << double_[_1 = 12.4];
+ BOOST_TEST(test_delimited("a 10 12.4 ", start, space));
+
+ start = (char_ << int_ << double_)[_1 = 'a', _2 = 10, _3 = 12.4];
+ BOOST_TEST(test_delimited("a 10 12.4 ", start, space));
+
+ rule<outiter_type, space_type> a, b, c;
+ a = char_[_1 = 'a'];
+ b = int_[_1 = 10];
+ c = double_[_1 = 12.4];
+
+ start = a << b << c;
+ BOOST_TEST(test_delimited("a 10 12.4 ", start, space));
+ }
+
     // basic tests involving a direct parameter
     {
         typedef variant<char, int, double> var_type;
- var_type v ('a');
 
         rule<outiter_type, var_type()> start;
 
         start = (char_ | int_ | double_)[_1 = _r0];
- BOOST_TEST(test("a", start, v));
 
+ var_type v ('a');
+ BOOST_TEST(test("a", start, v));
         v = 10;
         BOOST_TEST(test("10", start, v));
         v = 12.4;
@@ -72,6 +87,21 @@
     }
 
     {
+ typedef variant<char, int, double> var_type;
+
+ rule<outiter_type, space_type, var_type()> start;
+
+ start = (char_ | int_ | double_)[_1 = _r0];
+
+ var_type v ('a');
+ BOOST_TEST(test_delimited("a ", start, v, space));
+ v = 10;
+ BOOST_TEST(test_delimited("10 ", start, v, space));
+ v = 12.4;
+ BOOST_TEST(test_delimited("12.4 ", start, v, space));
+ }
+
+ {
         rule<outiter_type, void(char, int, double)> start;
         fusion::vector<char, int, double> vec('a', 10, 12.4);
 
@@ -92,6 +122,64 @@
         BOOST_TEST(test("a1012.4", start('a', 10, 12.4)));
     }
 
+ {
+ rule<outiter_type, space_type, void(char, int, double)> start;
+ fusion::vector<char, int, double> vec('a', 10, 12.4);
+
+ start = char_[_1 = _r1] << int_[_1 = _r2] << double_[_1 = _r3];
+ BOOST_TEST(test_delimited("a 10 12.4 ", start('a', 10, 12.4), space));
+
+ start = (char_ << int_ << double_)[_1 = _r1, _2 = _r2, _3 = _r3];
+ BOOST_TEST(test_delimited("a 10 12.4 ", start('a', 10, 12.4), space));
+
+ rule<outiter_type, space_type, void(char)> a;
+ rule<outiter_type, space_type, void(int)> b;
+ rule<outiter_type, space_type, void(double)> c;
+
+ a = char_[_1 = _r1];
+ b = int_[_1 = _r1];
+ c = double_[_1 = _r1];
+ start = a(_r1) << b(_r2) << c(_r3);
+ BOOST_TEST(test_delimited("a 10 12.4 ", start('a', 10, 12.4), space));
+ }
+
+ // copy tests
+ {
+ typedef variant<char, int, double> var_type;
+
+ rule<outiter_type> a, b, c, start;
+
+ a = 'a';
+ b = int_(10);
+ c = double_(12.4);
+
+ // The FF is the dynamic equivalent of start = a << b << c;
+ start = a;
+ start = start.copy() << b;
+ start = start.copy() << c;
+ start = start.copy();
+
+ BOOST_TEST(test("a1012.4", start));
+ }
+
+ {
+ typedef variant<char, int, double> var_type;
+
+ rule<outiter_type, space_type> a, b, c, start;
+
+ a = 'a';
+ b = int_(10);
+ c = double_(12.4);
+
+ // The FF is the dynamic equivalent of start = a << b << c;
+ start = a;
+ start = start.copy() << b;
+ start = start.copy() << c;
+ start = start.copy();
+
+ BOOST_TEST(test_delimited("a 10 12.4 ", start, space));
+ }
+
     return boost::report_errors();
 }
 

Modified: branches/release/libs/spirit/test/karma/real_numerics.cpp
==============================================================================
--- branches/release/libs/spirit/test/karma/real_numerics.cpp (original)
+++ branches/release/libs/spirit/test/karma/real_numerics.cpp 2009-09-14 12:45:39 EDT (Mon, 14 Sep 2009)
@@ -23,35 +23,34 @@
 ///////////////////////////////////////////////////////////////////////////////
 // policy for real_generator, which forces the scientific notation
 template <typename T>
-struct scientific_policy : boost::spirit::karma::real_generator_policies<T>
+struct scientific_policy : boost::spirit::karma::real_policies<T>
 {
     // we want the numbers always to be in scientific format
- typedef boost::spirit::karma::real_generator_policies<T> base_type;
- static int floatfield(T) { return base_type::scientific; }
+ typedef boost::spirit::karma::real_policies<T> base_type;
+ static int floatfield(T) { return base_type::fmtflags::scientific; }
 };
 
-///////////////////////////////////////////////////////////////////////////////
-// policy for real_generator, which forces the fixed notation
+// ///////////////////////////////////////////////////////////////////////////////
+// // policy for real_generator, which forces the fixed notation
 template <typename T>
-struct fixed_policy : boost::spirit::karma::real_generator_policies<T>
+struct fixed_policy : boost::spirit::karma::real_policies<T>
 {
- typedef boost::spirit::karma::real_generator_policies<T> base_type;
+ typedef boost::spirit::karma::real_policies<T> base_type;
 
     // we want the numbers always to be in scientific format
- static int floatfield(T) { return base_type::fixed; }
+ static int floatfield(T) { return base_type::fmtflags::fixed; }
 };
 
 ///////////////////////////////////////////////////////////////////////////////
 // policy for real_generator, which forces to output trailing zeros in the
 // fractional part
 template <typename T>
-struct trailing_zeros_policy
- : boost::spirit::karma::real_generator_policies<T> // 4 digits
+struct trailing_zeros_policy : boost::spirit::karma::real_policies<T> // 4 digits
 {
     // we want the numbers always to contain trailing zeros up to 4 digits in
     // the fractional part
- static bool const trailing_zeros = true;
-
+ static bool trailing_zeros(T) { return true; }
+
     // we want to generate up to 4 fractional digits
     static unsigned int precision(T) { return 4; }
 };
@@ -59,34 +58,60 @@
 ///////////////////////////////////////////////////////////////////////////////
 // policy for real_generator, which forces the sign to be generated
 template <typename T>
-struct signed_policy
- : boost::spirit::karma::real_generator_policies<T>
+struct signed_policy : boost::spirit::karma::real_policies<T>
 {
     // we want to always have a sign generated
- static bool const force_sign = true;
+ static bool const force_sign(T)
+ {
+ return true;
+ }
 };
 
-// support for using real_concept with a Karma generator has been implemented
-// in Boost versions > 1.36 only, additionally real_concept is available only
-// if BOOST_MATH_NO_LONG_DOUBLE_MATH_FUNCTIONS is not defined
-#if BOOST_VERSION > 103600 && !defined(BOOST_MATH_NO_LONG_DOUBLE_MATH_FUNCTIONS)
 ///////////////////////////////////////////////////////////////////////////////
-// We need to specialize is_real_lit_tag to allow to use a real_concept as a
-// literal below
-namespace boost { namespace spirit
+// policy for real_generator, which forces to output trailing zeros in the
+// fractional part
+template <typename T>
+struct bordercase_policy : boost::spirit::karma::real_policies<T>
 {
- template <typename Domain>
- struct is_real_lit_tag<boost::math::concepts::real_concept, Domain>
- : boost::mpl::true_ {};
-}}
-#endif
+ // we want to generate up to the maximum significant amount of fractional
+ // digits
+ static unsigned int precision(T)
+ {
+ return std::numeric_limits<T>::digits10 + 1;
+ }
+};
+
+///////////////////////////////////////////////////////////////////////////////
+// policy for real_generator, which forces to output trailing zeros in the
+// fractional part
+template <typename T>
+struct statefull_policy : boost::spirit::karma::real_policies<T>
+{
+ statefull_policy(int precision = 4, bool trailingzeros = false)
+ : precision_(precision), trailingzeros_(trailingzeros)
+ {}
+
+ // we want to generate up to the maximum significant amount of fractional
+ // digits
+ unsigned int precision(T) const
+ {
+ return precision_;
+ }
+
+ bool trailing_zeros(T) const
+ {
+ return trailingzeros_;
+ }
+
+ int precision_;
+ bool trailingzeros_;
+};
 
 ///////////////////////////////////////////////////////////////////////////////
-int
-main()
+int main()
 {
     using namespace boost::spirit;
-
+
     {
         ///////////////////////////////////////////////////////////////////////
         // use the default real_policies
@@ -96,7 +121,7 @@
         BOOST_TEST(test("1.001", double_, 1.001));
         BOOST_TEST(test("1.01", double_, 1.010));
         BOOST_TEST(test("1.1", double_, 1.100));
-
+
         BOOST_TEST(test("1.234e-04", double_, 0.00012345));
         BOOST_TEST(test("0.001", double_, 0.0012345));
         BOOST_TEST(test("0.012", double_, 0.012345));
@@ -107,18 +132,18 @@
         BOOST_TEST(test("1234.5", double_, 1234.5));
         BOOST_TEST(test("12342.0", double_, 12342.));
         BOOST_TEST(test("1.234e05", double_, 123420.));
-
+
         BOOST_TEST(test("-1.0", double_, -1.0));
         BOOST_TEST(test("-1.234", double_, -1.2345));
         BOOST_TEST(test("-1.235", double_, -1.2346));
         BOOST_TEST(test("-1234.2", double_, -1234.2));
-
+
         BOOST_TEST(test("1.0", double_(1.0)));
         BOOST_TEST(test("1.0", double_(1.0001)));
         BOOST_TEST(test("1.001", double_(1.001)));
         BOOST_TEST(test("1.01", double_(1.010)));
         BOOST_TEST(test("1.1", double_(1.100)));
-
+
         BOOST_TEST(test("1.234e-04", double_(0.00012345)));
         BOOST_TEST(test("0.001", double_(0.0012345)));
         BOOST_TEST(test("0.012", double_(0.012345)));
@@ -130,7 +155,7 @@
         BOOST_TEST(test("12342.0", double_(12342.)));
         BOOST_TEST(test("1.234e05", double_(123420.)));
     }
-
+
     {
         ///////////////////////////////////////////////////////////////////////
         // test NaN and Inf
@@ -139,7 +164,7 @@
         BOOST_TEST(test("inf", double_, std::numeric_limits<double>::infinity()));
         BOOST_TEST(test("-inf", double_, -std::numeric_limits<double>::infinity()));
 
- typedef karma::real_spec<double, signed_policy<double> > signed_type;
+ typedef karma::real_generator<double, signed_policy<double> > signed_type;
         signed_type const signed_ = signed_type();
 
         BOOST_TEST(test("+nan", signed_, std::numeric_limits<double>::quiet_NaN()));
@@ -147,17 +172,32 @@
         BOOST_TEST(test("+inf", signed_, std::numeric_limits<double>::infinity()));
         BOOST_TEST(test("-inf", signed_, -std::numeric_limits<double>::infinity()));
         BOOST_TEST(test(" 0.0", signed_, 0.0));
-
+
         BOOST_TEST(test("+nan", signed_(std::numeric_limits<double>::quiet_NaN())));
         BOOST_TEST(test("-nan", signed_(-std::numeric_limits<double>::quiet_NaN())));
         BOOST_TEST(test("+inf", signed_(std::numeric_limits<double>::infinity())));
         BOOST_TEST(test("-inf", signed_(-std::numeric_limits<double>::infinity())));
         BOOST_TEST(test(" 0.0", signed_(0.0)));
     }
-
+
+ {
+ ///////////////////////////////////////////////////////////////////////
+ typedef karma::real_generator<double, statefull_policy<double> >
+ statefull_type;
+
+ statefull_policy<double> policy(5, true);
+ statefull_type const statefull = statefull_type(policy);
+
+ BOOST_TEST(test("0.00000", statefull, 0.0));
+ BOOST_TEST(test("0.00000", statefull(0.0)));
+
+ using namespace boost::phoenix;
+ BOOST_TEST(test("0.00000", statefull(val(0.0))));
+ }
+
     {
         ///////////////////////////////////////////////////////////////////////
- typedef karma::real_spec<double, trailing_zeros_policy<double> >
+ typedef karma::real_generator<double, trailing_zeros_policy<double> >
             trailing_zeros_type;
         trailing_zeros_type const trail_zeros = trailing_zeros_type();
 
@@ -167,7 +207,7 @@
         BOOST_TEST(test("1.0010", trail_zeros, 1.001));
         BOOST_TEST(test("1.0100", trail_zeros, 1.010));
         BOOST_TEST(test("1.1000", trail_zeros, 1.100));
-
+
         BOOST_TEST(test("1.2345e-04", trail_zeros, 0.00012345));
         BOOST_TEST(test("0.0012", trail_zeros, 0.0012345));
         BOOST_TEST(test("0.0123", trail_zeros, 0.012345));
@@ -178,18 +218,18 @@
         BOOST_TEST(test("1234.5000", trail_zeros, 1234.5));
         BOOST_TEST(test("12342.0000", trail_zeros, 12342.));
         BOOST_TEST(test("1.2342e05", trail_zeros, 123420.));
-
+
         BOOST_TEST(test("-1.0000", trail_zeros, -1.0));
         BOOST_TEST(test("-1.2345", trail_zeros, -1.2345));
         BOOST_TEST(test("-1.2346", trail_zeros, -1.2346));
         BOOST_TEST(test("-1234.2000", trail_zeros, -1234.2));
-
+
         BOOST_TEST(test("1.0000", trail_zeros(1.0)));
         BOOST_TEST(test("1.0001", trail_zeros(1.0001)));
         BOOST_TEST(test("1.0010", trail_zeros(1.001)));
         BOOST_TEST(test("1.0100", trail_zeros(1.010)));
         BOOST_TEST(test("1.1000", trail_zeros(1.100)));
-
+
         BOOST_TEST(test("1.2345e-04", trail_zeros(0.00012345)));
         BOOST_TEST(test("0.0012", trail_zeros(0.0012345)));
         BOOST_TEST(test("0.0123", trail_zeros(0.012345)));
@@ -201,8 +241,10 @@
         BOOST_TEST(test("12342.0000", trail_zeros(12342.)));
         BOOST_TEST(test("1.2342e05", trail_zeros(123420.)));
     }
-
+
     {
+ using namespace boost::spirit::ascii;
+
         ///////////////////////////////////////////////////////////////////////
         BOOST_TEST(test_delimited("0.0 ", double_, 0.0, char_(' ')));
         BOOST_TEST(test_delimited("1.0 ", double_, 1.0, char_(' ')));
@@ -210,7 +252,7 @@
         BOOST_TEST(test_delimited("1.001 ", double_, 1.001, char_(' ')));
         BOOST_TEST(test_delimited("1.01 ", double_, 1.010, char_(' ')));
         BOOST_TEST(test_delimited("1.1 ", double_, 1.100, char_(' ')));
-
+
         BOOST_TEST(test_delimited("1.234e-04 ", double_, 0.00012345, char_(' ')));
         BOOST_TEST(test_delimited("0.001 ", double_, 0.0012345, char_(' ')));
         BOOST_TEST(test_delimited("0.012 ", double_, 0.012345, char_(' ')));
@@ -221,18 +263,18 @@
         BOOST_TEST(test_delimited("1234.5 ", double_, 1234.5, char_(' ')));
         BOOST_TEST(test_delimited("12342.0 ", double_, 12342., char_(' ')));
         BOOST_TEST(test_delimited("1.234e05 ", double_, 123420., char_(' ')));
-
+
         BOOST_TEST(test_delimited("-1.0 ", double_, -1.0, char_(' ')));
         BOOST_TEST(test_delimited("-1.234 ", double_, -1.2345, char_(' ')));
         BOOST_TEST(test_delimited("-1.235 ", double_, -1.2346, char_(' ')));
         BOOST_TEST(test_delimited("-1234.2 ", double_, -1234.2, char_(' ')));
-
+
         BOOST_TEST(test_delimited("1.0 ", double_(1.0), char_(' ')));
         BOOST_TEST(test_delimited("1.0 ", double_(1.0001), char_(' ')));
         BOOST_TEST(test_delimited("1.001 ", double_(1.001), char_(' ')));
         BOOST_TEST(test_delimited("1.01 ", double_(1.010), char_(' ')));
         BOOST_TEST(test_delimited("1.1 ", double_(1.100), char_(' ')));
-
+
         BOOST_TEST(test_delimited("1.234e-04 ", double_(0.00012345), char_(' ')));
         BOOST_TEST(test_delimited("0.001 ", double_(0.0012345), char_(' ')));
         BOOST_TEST(test_delimited("0.012 ", double_(0.012345), char_(' ')));
@@ -246,6 +288,8 @@
     }
 
     {
+ using namespace boost::spirit::ascii;
+
         ///////////////////////////////////////////////////////////////////////
         // test NaN and Inf
         BOOST_TEST(test_delimited("nan ", double_,
@@ -257,7 +301,7 @@
         BOOST_TEST(test_delimited("-inf ", double_,
             -std::numeric_limits<double>::infinity(), char_(' ')));
 
- typedef karma::real_spec<double, signed_policy<double> > signed_type;
+ typedef karma::real_generator<double, signed_policy<double> > signed_type;
         signed_type const signed_ = signed_type();
 
         BOOST_TEST(test_delimited("+nan ", signed_,
@@ -273,15 +317,15 @@
 
     {
         using namespace boost::spirit::ascii;
-
+
         ///////////////////////////////////////////////////////////////////////
- typedef karma::real_spec<double, scientific_policy<double> >
+ typedef karma::real_generator<double, scientific_policy<double> >
             science_type;
         science_type const science = science_type();
-
+
         BOOST_TEST(test("0.0e00", science, 0.0));
         BOOST_TEST(test("1.0e00", science, 1.0));
-
+
         BOOST_TEST(test("1.234e-05", science, 0.000012345));
         BOOST_TEST(test("1.234e-04", science, 0.00012345));
         BOOST_TEST(test("1.234e-03", science, 0.0012345));
@@ -330,17 +374,17 @@
         BOOST_TEST(test("-1.234E04", upper[science], -12342.));
         BOOST_TEST(test("-1.234E05", upper[science], -123420.));
     }
-
+
     {
         using namespace boost::spirit::ascii;
-
+
         ///////////////////////////////////////////////////////////////////////
- typedef karma::real_spec<double, fixed_policy<double> > fixed_type;
+ typedef karma::real_generator<double, fixed_policy<double> > fixed_type;
         fixed_type const fixed = fixed_type();
-
+
         BOOST_TEST(test("0.0", fixed, 0.0));
         BOOST_TEST(test("1.0", fixed, 1.0));
-
+
         BOOST_TEST(test("0.0", fixed, 0.000012345));
         BOOST_TEST(test("0.0", fixed, 0.00012345));
         BOOST_TEST(test("0.001", fixed, 0.0012345));
@@ -369,8 +413,21 @@
     }
 
     {
+ BOOST_TEST(test("1.0", lit(1.0)));
+ BOOST_TEST(test("1.0", lit(1.0f)));
+ BOOST_TEST(test("1.0", lit(1.0l)));
+
+ BOOST_TEST(test("1.0", double_(1.0), 1.0));
+ BOOST_TEST(test("1.0", float_(1.0), 1.0f));
+ BOOST_TEST(test("1.0", long_double(1.0), 1.0l));
+ BOOST_TEST(!test("", double_(1.0), 2.0));
+ BOOST_TEST(!test("", float_(1.0), 2.0f));
+ BOOST_TEST(!test("", long_double(1.0), 2.0l));
+ }
+
+ {
         using namespace boost::spirit::ascii;
-
+
         ///////////////////////////////////////////////////////////////////////
         // test NaN and Inf
         BOOST_TEST(test("NAN", upper[double_],
@@ -382,7 +439,7 @@
         BOOST_TEST(test("-INF", upper[double_],
             -std::numeric_limits<double>::infinity()));
 
- typedef karma::real_spec<double, signed_policy<double> > signed_type;
+ typedef karma::real_generator<double, signed_policy<double> > signed_type;
         signed_type const signed_ = signed_type();
 
         BOOST_TEST(test("+NAN", upper[signed_],
@@ -402,7 +459,7 @@
 #if BOOST_VERSION > 103600 && !defined(BOOST_MATH_NO_LONG_DOUBLE_MATH_FUNCTIONS)
     {
         using boost::math::concepts::real_concept;
- typedef karma::real_spec<real_concept> custom_type;
+ typedef karma::real_generator<real_concept> custom_type;
         custom_type const custom = custom_type();
 
         BOOST_TEST(test("0.0", custom, real_concept(0.0)));
@@ -411,7 +468,7 @@
         BOOST_TEST(test("1.001", custom, real_concept(1.001)));
         BOOST_TEST(test("1.01", custom, real_concept(1.010)));
         BOOST_TEST(test("1.1", custom, real_concept(1.100)));
-
+
         BOOST_TEST(test("1.234e-04", custom, real_concept(0.00012345)));
         BOOST_TEST(test("0.001", custom, real_concept(0.0012345)));
         BOOST_TEST(test("0.012", custom, real_concept(0.012345)));
@@ -422,18 +479,18 @@
         BOOST_TEST(test("1234.5", custom, real_concept(1234.5)));
         BOOST_TEST(test("12342.0", custom, real_concept(12342.)));
         BOOST_TEST(test("1.234e05", custom, real_concept(123420.)));
-
+
         BOOST_TEST(test("-1.0", custom, real_concept(-1.0)));
         BOOST_TEST(test("-1.234", custom, real_concept(-1.2345)));
         BOOST_TEST(test("-1.235", custom, real_concept(-1.2346)));
         BOOST_TEST(test("-1234.2", custom, real_concept(-1234.2)));
-
+
         BOOST_TEST(test("1.0", custom(real_concept(1.0))));
         BOOST_TEST(test("1.0", custom(real_concept(1.0001))));
         BOOST_TEST(test("1.001", custom(real_concept(1.001))));
         BOOST_TEST(test("1.01", custom(real_concept(1.010))));
         BOOST_TEST(test("1.1", custom(real_concept(1.100))));
-
+
         BOOST_TEST(test("1.234e-04", custom(real_concept(0.00012345))));
         BOOST_TEST(test("0.001", custom(real_concept(0.0012345))));
         BOOST_TEST(test("0.012", custom(real_concept(0.012345))));
@@ -447,5 +504,23 @@
     }
 #endif
 
+ {
+ ///////////////////////////////////////////////////////////////////////
+ typedef karma::real_generator<double, bordercase_policy<double> >
+ bordercase_type;
+ bordercase_type const bordercase = bordercase_type();
+
+// BOOST_TEST(test("-5.7222349715140557e307",
+// bordercase(-5.7222349715140557e307)));
+
+ BOOST_TEST(test("1.7976931348623158e308",
+ bordercase(1.7976931348623158e308))); // DBL_MAX
+ BOOST_TEST(test("-1.7976931348623158e308",
+ bordercase(-1.7976931348623158e308))); // -DBL_MAX
+ BOOST_TEST(test("2.2250738585072014e-308",
+ bordercase(2.2250738585072014e-308))); // DBL_MIN
+ BOOST_TEST(test("-2.2250738585072014e-308",
+ bordercase(-2.2250738585072014e-308))); // -DBL_MIN
+ }
     return boost::report_errors();
 }

Modified: branches/release/libs/spirit/test/karma/right_alignment.cpp
==============================================================================
--- branches/release/libs/spirit/test/karma/right_alignment.cpp (original)
+++ branches/release/libs/spirit/test/karma/right_alignment.cpp 2009-09-14 12:45:39 EDT (Mon, 14 Sep 2009)
@@ -14,13 +14,13 @@
 
 #include "test.hpp"
 
-using namespace spirit_test;
-
 ///////////////////////////////////////////////////////////////////////////////
 int
 main()
 {
+ using namespace spirit_test;
     using namespace boost::spirit;
+ using namespace boost::spirit::ascii;
 
     {
         BOOST_TEST(test(" x", right_align[char_('x')]));
@@ -40,18 +40,18 @@
         BOOST_TEST(test("*********x", right_align(char_('*'))['x']));
 
         BOOST_TEST(test(" abc", right_align[lit("abc")]));
- BOOST_TEST(test(" abc", right_align[lit], "abc"));
+ BOOST_TEST(test(" abc", right_align[string], "abc"));
         
         BOOST_TEST(test(" abc", right_align(10)[lit("abc")]));
- BOOST_TEST(test(" abc", right_align(10)[lit], "abc"));
+ BOOST_TEST(test(" abc", right_align(10)[string], "abc"));
         BOOST_TEST(test(" abc", right_align(10)["abc"]));
 
         BOOST_TEST(test("*******abc", right_align(10, char_('*'))[lit("abc")]));
- BOOST_TEST(test("*******abc", right_align(10, '*')[lit], "abc"));
+ BOOST_TEST(test("*******abc", right_align(10, '*')[string], "abc"));
         BOOST_TEST(test("*******abc", right_align(10, '*')["abc"]));
 
         BOOST_TEST(test("*******abc", right_align(char_('*'))[lit("abc")]));
- BOOST_TEST(test("*******abc", right_align(char_('*'))[lit], "abc"));
+ BOOST_TEST(test("*******abc", right_align(char_('*'))[string], "abc"));
         BOOST_TEST(test("*******abc", right_align(char_('*'))["abc"]));
 
         BOOST_TEST(test(" 100", right_align[int_(100)]));

Modified: branches/release/libs/spirit/test/karma/rule_fail.cpp
==============================================================================
--- branches/release/libs/spirit/test/karma/rule_fail.cpp (original)
+++ branches/release/libs/spirit/test/karma/rule_fail.cpp 2009-09-14 12:45:39 EDT (Mon, 14 Sep 2009)
@@ -19,20 +19,19 @@
 using namespace boost::spirit::karma;
 using namespace boost::spirit::ascii;
 
-// this test must fail compiling
+// this test must fail compiling as the rule is used with an incompatible
+// delimiter type
 int main()
 {
- using boost::make_function_output_iterator;
- using spirit_test::make_string_appender;
-
+ typedef spirit_test::output_iterator<char>::type outiter_type;
+
     std::string generated;
-
- rule<char const*, rule<char const*> > def;
+
+ rule<outiter_type, rule<outiter_type> > def;
     def = int_(1) << ',' << int_(0);
-
- bool r = generate_delimited(
- make_function_output_iterator(make_string_appender(generated)),
- def, char_('%') << '\n');
+
+ std::back_insert_iterator<std::string> outit(generated);
+ generate_delimited(outit, def, char_('%') << '\n');
 
     return 0;
 }

Modified: branches/release/libs/spirit/test/karma/sequence.cpp
==============================================================================
--- branches/release/libs/spirit/test/karma/sequence.cpp (original)
+++ branches/release/libs/spirit/test/karma/sequence.cpp 2009-09-14 12:45:39 EDT (Mon, 14 Sep 2009)
@@ -8,7 +8,6 @@
 #include <boost/config/warning_disable.hpp>
 #include <boost/detail/lightweight_test.hpp>
 
-#include <boost/spirit/include/support_argument.hpp>
 #include <boost/spirit/include/karma_char.hpp>
 #include <boost/spirit/include/karma_string.hpp>
 #include <boost/spirit/include/karma_numeric.hpp>
@@ -16,11 +15,12 @@
 #include <boost/spirit/include/karma_operator.hpp>
 #include <boost/spirit/include/karma_directive.hpp>
 #include <boost/spirit/include/karma_action.hpp>
-#include <boost/fusion/include/vector.hpp>
+#include <boost/spirit/include/karma_nonterminal.hpp>
 #include <boost/spirit/include/support_unused.hpp>
 #include <boost/spirit/include/phoenix_core.hpp>
 #include <boost/spirit/include/phoenix_operator.hpp>
 #include <boost/spirit/include/phoenix_statement.hpp>
+#include <boost/fusion/include/vector.hpp>
 
 #include "test.hpp"
 
@@ -31,8 +31,9 @@
 main()
 {
     using namespace boost::spirit;
+ using namespace boost::spirit::ascii;
     namespace fusion = boost::fusion;
-
+
     {
         {
             BOOST_TEST(test("xi", char_('x') << char_('i')));
@@ -49,12 +50,12 @@
             BOOST_TEST(test_delimited("Hello , World ",
                 lit("Hello") << ',' << "World", char(' ')));
         }
-
+
         {
             fusion::vector<char, char, std::string> p ('a', 'b', "cdefg");
- BOOST_TEST(test("abcdefg", char_ << char_ << lit, p));
+ BOOST_TEST(test("abcdefg", char_ << char_ << string, p));
             BOOST_TEST(test_delimited("a b cdefg ",
- char_ << char_ << lit, p, char(' ')));
+ char_ << char_ << string, p, char(' ')));
         }
 
         {
@@ -69,22 +70,32 @@
             // sequence has an unused parameter as well
             fusion::vector<char, char> p ('a', 'e');
             BOOST_TEST(test("abcde",
- char_ << (char_('b') << 'c' << 'd') << char_, p));
+ char_ << (lit('b') << 'c' << 'd') << char_, p));
             BOOST_TEST(test_delimited("a b c d e ",
- char_ << (char_('b') << 'c' << 'd') << char_, p, char(' ')));
+ char_ << (lit('b') << 'c' << 'd') << char_, p, char(' ')));
         }
 
         {
- // literal generators do not need a parameter
+ // literal generators do not need an attribute
             fusion::vector<char, char> p('a', 'c');
             BOOST_TEST(test("abc", char_ << 'b' << char_, p));
             BOOST_TEST(test_delimited("a b c ",
                 char_ << 'b' << char_, p, char(' ')));
         }
-
+
+ {
+ std::list<int> v;
+ v.push_back(1);
+ v.push_back(2);
+ v.push_back(3);
+ BOOST_TEST(test("123", int_ << int_ << int_, v));
+ BOOST_TEST(test_delimited("1 2 3 ", int_ << int_ << int_, v, ' '));
+ BOOST_TEST(test("1,2,3", int_ << ',' << int_ << ',' << int_, v));
+ BOOST_TEST(test_delimited("1 , 2 , 3 ",
+ int_ << ',' << int_ << ',' << int_, v, ' '));
+ }
+
         {
- using namespace boost::spirit::ascii;
-
             BOOST_TEST(test("aa", lower[char_('A') << 'a']));
             BOOST_TEST(test_delimited("BEGIN END ",
                 upper[lit("begin") << "end"], char(' ')));
@@ -92,24 +103,32 @@
                 upper[lit("begin") << "nend"], char(' ')));
 
             BOOST_TEST(test("Aa ", left_align[char_('A') << 'a']));
- BOOST_TEST(test(" Aa ", center[char_('A') << 'a']));
- BOOST_TEST(test(" Aa", right_align[char_('A') << 'a']));
+// BOOST_TEST(test(" Aa ", center[char_('A') << 'a']));
+// BOOST_TEST(test(" Aa", right_align[char_('A') << 'a']));
+ }
+
+ {
+ // make sure single element tuples get passed through if the rhs
+ // has a single element tuple as its attribute
+ typedef spirit_test::output_iterator<char>::type iterator_type;
+ fusion::vector<double, int> fv(2.0, 1);
+ karma::rule<iterator_type, fusion::vector<double, int>()> r;
+ r %= double_ << ',' << int_;
+ BOOST_TEST(test("test:2.0,1", "test:" << r, fv));
         }
 
         // action tests
         {
             using namespace boost::phoenix;
- using namespace boost::spirit::arg_names;
- using namespace boost::spirit::ascii;
 
             BOOST_TEST(test("abcdefg",
- (char_ << char_ << lit)[_1 = 'a', _2 = 'b', _3 = "cdefg"]));
+ (char_ << char_ << string)[_1 = 'a', _2 = 'b', _3 = "cdefg"]));
             BOOST_TEST(test_delimited("a b cdefg ",
- (char_ << char_ << lit)[_1 = 'a', _2 = 'b', _3 = "cdefg"],
+ (char_ << char_ << string)[_1 = 'a', _2 = 'b', _3 = "cdefg"],
                 char(' ')));
 
             BOOST_TEST(test_delimited("a 12 c ",
- (char_ << int_(12) << char_)[_1 = 'a', _2 = 'c'], char(' ')));
+ (char_ << lit(12) << char_)[_1 = 'a', _2 = 'c'], char(' ')));
 
             char c = 'c';
             BOOST_TEST(test("abc",
@@ -125,7 +144,7 @@
             BOOST_TEST(test(" Aa", right_align[char_ << 'a'][_1 = 'A']));
         }
     }
-
+
     return boost::report_errors();
 }
 

Modified: branches/release/libs/spirit/test/karma/test.hpp
==============================================================================
--- branches/release/libs/spirit/test/karma/test.hpp (original)
+++ branches/release/libs/spirit/test/karma/test.hpp 2009-09-14 12:45:39 EDT (Mon, 14 Sep 2009)
@@ -44,6 +44,19 @@
     };
 
     ///////////////////////////////////////////////////////////////////////////
+ template <typename Char, typename T>
+ void print_if_failed(char const* func, bool result
+ , std::basic_string<Char> const& generated, T const& expected)
+ {
+ if (!result)
+ std::cerr << "in " << func << ": result is false" << std::endl;
+ else if (generated != expected)
+ std::cerr << "in " << func << ": generated \""
+ << std::string(generated.begin(), generated.end())
+ << "\"" << std::endl;
+ }
+
+ ///////////////////////////////////////////////////////////////////////////
     template <typename Char, typename Generator>
     inline bool test(Char const *expected, Generator const& g)
     {
@@ -55,8 +68,10 @@
         karma::what(g);
 
         string_type generated;
- bool result = karma::generate(std::back_inserter(generated), g);
+ std::back_insert_iterator<string_type> outit(generated);
+ bool result = karma::generate(outit, g);
 
+ print_if_failed("test", result, generated, expected);
         return result && generated == expected;
     }
 
@@ -71,15 +86,17 @@
         karma::what(g);
 
         string_type generated;
- bool result = karma::generate(std::back_inserter(generated), g);
+ std::back_insert_iterator<string_type> outit(generated);
+ bool result = karma::generate(outit, g);
 
+ print_if_failed("test", result, generated, expected);
         return result && generated == expected;
     }
 
     ///////////////////////////////////////////////////////////////////////////
- template <typename Char, typename Generator, typename Parameter>
+ template <typename Char, typename Generator, typename Attribute>
     inline bool test(Char const *expected, Generator const& g,
- Parameter const &parameter)
+ Attribute const &attr)
     {
         namespace karma = boost::spirit::karma;
         typedef std::basic_string<Char> string_type;
@@ -89,14 +106,16 @@
         karma::what(g);
 
         string_type generated;
- bool result = karma::generate(std::back_inserter(generated), g, parameter);
+ std::back_insert_iterator<string_type> outit(generated);
+ bool result = karma::generate(outit, g, attr);
 
+ print_if_failed("test", result, generated, expected);
         return result && generated == expected;
     }
 
- template <typename Char, typename Generator, typename Parameter>
+ template <typename Char, typename Generator, typename Attribute>
     inline bool test(std::basic_string<Char> const& expected, Generator const& g,
- Parameter const &parameter)
+ Attribute const &attr)
     {
         namespace karma = boost::spirit::karma;
         typedef std::basic_string<Char> string_type;
@@ -106,8 +125,10 @@
         karma::what(g);
 
         string_type generated;
- bool result = karma::generate(std::back_inserter(generated), g, parameter);
+ std::back_insert_iterator<string_type> outit(generated);
+ bool result = karma::generate(outit, g, attr);
 
+ print_if_failed("test", result, generated, expected);
         return result && generated == expected;
     }
 
@@ -124,8 +145,10 @@
         karma::what(g);
 
         string_type generated;
- bool result = karma::generate_delimited(std::back_inserter(generated), g, d);
+ std::back_insert_iterator<string_type> outit(generated);
+ bool result = karma::generate_delimited(outit, g, d);
 
+ print_if_failed("test_delimited", result, generated, expected);
         return result && generated == expected;
     }
 
@@ -141,16 +164,18 @@
         karma::what(g);
 
         string_type generated;
- bool result = karma::generate_delimited(std::back_inserter(generated), g, d);
+ std::back_insert_iterator<string_type> outit(generated);
+ bool result = karma::generate_delimited(outit, g, d);
 
+ print_if_failed("test_delimited", result, generated, expected);
         return result && generated == expected;
     }
 
     ///////////////////////////////////////////////////////////////////////////
- template <typename Char, typename Generator, typename Parameter,
+ template <typename Char, typename Generator, typename Attribute,
         typename Delimiter>
     inline bool test_delimited(Char const *expected, Generator const& g,
- Parameter const &parameter, Delimiter const& d)
+ Attribute const &attr, Delimiter const& d)
     {
         namespace karma = boost::spirit::karma;
         typedef std::basic_string<Char> string_type;
@@ -160,16 +185,17 @@
         karma::what(g);
 
         string_type generated;
- bool result = karma::generate_delimited(std::back_inserter(generated),
- g, parameter, d);
+ std::back_insert_iterator<string_type> outit(generated);
+ bool result = karma::generate_delimited(outit, g, d, attr);
 
+ print_if_failed("test_delimited", result, generated, expected);
         return result && generated == expected;
     }
 
- template <typename Char, typename Generator, typename Parameter,
+ template <typename Char, typename Generator, typename Attribute,
         typename Delimiter>
     inline bool test_delimited(std::basic_string<Char> const& expected,
- Generator const& g, Parameter const &parameter, Delimiter const& d)
+ Generator const& g, Attribute const &attr, Delimiter const& d)
     {
         namespace karma = boost::spirit::karma;
         typedef std::basic_string<Char> string_type;
@@ -179,9 +205,10 @@
         karma::what(g);
 
         string_type generated;
- bool result = karma::generate_delimited(std::back_inserter(generated),
- g, parameter, d);
+ std::back_insert_iterator<string_type> outit(generated);
+ bool result = karma::generate_delimited(outit, g, d, attr);
 
+ print_if_failed("test_delimited", result, generated, expected);
         return result && generated == expected;
     }
 
@@ -199,16 +226,17 @@
         karma::what(g);
 
         string_type generated;
- bool result = karma::generate(std::back_inserter(generated), g);
+ std::back_insert_iterator<string_type> outit(generated);
+ bool result = karma::generate(outit, g);
 
         return result && !std::memcmp(generated.c_str(), expected, size);
     }
 
     ///////////////////////////////////////////////////////////////////////////
- template <typename Generator, typename Parameter>
+ template <typename Generator, typename Attribute>
     inline bool
     binary_test(char const *expected, std::size_t size,
- Generator const& g, Parameter const &parameter)
+ Generator const& g, Attribute const &attr)
     {
         namespace karma = boost::spirit::karma;
         typedef std::basic_string<char> string_type;
@@ -218,7 +246,8 @@
         karma::what(g);
 
         string_type generated;
- bool result = karma::generate(std::back_inserter(generated), g, parameter);
+ std::back_insert_iterator<string_type> outit(generated);
+ bool result = karma::generate(outit, g, attr);
 
         return result && !std::memcmp(generated.c_str(), expected, size);
     }
@@ -237,17 +266,17 @@
         karma::what(g);
 
         string_type generated;
- bool result = karma::generate_delimited(std::back_inserter(generated),
- g, d);
+ std::back_insert_iterator<string_type> outit(generated);
+ bool result = karma::generate_delimited(outit, g, d);
 
         return result && !std::memcmp(generated.c_str(), expected, size);
     }
 
     ///////////////////////////////////////////////////////////////////////////
- template <typename Generator, typename Parameter, typename Delimiter>
+ template <typename Generator, typename Attribute, typename Delimiter>
     inline bool
     binary_test_delimited(char const *expected, std::size_t size,
- Generator const& g, Parameter const &parameter, Delimiter const& d)
+ Generator const& g, Attribute const &attr, Delimiter const& d)
     {
         namespace karma = boost::spirit::karma;
         typedef std::basic_string<char> string_type;
@@ -257,8 +286,8 @@
         karma::what(g);
 
         string_type generated;
- bool result = karma::generate_delimited(std::back_inserter(generated),
- g, parameter, d);
+ std::back_insert_iterator<string_type> outit(generated);
+ bool result = karma::generate_delimited(outit, g, d, attr);
 
         return result && !std::memcmp(generated.c_str(), expected, size);
     }

Modified: branches/release/libs/spirit/test/lex/lexertl1.cpp
==============================================================================
--- branches/release/libs/spirit/test/lex/lexertl1.cpp (original)
+++ branches/release/libs/spirit/test/lex/lexertl1.cpp 2009-09-14 12:45:39 EDT (Mon, 14 Sep 2009)
@@ -4,12 +4,11 @@
 // file LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt)
 
 #include <boost/detail/lightweight_test.hpp>
-#include <boost/spirit/include/lex_lexer_lexertl.hpp>
+#include <boost/spirit/include/lex_lexertl.hpp>
 #include "test.hpp"
 
 ///////////////////////////////////////////////////////////////////////////////
-int
-main()
+int main()
 {
     using namespace boost::spirit;
     using namespace spirit_test;
@@ -19,53 +18,53 @@
 
     // initialize tokens
     typedef lex::token_def<std::string> token_def;
-
+
     std::size_t const CCOMMENT = 1;
     std::size_t const CPPCOMMENT = 2;
     token_def c_comment ("\\/\\*[^*]*\\*+([^/*][^*]*\\*+)*\\/", CCOMMENT);
     token_def cpp_comment ("\\/\\/[^\\n\\r]*(\\n|\\r|\\r\\n)", CPPCOMMENT);
-
+
     typedef std::string::iterator base_iterator_type;
- typedef lex::lexertl_token<base_iterator_type> token_type;
- typedef lex::lexertl_lexer<token_type> lexer_type;
- typedef lex::lexer_def<lexer_type> lexer_def;
+ typedef lex::lexertl::token<base_iterator_type> token_type;
+ typedef lex::lexertl::lexer<token_type> lexer_type;
+ typedef lex::lexer<lexer_type> lexer_def;
 
     {
         // initialize lexer
- lexer_def def;
- def.self = c_comment;
- def.self += cpp_comment;
-
+ lexer_def lex;
+ lex.self = c_comment;
+ lex.self += cpp_comment;
+
         // test lexer for two different input strings
- lex::lexer<lexer_def> lex(def);
         BOOST_TEST(test (lex, "/* this is a comment */", CCOMMENT));
         BOOST_TEST(test (lex, "// this is a comment as well\n", CPPCOMMENT));
     }
-
+
     {
         // initialize lexer
- lexer_def def;
- def.self = c_comment | cpp_comment;
-
+ lexer_def lex;
+ lex.self = c_comment | cpp_comment;
+
         // test lexer for two different input strings
- lex::lexer<lexer_def> lex(def);
         BOOST_TEST(test (lex, "/* this is a comment */", CCOMMENT));
         BOOST_TEST(test (lex, "// this is a comment as well\n", CPPCOMMENT));
     }
-
+
     {
+ using namespace boost::spirit::ascii;
+
         // initialize lexer
- lexer_def def;
- def.self = token_def('+') | '-' | c_comment;
- def.self += '*' | cpp_comment;
-
+ lexer_def lex;
+ lex.self = token_def('+') | '-' | c_comment;
+ lex.self += char_('*') | '/' | cpp_comment;
+
         // test lexer for two different input strings
- lex::lexer<lexer_def> lex(def);
         BOOST_TEST(test (lex, "/* this is a comment */", CCOMMENT));
         BOOST_TEST(test (lex, "// this is a comment as well\n", CPPCOMMENT));
         BOOST_TEST(test (lex, "+", '+'));
         BOOST_TEST(test (lex, "-", '-'));
         BOOST_TEST(test (lex, "*", '*'));
+ BOOST_TEST(test (lex, "/", '/'));
     }
 
     return boost::report_errors();

Modified: branches/release/libs/spirit/test/lex/lexertl2.cpp
==============================================================================
--- branches/release/libs/spirit/test/lex/lexertl2.cpp (original)
+++ branches/release/libs/spirit/test/lex/lexertl2.cpp 2009-09-14 12:45:39 EDT (Mon, 14 Sep 2009)
@@ -4,7 +4,7 @@
 // file LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt)
 
 #include <boost/detail/lightweight_test.hpp>
-#include <boost/spirit/include/lex_lexer_lexertl.hpp>
+#include <boost/spirit/include/lex_lexertl.hpp>
 #include <string>
 
 #include "test.hpp"
@@ -12,52 +12,48 @@
 ///////////////////////////////////////////////////////////////////////////////
 // a simple lexer class
 template <typename Lexer>
-struct lexertl_test : boost::spirit::lex::lexer_def<Lexer>
+struct lexertl_test
+ : boost::spirit::lex::lexer<Lexer>
 {
     typedef boost::spirit::lex::token_def<std::string> token_def;
 
     static std::size_t const CCOMMENT = 1;
     static std::size_t const CPPCOMMENT = 2;
-
- template <typename Self>
- void def(Self& self)
+
+ lexertl_test()
+ : c_comment("\\/\\*[^*]*\\*+([^/*][^*]*\\*+)*\\/", CCOMMENT)
+ , cpp_comment("\\/\\/[^\\n\\r]*(\\n|\\r|\\r\\n)", CPPCOMMENT)
     {
- c_comment = token_def("\\/\\*[^*]*\\*+([^/*][^*]*\\*+)*\\/", CCOMMENT);
- cpp_comment = token_def("\\/\\/[^\\n\\r]*(\\n|\\r|\\r\\n)", CPPCOMMENT);
-
- self = c_comment;
- self += cpp_comment;
+ this->self = c_comment;
+ this->self += cpp_comment;
     }
 
     token_def c_comment, cpp_comment;
 };
 
 template <typename Lexer>
-struct wlexertl_test : boost::spirit::lex::lexer_def<Lexer>
+struct wlexertl_test
+ : boost::spirit::lex::lexer<Lexer>
 {
- typedef
- boost::spirit::lex::token_def<std::basic_string<wchar_t>, wchar_t>
- token_def;
+ typedef boost::spirit::lex::token_def<std::basic_string<wchar_t>, wchar_t>
+ token_def;
 
     static std::size_t const CCOMMENT = 1;
     static std::size_t const CPPCOMMENT = 2;
-
- template <typename Self>
- void def(Self& self)
+
+ wlexertl_test()
+ : c_comment(L"\\/\\*[^*]*\\*+([^/*][^*]*\\*+)*\\/", CCOMMENT)
+ , cpp_comment(L"\\/\\/[^\\n\\r]*(\\n|\\r|\\r\\n)", CPPCOMMENT)
     {
- c_comment = token_def(L"\\/\\*[^*]*\\*+([^/*][^*]*\\*+)*\\/", CCOMMENT);
- cpp_comment = token_def(L"\\/\\/[^\\n\\r]*(\\n|\\r|\\r\\n)", CPPCOMMENT);
-
- self = c_comment;
- self += cpp_comment;
+ this->self = c_comment;
+ this->self += cpp_comment;
     }
 
     token_def c_comment, cpp_comment;
 };
 
 ///////////////////////////////////////////////////////////////////////////////
-int
-main()
+int main()
 {
     using namespace boost::spirit;
     using namespace spirit_test;
@@ -67,30 +63,29 @@
     {
         // initialize lexer
         typedef std::string::iterator base_iterator_type;
- typedef lex::lexertl_token<base_iterator_type> token_type;
- typedef lex::lexertl_lexer<token_type> lexer_type;
+ typedef lex::lexertl::token<base_iterator_type> token_type;
+ typedef lex::lexertl::lexer<token_type> lexer_type;
         typedef lexertl_test<lexer_type> lexer_def;
-
+
         // test lexer for two different input strings
- lexer_def def;
- lex::lexer<lexer_def> lex(def);
+ lexer_def lex;
         BOOST_TEST(test (lex, "/* this is a comment */", lexer_def::CCOMMENT));
         BOOST_TEST(test (lex, "// this is a comment as well\n", lexer_def::CPPCOMMENT));
     }
-
+
     {
         // initialize lexer
         typedef std::basic_string<wchar_t>::iterator base_iterator_type;
- typedef lex::lexertl_token<base_iterator_type> token_type;
- typedef lex::lexertl_lexer<token_type> lexer_type;
+ typedef lex::lexertl::token<base_iterator_type> token_type;
+ typedef lex::lexertl::lexer<token_type> lexer_type;
         typedef wlexertl_test<lexer_type> lexer_def;
-
+
         // test lexer for two different input strings
- lexer_def def;
- lex::lexer<lexer_def> lex(def);
+ lexer_def lex;
         BOOST_TEST(test (lex, L"/* this is a comment */", lexer_def::CCOMMENT));
         BOOST_TEST(test (lex, L"// this is a comment as well\n", lexer_def::CPPCOMMENT));
     }
-
+
     return boost::report_errors();
 }
+

Modified: branches/release/libs/spirit/test/lex/lexertl3.cpp
==============================================================================
--- branches/release/libs/spirit/test/lex/lexertl3.cpp (original)
+++ branches/release/libs/spirit/test/lex/lexertl3.cpp 2009-09-14 12:45:39 EDT (Mon, 14 Sep 2009)
@@ -4,12 +4,11 @@
 // file LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt)
 
 #include <boost/detail/lightweight_test.hpp>
-#include <boost/spirit/include/lex_lexer_lexertl.hpp>
+#include <boost/spirit/include/lex_lexertl.hpp>
 #include "test.hpp"
 
 ///////////////////////////////////////////////////////////////////////////////
-int
-main()
+int main()
 {
     using namespace boost::spirit;
     using namespace boost::spirit::lex;
@@ -17,32 +16,28 @@
 
     // initialize tokens
     typedef lex::token_def<std::string> token_def;
-
+
     std::size_t const CCOMMENT = 1;
     std::size_t const CPPCOMMENT = 2;
     token_def c_comment ("\\/\\*[^*]*\\*+([^/*][^*]*\\*+)*\\/", CCOMMENT);
     token_def cpp_comment ("\\/\\/[^\\n\\r]*(\\n|\\r|\\r\\n)", CPPCOMMENT);
- token_def ws_tok ("[\\v\\f\\n\\r]*");
-
+
     typedef std::string::iterator base_iterator_type;
- typedef lex::lexertl_token<base_iterator_type> token_type;
- typedef lex::lexertl_lexer<token_type> lexer_type;
-
- typedef lexer_type::token_set token_set;
- typedef lex::lexer_def<lexer_type> lexer_def;
+ typedef lex::lexertl::token<base_iterator_type> token_type;
+ typedef lex::lexertl::lexer<token_type> lexer_type;
+
+ typedef lex::lexer<lexer_type> lexer_def;
 
- lexer_def def;
-
     {
         // initialize lexer
         std::string str("def");
- lexer_def def;
- def.self = c_comment;
- def.self += cpp_comment | '1' | '2' | '3' | "abc" | str;
- def.self += token_def(' ') | '\t' | ws_tok;
+ token_def ws_tok ("[\\v\\f\\n\\r]*");
+ lexer_def lex;
+ lex.self = c_comment;
+ lex.self += cpp_comment | '1' | '2' | '3' | "abc" | str;
+ lex.self += token_def(' ') | '\t' | ws_tok;
 
         // test lexer for two different input strings
- lex::lexer<lexer_def> lex(def);
         BOOST_TEST(test (lex, "/* this is a comment */", CCOMMENT));
         BOOST_TEST(test (lex, "// this is a comment as well\n", CPPCOMMENT));
         BOOST_TEST(test (lex, "\n\n\v\f\r", ws_tok.id()));
@@ -51,20 +46,16 @@
         BOOST_TEST(test (lex, "abc"));
         BOOST_TEST(test (lex, "def"));
     }
-
- {
- // init a token set
- token_set ws;
- ws = token_def(' ') | '\t' | ws_tok;
 
+ {
         // initialize lexer
- lexer_def def;
- def.self = c_comment;
- def.self += cpp_comment | '1' | '2' | '3';
- def.self("WHITESPACE") = ws;
+ lexer_def lex;
+ token_def ws_tok ("[\\v\\f\\n\\r]*");
+ lex.self = c_comment;
+ lex.self += cpp_comment | '1' | '2' | '3';
+ lex.self("WHITESPACE") = token_def(' ') | '\t' | ws_tok;
 
         // test lexer for two different input strings
- lex::lexer<lexer_def> lex(def);
         BOOST_TEST(test (lex, "/* this is a comment */", CCOMMENT));
         BOOST_TEST(test (lex, "// this is a comment as well\n", CPPCOMMENT));
         BOOST_TEST(test (lex, "2", '2'));

Modified: branches/release/libs/spirit/test/lex/lexertl4.cpp
==============================================================================
--- branches/release/libs/spirit/test/lex/lexertl4.cpp (original)
+++ branches/release/libs/spirit/test/lex/lexertl4.cpp 2009-09-14 12:45:39 EDT (Mon, 14 Sep 2009)
@@ -4,12 +4,11 @@
 // file LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt)
 
 #include <boost/detail/lightweight_test.hpp>
-#include <boost/spirit/include/lex_lexer_lexertl.hpp>
+#include <boost/spirit/include/lex_lexertl.hpp>
 #include "test.hpp"
 
 ///////////////////////////////////////////////////////////////////////////////
-int
-main()
+int main()
 {
     using namespace boost::spirit;
     using namespace boost::spirit::lex;
@@ -17,39 +16,38 @@
 
     // initialize tokens
     typedef lex::token_def<std::string> token_def;
-
+
     std::size_t const CCOMMENT = 1;
     std::size_t const CPPCOMMENT = 2;
     std::size_t const TOKEN_ID_ABC = 1000;
     std::size_t const TOKEN_ID_STR = 1001;
     std::size_t const TOKEN_ID_WS = 1002;
-
+
     token_def c_comment ("\\/\\*[^*]*\\*+([^/*][^*]*\\*+)*\\/", CCOMMENT);
     token_def cpp_comment ("\\/\\/[^\\n\\r]*(\\n|\\r|\\r\\n)", CPPCOMMENT);
     token_def ws_tok ("[\\v\\f\\n\\r]*", TOKEN_ID_WS);
-
+
     typedef std::string::iterator base_iterator_type;
- typedef lex::lexertl_token<base_iterator_type> token_type;
- typedef lex::lexertl_lexer<token_type> lexer_type;
-
- typedef lexer_type::token_set token_set;
- typedef lex::lexer_def<lexer_type> lexer_def;
+ typedef lex::lexertl::token<base_iterator_type> token_type;
+ typedef lex::lexertl::lexer<token_type> lexer_type;
+
+ typedef lex::lexer<lexer_type> lexer_def;
 
     std::string str("def");
 
     {
         // initialize lexer
- lexer_def def;
- def.self.add
+ lexer_def lex;
+ token_def ws_tok ("[\\v\\f\\n\\r]*", TOKEN_ID_WS);
+ lex.self.add
             (c_comment)(cpp_comment)
             ('1')('2')('3')
             ("abc", TOKEN_ID_ABC)
             (str, TOKEN_ID_STR)
         ;
- def.self += token_def(' ') | '\t' | ws_tok;
+ lex.self += token_def(' ') | '\t' | ws_tok;
 
         // test lexer for different input strings
- lex::lexer<lexer_def> lex(def);
         BOOST_TEST(test (lex, "/* this is a comment */", CCOMMENT));
         BOOST_TEST(test (lex, "// this is a comment as well\n", CPPCOMMENT));
         BOOST_TEST(test (lex, "\n\n\v\f\r", ws_tok.id()));
@@ -58,28 +56,25 @@
         BOOST_TEST(test (lex, "abc", TOKEN_ID_ABC));
         BOOST_TEST(test (lex, "def", TOKEN_ID_STR));
     }
-
- {
- // init a token set
- token_set ws;
- ws.add
- (' ')('\t')
- (ws_tok)
- ;
 
+ {
         // initialize lexer
- lexer_def def;
- def.self.add
+ lexer_def lex;
+ token_def ws_tok ("[\\v\\f\\n\\r]*", TOKEN_ID_WS);
+
+ lex.self.add
             (c_comment)(cpp_comment)
             ('1')('2')('3')
             ("abc", TOKEN_ID_ABC)
             (str, TOKEN_ID_STR)
         ;
 
- def.self("WHITESPACE").add(ws);
+ lex.self("WHITESPACE").add
+ (' ')('\t')
+ (ws_tok)
+ ;
 
         // test lexer for different input strings
- lex::lexer<lexer_def> lex(def);
         BOOST_TEST(test (lex, "/* this is a comment */", CCOMMENT));
         BOOST_TEST(test (lex, "// this is a comment as well\n", CPPCOMMENT));
         BOOST_TEST(test (lex, "2", '2'));

Modified: branches/release/libs/spirit/test/lex/lexertl5.cpp
==============================================================================
--- branches/release/libs/spirit/test/lex/lexertl5.cpp (original)
+++ branches/release/libs/spirit/test/lex/lexertl5.cpp 2009-09-14 12:45:39 EDT (Mon, 14 Sep 2009)
@@ -4,13 +4,12 @@
 // file LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt)
 
 #include <boost/detail/lightweight_test.hpp>
-#include <boost/spirit/include/lex_lexer_lexertl.hpp>
+#include <boost/spirit/include/lex_lexertl.hpp>
 #include "test.hpp"
 
 ///////////////////////////////////////////////////////////////////////////////
 // test pattern definition capabilities
-int
-main()
+int main()
 {
     using namespace boost::spirit;
     using namespace boost::spirit::lex;
@@ -18,46 +17,44 @@
 
     // initialize tokens
     typedef lex::token_def<std::string> token_def;
-
+
     std::size_t const CCOMMENT = 1;
     std::size_t const CPPCOMMENT = 2;
     std::size_t const TOKEN_ID_ABC = 1000;
     std::size_t const TOKEN_ID_STR = 1001;
     std::size_t const TOKEN_ID_WS = 1002;
-
+
     typedef std::string::iterator base_iterator_type;
- typedef lex::lexertl_token<base_iterator_type> token_type;
- typedef lex::lexertl_lexer<token_type> lexer_type;
-
- typedef lexer_type::token_set token_set;
- typedef lex::lexer_def<lexer_type> lexer_def;
+ typedef lex::lexertl::token<base_iterator_type> token_type;
+ typedef lex::lexertl::lexer<token_type> lexer_type;
+
+ typedef lex::lexer<lexer_type> lexer_def;
 
     std::string str("def");
 
     {
         // initialize lexer
- lexer_def def;
-
- def.self.add_pattern
+ lexer_def lex;
+
+ lex.self.add_pattern
             ("CCOMMENT", "\\/\\*[^*]*\\*+([^/*][^*]*\\*+)*\\/")
             ("CPPCOMMENT", "\\/\\/[^\\n\\r]*(\\n|\\r|\\r\\n)")
             ("WS", "[\\v\\f\\n\\r]*")
         ;
-
+
         token_def c_comment ("{CCOMMENT}", CCOMMENT);
         token_def cpp_comment ("{CPPCOMMENT}", CPPCOMMENT);
         token_def ws_tok ("{WS}");
 
- def.self.add
+ lex.self.add
             (c_comment)(cpp_comment)
             ('1')('2')('3')
             ("abc", TOKEN_ID_ABC)
             (str, TOKEN_ID_STR)
         ;
- def.self += token_def(' ') | '\t' | ws_tok;
+ lex.self += token_def(' ') | '\t' | ws_tok;
 
         // test lexer for different input strings
- lex::lexer<lexer_def> lex(def);
         BOOST_TEST(test (lex, "/* this is a comment */", CCOMMENT));
         BOOST_TEST(test (lex, "// this is a comment as well\n", CPPCOMMENT));
         BOOST_TEST(test (lex, "\n\n\v\f\r", ws_tok.id()));
@@ -66,39 +63,35 @@
         BOOST_TEST(test (lex, "abc", TOKEN_ID_ABC));
         BOOST_TEST(test (lex, "def", TOKEN_ID_STR));
     }
-
+
     {
         // initialize lexer
- lexer_def def;
+ lexer_def lex;
 
- def.self.add_pattern
+ lex.self.add_pattern
             ("CCOMMENT", "\\/\\*[^*]*\\*+([^/*][^*]*\\*+)*\\/")
             ("CPPCOMMENT", "\\/\\/[^\\n\\r]*(\\n|\\r|\\r\\n)")
             ("WS", "[\\v\\f\\n\\r]*")
         ;
-
+
         token_def c_comment ("{CCOMMENT}", CCOMMENT);
         token_def cpp_comment ("{CPPCOMMENT}", CPPCOMMENT);
         token_def ws_tok ("{WS}");
 
- // init a token set
- token_set ws;
- ws.add
- (' ')('\t')
- (ws_tok, TOKEN_ID_WS)
- ;
-
- def.self.add
+ // init lexer
+ lex.self.add
             (c_comment)(cpp_comment)
             ('1')('2')('3')
             ("abc", TOKEN_ID_ABC)
             (str, TOKEN_ID_STR)
         ;
 
- def.self("WHITESPACE").add(ws);
+ lex.self("WHITESPACE").add
+ (' ')('\t')
+ (ws_tok, TOKEN_ID_WS)
+ ;
 
         // test lexer for different input strings
- lex::lexer<lexer_def> lex(def);
         BOOST_TEST(test (lex, "/* this is a comment */", CCOMMENT));
         BOOST_TEST(test (lex, "// this is a comment as well\n", CPPCOMMENT));
         BOOST_TEST(test (lex, "2", '2'));

Modified: branches/release/libs/spirit/test/lex/state_switcher_test.cpp
==============================================================================
--- branches/release/libs/spirit/test/lex/state_switcher_test.cpp (original)
+++ branches/release/libs/spirit/test/lex/state_switcher_test.cpp 2009-09-14 12:45:39 EDT (Mon, 14 Sep 2009)
@@ -4,38 +4,36 @@
 // file LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt)
 
 #include <boost/detail/lightweight_test.hpp>
-#include <boost/spirit/include/qi_operator.hpp>
-#include <boost/spirit/include/lex_lexer_lexertl.hpp>
+#include <boost/spirit/include/qi.hpp>
+#include <boost/spirit/include/lex_lexertl.hpp>
 #include "test_parser.hpp"
 
 ///////////////////////////////////////////////////////////////////////////////
 // Token definition
 ///////////////////////////////////////////////////////////////////////////////
 template <typename Lexer>
-struct switch_state_tokens : boost::spirit::lex::lexer_def<Lexer>
+struct switch_state_tokens : boost::spirit::lex::lexer<Lexer>
 {
- template <typename Self>
- void def (Self& self)
+ switch_state_tokens()
     {
         // define tokens and associate them with the lexer
         identifier = "[a-zA-Z_][a-zA-Z0-9_]*";
- self = identifier;
-
+ this->self = identifier;
+
         // any token definition to be used as the skip parser during parsing
         // has to be associated with a separate lexer state (here 'WS')
         white_space = "[ \\t\\n]+";
- self("WS") = white_space;
+ this->self("WS") = white_space;
 
         separators = "[,;]";
- self("SEP") = separators;
+ this->self("SEP") = separators;
     }
-
+
     boost::spirit::lex::token_def<> identifier, white_space, separators;
 };
 
 ///////////////////////////////////////////////////////////////////////////////
-int
-main()
+int main()
 {
     using namespace boost::spirit;
     using namespace boost::spirit::qi;
@@ -43,50 +41,51 @@
     using namespace spirit_test;
 
     typedef std::string::iterator base_iterator_type;
- typedef boost::spirit::lex::lexertl_token<base_iterator_type> token_type;
- typedef boost::spirit::lex::lexertl_lexer<token_type> lexer_type;
+ typedef boost::spirit::lex::lexertl::token<base_iterator_type> token_type;
+ typedef boost::spirit::lex::lexertl::lexer<token_type> lexer_type;
 
     {
         // the tokens class will be initialized inside the test_parser function
- switch_state_tokens<lexer_type> tokens;
-
- BOOST_TEST(test_parser("ident", tokens.identifier, tokens));
- BOOST_TEST(!test_parser("ident", set_state("WS") >> tokens.identifier, tokens));
- BOOST_TEST(!test_parser("ident", in_state("WS")[tokens.identifier], tokens));
-
- BOOST_TEST(test_parser("\t \n", set_state("WS") >> tokens.white_space, tokens));
- BOOST_TEST(test_parser("\t \n", in_state("WS")[tokens.white_space], tokens));
- BOOST_TEST(!test_parser("\t \n", tokens.white_space, tokens));
+ switch_state_tokens<lexer_type> lex;
+
+ BOOST_TEST(test_parser("ident", lex.identifier, lex));
+ BOOST_TEST(!test_parser("ident", set_state("WS") >> lex.identifier, lex));
+ BOOST_TEST(!test_parser("ident", in_state("WS")[lex.identifier], lex));
+
+ BOOST_TEST(test_parser("\t \n", set_state("WS") >> lex.white_space, lex));
+ BOOST_TEST(test_parser("\t \n", in_state("WS")[lex.white_space], lex));
+ BOOST_TEST(!test_parser("\t \n", lex.white_space, lex));
     }
-
+
     {
         // the tokens class will be initialized inside the test_parser function
- switch_state_tokens<lexer_type> tokens;
-
- BOOST_TEST(test_parser(",ident", tokens.identifier, tokens,
- in_state("SEP")[tokens.separators]));
- BOOST_TEST(!test_parser(";ident", set_state("WS") >> tokens.identifier,
- tokens, in_state("SEP")[tokens.separators]));
- BOOST_TEST(!test_parser(",ident", in_state("WS")[tokens.identifier],
- tokens, in_state("SEP")[tokens.separators]));
-
- BOOST_TEST(test_parser(",\t \n", set_state("WS") >> tokens.white_space,
- tokens, in_state("SEP")[tokens.separators]));
- BOOST_TEST(test_parser(";\t \n", in_state("WS")[tokens.white_space],
- tokens, in_state("SEP")[tokens.separators]));
- BOOST_TEST(!test_parser(",\t \n", tokens.white_space, tokens,
- in_state("SEP")[tokens.separators]));
+ switch_state_tokens<lexer_type> lex;
+
+ BOOST_TEST(test_parser(",ident", lex.identifier, lex,
+ in_state("SEP")[lex.separators]));
+ BOOST_TEST(!test_parser(";ident", set_state("WS") >> lex.identifier,
+ lex, in_state("SEP")[lex.separators]));
+ BOOST_TEST(!test_parser(",ident", in_state("WS")[lex.identifier],
+ lex, in_state("SEP")[lex.separators]));
+
+ BOOST_TEST(test_parser(",\t \n", set_state("WS") >> lex.white_space,
+ lex, in_state("SEP")[lex.separators]));
+ BOOST_TEST(test_parser(";\t \n", in_state("WS")[lex.white_space],
+ lex, in_state("SEP")[lex.separators]));
+ BOOST_TEST(!test_parser(",\t \n", lex.white_space, lex,
+ in_state("SEP")[lex.separators]));
     }
-
+
     {
         // the tokens class will be initialized inside the test_parser function
- switch_state_tokens<lexer_type> tokens;
+ switch_state_tokens<lexer_type> lex;
         
         BOOST_TEST(test_parser("ident\t \n",
- tokens.identifier >> set_state("WS") >> tokens.white_space, tokens));
+ lex.identifier >> set_state("WS") >> lex.white_space, lex));
         BOOST_TEST(test_parser("\t \nident",
- in_state("WS")[tokens.white_space] >> tokens.identifier, tokens));
+ in_state("WS")[lex.white_space] >> lex.identifier, lex));
     }
 
     return boost::report_errors();
 }
+

Modified: branches/release/libs/spirit/test/lex/test.hpp
==============================================================================
--- branches/release/libs/spirit/test/lex/test.hpp (original)
+++ branches/release/libs/spirit/test/lex/test.hpp 2009-09-14 12:45:39 EDT (Mon, 14 Sep 2009)
@@ -29,7 +29,7 @@
 
     ///////////////////////////////////////////////////////////////////////////
     display_type const display = {};
-
+
     ///////////////////////////////////////////////////////////////////////////
     template <typename Iterator>
     inline boost::iterator_range<Iterator> const&
@@ -37,14 +37,14 @@
     {
         return itp;
     }
-
+
     template <typename Iterator, BOOST_VARIANT_ENUM_PARAMS(typename T)>
     inline boost::iterator_range<Iterator> const&
     get_iterpair(boost::variant<BOOST_VARIANT_ENUM_PARAMS(T)> const& v)
     {
         return boost::get<boost::iterator_range<Iterator> >(v);
     }
-
+
     ///////////////////////////////////////////////////////////////////////////
     template <typename Lexer, typename Char>
     inline bool
@@ -53,31 +53,31 @@
     {
         typedef typename Lexer::iterator_type iterator_type;
         typedef std::basic_string<Char> string_type;
-
+
         string_type str(input);
         typename string_type::iterator it = str.begin();
-
+
         iterator_type first = lex.begin(it, str.end());
         iterator_type last = lex.end();
-
+
         bool r = true;
-
+
         if (NULL != state) {
             std::size_t stateid = lex.map_state(state);
             r = r && (static_cast<unsigned>(~0) != stateid);
             first.set_state(stateid);
         }
-
+
         r = r && lex;
         r = r && first != last;
-
+
         if (token_id != 0)
             r = r && (*first).id() == token_id;
         else
             r = r && (*first).id() != 0;
-
+
         using namespace boost;
-
+
         typedef typename Lexer::iterator_type::base_iterator_type iterator;
         typedef iterator_range<iterator> iterpair_type;
         iterpair_type const& ip = get_iterpair<iterator>((*first).value());

Modified: branches/release/libs/spirit/test/lex/test_parser.hpp
==============================================================================
--- branches/release/libs/spirit/test/lex/test_parser.hpp (original)
+++ branches/release/libs/spirit/test/lex/test_parser.hpp 2009-09-14 12:45:39 EDT (Mon, 14 Sep 2009)
@@ -12,12 +12,10 @@
 
 namespace spirit_test
 {
- template <typename Char, typename Parser, typename Tokens>
- bool test_parser(Char const* in, Parser const& p, Tokens& tokens,
+ template <typename Char, typename Parser, typename Lexer>
+ bool test_parser(Char const* in, Parser const& p, Lexer& lex,
         bool full_match = true)
     {
- boost::spirit::lex::lexer<Tokens> lex(tokens);
-
         // we don't care about the result of the "what" function.
         // we only care that all parsers have it:
         boost::spirit::qi::what(p);
@@ -26,23 +24,19 @@
         std::string::iterator it_in = str.begin();
         std::string::iterator end_in = str.end();
 
- typedef typename
- boost::spirit::lex::lexer<Tokens>::iterator_type
- iterator_type;
-
+ typedef typename Lexer::iterator_type iterator_type;
+
         iterator_type iter = lex.begin(it_in, end_in);
         iterator_type end = lex.end();
-
+
         return boost::spirit::qi::parse(iter, end, p)
             && (!full_match || (iter == end));
     }
 
- template <typename Char, typename Parser, typename Tokens, typename Skipper>
- bool test_parser(Char const* in, Parser const& p, Tokens& tokens,
+ template <typename Char, typename Parser, typename Lexer, typename Skipper>
+ bool test_parser(Char const* in, Parser const& p, Lexer& lex,
           Skipper const& s, bool full_match = true)
     {
- boost::spirit::lex::lexer<Tokens> lex(tokens);
-
         // we don't care about the result of the "what" function.
         // we only care that all parsers have it:
         boost::spirit::qi::what(p);
@@ -51,10 +45,8 @@
         std::string::iterator it_in = str.begin();
         std::string::iterator end_in = str.end();
 
- typedef typename
- boost::spirit::lex::lexer<Tokens>::iterator_type
- iterator_type;
-
+ typedef typename Lexer::iterator_type iterator_type;
+
         iterator_type iter = lex.begin(it_in, end_in);
         iterator_type end = lex.end();
 

Modified: branches/release/libs/spirit/test/qi/actions.cpp
==============================================================================
--- branches/release/libs/spirit/test/qi/actions.cpp (original)
+++ branches/release/libs/spirit/test/qi/actions.cpp 2009-09-14 12:45:39 EDT (Mon, 14 Sep 2009)
@@ -1,17 +1,25 @@
 /*=============================================================================
- Copyright (c) 2001-2008 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(_MSC_VER)
+# pragma warning(disable: 4180) // qualifier applied to function type
+ // has no meaning; ignored
+#endif
+
 #include <boost/detail/lightweight_test.hpp>
-#include <boost/spirit/include/qi.hpp>
+#include <boost/spirit/include/qi_operator.hpp>
+#include <boost/spirit/include/qi_numeric.hpp>
+#include <boost/spirit/include/qi_char.hpp>
+#include <boost/spirit/include/qi_parse.hpp>
+#include <boost/spirit/include/qi_action.hpp>
 #include <boost/lambda/lambda.hpp>
 #include <boost/bind.hpp>
 #include <cstring>
 
-using namespace boost::spirit;
-
 int x = 0;
 
 void fun1(int const& i)
@@ -23,6 +31,7 @@
 {
     x += i;
 }
+using boost::spirit::unused_type;
 
 struct fun_action
 {
@@ -34,6 +43,9 @@
 
 int main()
 {
+ namespace qi = boost::spirit::qi;
+ using boost::spirit::int_;
+
     {
         char const *s1 = "{42}", *e1 = s1 + std::strlen(s1);
         qi::parse(s1, e1, '{' >> int_[&fun1] >> '}');
@@ -45,12 +57,8 @@
     }
 
     {
- // $$$ uncomment me! $$$
- //~ char const *s1 = "{42}", *e1 = s1 + std::strlen(s1);
- //~ qi::parse(s1, e1, '{' >> int_[fun2] >> '}');
-
- //~ int ii;
- //~ boost::spirit::detail::action_dispatch(fun2, ii, ii);
+ char const *s1 = "{42}", *e1 = s1 + std::strlen(s1);
+ qi::parse(s1, e1, '{' >> int_[fun2] >> '}');
     }
 
     {

Modified: branches/release/libs/spirit/test/qi/alternative.cpp
==============================================================================
--- branches/release/libs/spirit/test/qi/alternative.cpp (original)
+++ branches/release/libs/spirit/test/qi/alternative.cpp 2009-09-14 12:45:39 EDT (Mon, 14 Sep 2009)
@@ -1,17 +1,20 @@
 /*=============================================================================
- Copyright (c) 2001-2007 Joel de Guzman
+ Copyright (c) 2001-2009 Joel de Guzman
     Copyright (c) 2001-2009 Hartmut Kaiser
 
     Distributed under the Boost Software License, Version 1.0. (See accompanying
     file LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt)
 =============================================================================*/
 #include <boost/detail/lightweight_test.hpp>
+#include <boost/mpl/print.hpp>
 #include <boost/spirit/include/qi_operator.hpp>
 #include <boost/spirit/include/qi_char.hpp>
 #include <boost/spirit/include/qi_string.hpp>
 #include <boost/spirit/include/qi_numeric.hpp>
-#include <boost/spirit/include/qi_action.hpp>
 #include <boost/spirit/include/qi_directive.hpp>
+#include <boost/spirit/include/qi_action.hpp>
+#include <boost/spirit/include/qi_nonterminal.hpp>
+#include <boost/spirit/include/qi_auxiliary.hpp>
 #include <boost/spirit/include/support_argument.hpp>
 #include <boost/spirit/include/phoenix_core.hpp>
 #include <boost/spirit/include/phoenix_operator.hpp>
@@ -19,20 +22,63 @@
 
 #include <string>
 #include <iostream>
+#include <vector>
 #include "test.hpp"
 
-using namespace spirit_test;
+struct test_action
+{
+ test_action(char last)
+ : last_(last) {}
+
+ void operator()(std::vector<char> const& v
+ , boost::spirit::unused_type
+ , boost::spirit::unused_type) const
+ {
+ BOOST_TEST(v.size() == 4 &&
+ v[0] == 'a' && v[1] == 'b' && v[2] == '1' && v[3] == last_);
+ }
+
+ char last_;
+};
+
+struct test_action_2
+{
+ typedef std::vector<boost::variant<boost::spirit::unused_type, char> >
+ result_type;
+
+ void operator()(result_type const& v
+ , boost::spirit::unused_type
+ , boost::spirit::unused_type) const
+ {
+ using boost::get;
+
+ BOOST_TEST(v.size() == 5 &&
+ v[0].which() == 0 &&
+ v[1].which() == 1 && get<char>(v[1]) == 'a' &&
+ v[2].which() == 1 && get<char>(v[2]) == 'b' &&
+ v[3].which() == 1 && get<char>(v[3]) == '1' &&
+ v[4].which() == 1 && get<char>(v[4]) == '2');
+ }
+};
 
 int
 main()
 {
- using namespace boost::spirit;
+ using spirit_test::test;
+ using spirit_test::test_attr;
+
+ using boost::spirit::ascii::char_;
+ using boost::spirit::qi::int_;
+ using boost::spirit::qi::lit;
+ using boost::spirit::qi::unused_type;
+ using boost::spirit::qi::_1;
+ using boost::spirit::qi::omit;
 
     {
         BOOST_TEST((test("a", char_ | char_)));
- BOOST_TEST((test("x", char_('x') | char_('i'))));
- BOOST_TEST((test("i", char_('x') | char_('i'))));
- BOOST_TEST((!test("z", char_('x') | char_('o'))));
+ BOOST_TEST((test("x", lit('x') | lit('i'))));
+ BOOST_TEST((test("i", lit('x') | lit('i'))));
+ BOOST_TEST((!test("z", lit('x') | lit('o'))));
         BOOST_TEST((test("rock", lit("rock") | lit("roll"))));
         BOOST_TEST((test("roll", lit("rock") | lit("roll"))));
         BOOST_TEST((test("rock", lit("rock") | int_)));
@@ -46,7 +92,6 @@
         BOOST_TEST(boost::get<int>(v) == 12345);
 
         BOOST_TEST((test_attr("rock", lit("rock") | int_ | char_, v)));
-// BOOST_TEST(boost::get<std::string>(&v) == 0);
         BOOST_TEST(boost::get<int>(&v) == 0);
         BOOST_TEST(boost::get<char>(&v) == 0);
 
@@ -55,25 +100,25 @@
     }
 
     { // test action
- using namespace boost::phoenix;
- using namespace boost::spirit::arg_names;
- namespace phx = boost::phoenix;
 
+ namespace phoenix = boost::phoenix;
         boost::variant<unused_type, int, char> v;
 
- BOOST_TEST((test("12345", (lit("rock") | int_ | char_)[phx::ref(v) = _1])));
+ BOOST_TEST((test("12345", (lit("rock") | int_ | char_)[phoenix::ref(v) = _1])));
         BOOST_TEST(boost::get<int>(v) == 12345);
     }
 
     {
- boost::variant<unused_type> v;
- BOOST_TEST((test("rock", lit("rock") | char_('x'))));
+ unused_type x;
+ BOOST_TEST((test_attr("rock", lit("rock") | lit('x'), x)));
     }
 
     {
         // test if alternatives with all components having unused
- // attributes return attributes them self
- using namespace boost::fusion;
+ // attributes have an unused attribute
+
+ using boost::fusion::vector;
+ using boost::fusion::at_c;
 
         vector<char, char> v;
         BOOST_TEST((test_attr("abc",
@@ -82,6 +127,70 @@
         BOOST_TEST((at_c<1>(v) == 'c'));
     }
 
+ {
+ // Test that we can still pass a "compatible" attribute to
+ // an alternate even if its "expected" attribute is unused type.
+
+ std::string s;
+ BOOST_TEST((test_attr("...", *(char_('.') | char_(',')), s)));
+ BOOST_TEST(s == "...");
+ }
+
+ { // make sure collapsing eps works as expected
+ // (compile check only)
+
+ using boost::spirit::qi::rule;
+ using boost::spirit::qi::_val;
+ using boost::spirit::qi::_1;
+ using boost::spirit::eps;
+ rule<const wchar_t*, wchar_t()> r1, r2, r3;
+
+ r3 = ((eps >> r1))[_val += _1];
+ r3 = ((r1 ) | r2)[_val += _1];
+
+ r3 %= ((eps >> r1) | r2);
+ r3 = ((eps >> r1) | r2)[_val += _1];
+ }
+
+ // make sure the attribute of an alternative gets properly collapsed
+ {
+ using boost::spirit::qi::lexeme;
+ using boost::spirit::ascii::alnum;
+ using boost::spirit::ascii::alpha;
+ using boost::spirit::ascii::digit;
+
+ BOOST_TEST( (test("ab1_", lexeme[*(alnum | char_('_'))][test_action('_')])) );
+ BOOST_TEST( (test("ab12", lexeme[*(alpha | digit)][test_action('2')])) );
+
+ BOOST_TEST( (test("abcab12", lexeme[*("abc" | alnum)][test_action_2()])) );
+ }
+
+ {
+ using boost::spirit::qi::eps;
+
+ // testing a sequence taking a container as attribute
+ std::string s;
+ BOOST_TEST( (test_attr("abc,a,b,c",
+ char_ >> char_ >> (char_ % ','), s )) );
+ BOOST_TEST(s == "abcabc");
+
+ // test having an optional<container> inside a sequence
+ s.erase();
+ BOOST_TEST( (test_attr("ab",
+ char_ >> char_ >> -(char_ % ','), s )) );
+ BOOST_TEST(s == "ab");
+
+ // test having a variant<container, ...> inside a sequence
+ s.erase();
+ BOOST_TEST( (test_attr("ab",
+ char_ >> char_ >> ((char_ % ',') | eps), s )) );
+ BOOST_TEST(s == "ab");
+ s.erase();
+ BOOST_TEST( (test_attr("abc",
+ char_ >> char_ >> ((char_ % ',') | eps), s )) );
+ BOOST_TEST(s == "abc");
+ }
+
     return boost::report_errors();
 }
 

Modified: branches/release/libs/spirit/test/qi/and_predicate.cpp
==============================================================================
--- branches/release/libs/spirit/test/qi/and_predicate.cpp (original)
+++ branches/release/libs/spirit/test/qi/and_predicate.cpp 2009-09-14 12:45:39 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)
@@ -16,7 +16,7 @@
 main()
 {
     using spirit_test::test;
- using namespace boost::spirit;
+ using boost::spirit::int_;
 
     {
         BOOST_TEST((test("1234", &int_, false)));

Modified: branches/release/libs/spirit/test/qi/binary.cpp
==============================================================================
--- branches/release/libs/spirit/test/qi/binary.cpp (original)
+++ branches/release/libs/spirit/test/qi/binary.cpp 2009-09-14 12:45:39 EDT (Mon, 14 Sep 2009)
@@ -1,27 +1,34 @@
-// 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)
+==============================================================================*/
 #include <boost/detail/lightweight_test.hpp>
 
 #include <boost/spirit/include/support_argument.hpp>
 #include <boost/spirit/include/qi_binary.hpp>
-#include <boost/spirit/include/qi_parse.hpp>
-
 #include <boost/cstdint.hpp>
-
 #include "test.hpp"
 
-using namespace spirit_test;
-
 ///////////////////////////////////////////////////////////////////////////////
-int
-main()
+int main()
 {
- using namespace boost::spirit;
- using namespace boost::phoenix;
- using namespace boost::spirit::arg_names;
+ using spirit_test::test_attr;
+ using spirit_test::test;
+
+ using boost::spirit::qi::byte_;
+ using boost::spirit::qi::word;
+ using boost::spirit::qi::dword;
+ using boost::spirit::qi::big_word;
+ using boost::spirit::qi::big_dword;
+ using boost::spirit::qi::little_word;
+ using boost::spirit::qi::little_dword;
+#ifdef BOOST_HAS_LONG_LONG
+ using boost::spirit::qi::qword;
+ using boost::spirit::qi::big_qword;
+ using boost::spirit::qi::little_qword;
+#endif
 
     boost::uint8_t uc;
     boost::uint16_t us;
@@ -32,7 +39,7 @@
 
     { // test native endian binaries
 #ifdef BOOST_LITTLE_ENDIAN
- BOOST_TEST(test_attr("\x01", byte, uc) && uc == 0x01);
+ BOOST_TEST(test_attr("\x01", byte_, uc) && uc == 0x01);
         BOOST_TEST(test_attr("\x01\x02", word, us) && us == 0x0201);
         BOOST_TEST(test_attr("\x01\x02\x03\x04", dword, ui) && ui == 0x04030201);
 #ifdef BOOST_HAS_LONG_LONG
@@ -40,7 +47,7 @@
             ul == 0x0807060504030201LL);
 #endif
 #else
- BOOST_TEST(test_attr("\x01", byte, uc) && uc == 0x01);
+ BOOST_TEST(test_attr("\x01", byte_, uc) && uc == 0x01);
         BOOST_TEST(test_attr("\x01\x02", word, us) && us == 0x0102);
         BOOST_TEST(test_attr("\x01\x02\x03\x04", dword, ui) && ui == 0x01020304);
 #ifdef BOOST_HAS_LONG_LONG
@@ -52,7 +59,7 @@
 
     { // test native endian binaries
 #ifdef BOOST_LITTLE_ENDIAN
- BOOST_TEST(test("\x01", byte(0x01)));
+ BOOST_TEST(test("\x01", byte_(0x01)));
         BOOST_TEST(test("\x01\x02", word(0x0201)));
         BOOST_TEST(test("\x01\x02\x03\x04", dword(0x04030201)));
 #ifdef BOOST_HAS_LONG_LONG
@@ -60,7 +67,7 @@
             qword(0x0807060504030201LL)));
 #endif
 #else
- BOOST_TEST(test("\x01", byte(0x01)));
+ BOOST_TEST(test("\x01", byte_(0x01)));
         BOOST_TEST(test("\x01\x02", word(0x0102)));
         BOOST_TEST(test("\x01\x02\x03\x04", dword(0x01020304)));
 #ifdef BOOST_HAS_LONG_LONG

Modified: branches/release/libs/spirit/test/qi/char.cpp
==============================================================================
--- branches/release/libs/spirit/test/qi/char.cpp (original)
+++ branches/release/libs/spirit/test/qi/char.cpp 2009-09-14 12:45:39 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
 
     Distributed under the Boost Software License, Version 1.0. (See accompanying
@@ -7,8 +7,7 @@
 =============================================================================*/
 #include <boost/detail/lightweight_test.hpp>
 #include <boost/spirit/include/qi_char.hpp>
-#include <boost/spirit/include/qi_string.hpp>
-#include <boost/spirit/include/support_argument.hpp>
+#include <boost/spirit/include/qi_action.hpp>
 #include <boost/spirit/include/phoenix_core.hpp>
 #include <boost/spirit/include/phoenix_operator.hpp>
 
@@ -19,20 +18,20 @@
 main()
 {
     using spirit_test::test;
- using namespace boost::spirit::qi;
- using namespace boost::spirit::ascii;
- using boost::spirit::char_;
- using boost::spirit::wchar;
-
+ using spirit_test::test_attr;
+ using spirit_test::print_info;
+
     {
+ using namespace boost::spirit::ascii;
+
         BOOST_TEST(test("x", 'x'));
         BOOST_TEST(test(L"x", L'x'));
+ BOOST_TEST(!test("y", 'x'));
+ BOOST_TEST(!test(L"y", L'x'));
 
         BOOST_TEST(test("x", char_));
         BOOST_TEST(test("x", char_('x')));
         BOOST_TEST(!test("x", char_('y')));
- BOOST_TEST(test(L"x", char_(L'x')));
- BOOST_TEST(!test(L"x", char_(L'y')));
         BOOST_TEST(test("x", char_('a', 'z')));
         BOOST_TEST(!test("x", char_('0', '9')));
 
@@ -54,66 +53,119 @@
     }
 
     {
+ using namespace boost::spirit::ascii;
+ using boost::spirit::qi::lit;
+
+ BOOST_TEST(test("x", lit('x')));
+ BOOST_TEST(!test("x", lit('y')));
+
+ BOOST_TEST(!test("x", ~lit('x')));
+ BOOST_TEST(test(" ", ~lit('x')));
+ BOOST_TEST(test("X", ~lit('x')));
+
+ BOOST_TEST(test("x", ~~lit('x')));
+ BOOST_TEST(!test(" ", ~~lit('x')));
+ BOOST_TEST(!test("X", ~~lit('x')));
+ }
+
+ {
+ using namespace boost::spirit::ascii;
+
         BOOST_TEST(test(" x", 'x', space));
         BOOST_TEST(test(L" x", L'x', space));
 
         BOOST_TEST(test(" x", char_, space));
         BOOST_TEST(test(" x", char_('x'), space));
         BOOST_TEST(!test(" x", char_('y'), space));
- BOOST_TEST(test(L" x", char_(L'x'), space));
- BOOST_TEST(!test(L" x", char_(L'y'), space));
         BOOST_TEST(test(" x", char_('a', 'z'), space));
         BOOST_TEST(!test(" x", char_('0', '9'), space));
-
     }
 
     {
- BOOST_TEST(test(L"x", wchar));
- BOOST_TEST(test(L"x", wchar(L'x')));
- BOOST_TEST(!test(L"x", wchar(L'y')));
- BOOST_TEST(test(L"x", wchar('a', 'z')));
- BOOST_TEST(!test(L"x", wchar('0', '9')));
-
- BOOST_TEST(!test(L"x", ~wchar));
- BOOST_TEST(!test(L"x", ~wchar('x')));
- BOOST_TEST(test(L" ", ~wchar('x')));
- BOOST_TEST(test(L"X", ~wchar('x')));
- BOOST_TEST(!test(L"x", ~wchar('b', 'y')));
- BOOST_TEST(test(L"a", ~wchar('b', 'y')));
- BOOST_TEST(test(L"z", ~wchar('b', 'y')));
-
- BOOST_TEST(test(L"x", ~~wchar));
- BOOST_TEST(test(L"x", ~~wchar('x')));
- BOOST_TEST(!test(L" ", ~~wchar('x')));
- BOOST_TEST(!test(L"X", ~~wchar('x')));
- BOOST_TEST(test(L"x", ~~wchar('b', 'y')));
- BOOST_TEST(!test(L"a", ~~wchar('b', 'y')));
- BOOST_TEST(!test(L"z", ~~wchar('b', 'y')));
+ using namespace boost::spirit::standard_wide;
+
+ BOOST_TEST(test(L"x", char_));
+ BOOST_TEST(test(L"x", char_(L'x')));
+ BOOST_TEST(!test(L"x", char_(L'y')));
+ BOOST_TEST(test(L"x", char_(L'a', L'z')));
+ BOOST_TEST(!test(L"x", char_(L'0', L'9')));
+
+ BOOST_TEST(!test(L"x", ~char_));
+ BOOST_TEST(!test(L"x", ~char_(L'x')));
+ BOOST_TEST(test(L" ", ~char_(L'x')));
+ BOOST_TEST(test(L"X", ~char_(L'x')));
+ BOOST_TEST(!test(L"x", ~char_(L'b', L'y')));
+ BOOST_TEST(test(L"a", ~char_(L'b', L'y')));
+ BOOST_TEST(test(L"z", ~char_(L'b', L'y')));
+
+ BOOST_TEST(test(L"x", ~~char_));
+ BOOST_TEST(test(L"x", ~~char_(L'x')));
+ BOOST_TEST(!test(L" ", ~~char_(L'x')));
+ BOOST_TEST(!test(L"X", ~~char_(L'x')));
+ BOOST_TEST(test(L"x", ~~char_(L'b', L'y')));
+ BOOST_TEST(!test(L"a", ~~char_(L'b', L'y')));
+ BOOST_TEST(!test(L"z", ~~char_(L'b', L'y')));
     }
 
 
- { // single char strings as argument to char_
- BOOST_TEST(test("x", char_("x"), space));
- BOOST_TEST(test("x", wchar(L"x"), space));
+ { // single char strings!
+ namespace ascii = boost::spirit::ascii;
+ namespace wide = boost::spirit::standard_wide;
+
+ BOOST_TEST(test("x", "x"));
+ BOOST_TEST(test(L"x", L"x"));
+ BOOST_TEST(test("x", ascii::char_("x")));
+ BOOST_TEST(test(L"x", wide::char_(L"x")));
     }
 
     {
         // chsets
- BOOST_TEST(test("x", char_("a-z")));
- BOOST_TEST(!test("1", char_("a-z")));
- BOOST_TEST(test("1", char_("a-z0-9")));
-
- BOOST_TEST(test("x", char_(L"a-z")));
- BOOST_TEST(!test("1", char_(L"a-z")));
- BOOST_TEST(test("1", char_(L"a-z0-9")));
+ namespace ascii = boost::spirit::ascii;
+ namespace wide = boost::spirit::standard_wide;
+
+ BOOST_TEST(test("x", ascii::char_("a-z")));
+ BOOST_TEST(!test("1", ascii::char_("a-z")));
+ BOOST_TEST(test("1", ascii::char_("a-z0-9")));
+
+ BOOST_TEST(test("x", wide::char_(L"a-z")));
+ BOOST_TEST(!test("1", wide::char_(L"a-z")));
+ BOOST_TEST(test("1", wide::char_(L"a-z0-9")));
+
+ std::string set = "a-z0-9";
+ BOOST_TEST(test("x", ascii::char_(set)));
+
+#ifdef SPIRIT_NO_COMPILE_CHECK
+ test("", ascii::char_(L"a-z0-9"));
+#endif
     }
 
     { // lazy chars
 
- using namespace boost::phoenix;
+ using namespace boost::spirit::ascii;
+
+ using boost::phoenix::val;
+ using boost::phoenix::ref;
+ using boost::spirit::_1;
+
         BOOST_TEST((test("x", char_(val('x')))));
         BOOST_TEST((test("h", char_(val('a'), val('n')))));
+ BOOST_TEST(test("0", char_(val("a-z0-9"))));
+
+ char ch; // make sure lazy chars have an attribute
+ BOOST_TEST(test("x", char_(val('x'))[ref(ch) = _1]));
+ BOOST_TEST(ch == 'x');
+ }
+
+ { // testing "what"
+
+ using boost::spirit::qi::what;
+ using boost::spirit::ascii::char_;
+ using boost::spirit::ascii::alpha;
+
+ print_info(what('x'));
+ print_info(what(char_('a','z')));
+ print_info(what(alpha));
     }
-
+
     return boost::report_errors();
 }

Modified: branches/release/libs/spirit/test/qi/char_class.cpp
==============================================================================
--- branches/release/libs/spirit/test/qi/char_class.cpp (original)
+++ branches/release/libs/spirit/test/qi/char_class.cpp 2009-09-14 12:45:39 EDT (Mon, 14 Sep 2009)
@@ -1,6 +1,6 @@
 /*=============================================================================
- Copyright (c) 2001-2007 Joel de Guzman
- Copyright (c) 2001-2007 Hartmut Kaiser
+ 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)
@@ -8,14 +8,13 @@
 #include <boost/detail/lightweight_test.hpp>
 #include <boost/spirit/include/qi_char.hpp>
 #include <boost/spirit/include/qi_action.hpp>
-#include <boost/spirit/include/qi_domain.hpp>
-#include <boost/spirit/include/support_attribute_of.hpp>
 #include <boost/spirit/include/support_argument.hpp>
+#include <boost/spirit/include/support_attributes.hpp>
 #include <boost/spirit/include/phoenix_core.hpp>
 #include <boost/spirit/include/phoenix_operator.hpp>
-
 #include <boost/type_traits/is_same.hpp>
 #include <boost/static_assert.hpp>
+
 #include <iostream>
 #include "test.hpp"
 
@@ -52,7 +51,34 @@
     }
 
     {
- using namespace boost::spirit::iso8859_1;
+ using namespace boost::spirit::ascii;
+ BOOST_TEST(!test("1", ~alnum));
+ BOOST_TEST(test(" ", ~alnum));
+ BOOST_TEST(test("1", ~alpha));
+ BOOST_TEST(!test("x", ~alpha));
+ BOOST_TEST(!test(" ", ~blank));
+ BOOST_TEST(test("x", ~blank));
+ BOOST_TEST(!test("1", ~digit));
+ BOOST_TEST(test("x", ~digit));
+ BOOST_TEST(!test("a", ~lower));
+ BOOST_TEST(test("A", ~lower));
+ BOOST_TEST(!test("!", ~punct));
+ BOOST_TEST(test("x", ~punct));
+ BOOST_TEST(!test(" ", ~space));
+ BOOST_TEST(!test("\n", ~space));
+ BOOST_TEST(!test("\r", ~space));
+ BOOST_TEST(!test("\t", ~space));
+ BOOST_TEST(!test("A", ~upper));
+ BOOST_TEST(test("a", ~upper));
+ BOOST_TEST(!test("A", ~xdigit));
+ BOOST_TEST(!test("0", ~xdigit));
+ BOOST_TEST(!test("f", ~xdigit));
+ BOOST_TEST(test("g", ~xdigit));
+ }
+
+ {
+ // we use the hoisted qi namespace this time
+ using namespace boost::spirit::qi::iso8859_1;
         BOOST_TEST(test("1", alnum));
         BOOST_TEST(!test(" ", alnum));
         BOOST_TEST(!test("1", alpha));
@@ -138,10 +164,11 @@
         using boost::spirit::traits::attribute_of;
         using boost::spirit::iso8859_1::alpha;
         using boost::spirit::iso8859_1::alpha_type;
+ using boost::spirit::result_of::compile;
 
         BOOST_STATIC_ASSERT((
             boost::is_same<
- attribute_of<domain, alpha_type, char const*, int>::type
+ attribute_of<compile<domain, alpha_type>::type>::type
               , unsigned char>::value));
 
         int attr = 0;
@@ -159,9 +186,9 @@
 
     { // test action
 
- using namespace boost::phoenix;
         using namespace boost::spirit::ascii;
- using boost::spirit::arg_names::_1;
+ using boost::phoenix::ref;
+ using boost::spirit::_1;
         char ch;
 
         BOOST_TEST(test("x", alnum[ref(ch) = _1]));

Deleted: branches/release/libs/spirit/test/qi/confix.cpp
==============================================================================
--- branches/release/libs/spirit/test/qi/confix.cpp 2009-09-14 12:45:39 EDT (Mon, 14 Sep 2009)
+++ (empty file)
@@ -1,71 +0,0 @@
-/*=============================================================================
- Copyright (c) 2001-2007 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)
-=============================================================================*/
-#include <boost/detail/lightweight_test.hpp>
-#include <boost/spirit/include/qi_string.hpp>
-#include <boost/spirit/include/qi_auxiliary.hpp>
-#include <boost/spirit/include/qi_numeric.hpp>
-#include <boost/spirit/include/qi_char.hpp>
-#include <boost/spirit/include/qi_parse.hpp>
-#include <boost/spirit/include/support_argument.hpp>
-
-#include <iostream>
-#include "test.hpp"
-
-namespace html
-{
- ///////////////////////////////////////////////////////////////////////////////
- // define a HTML tag helper generator
- template <typename Char, typename Traits, typename Allocator>
- inline boost::spirit::confix_spec<std::basic_string<Char, Traits, Allocator> >
- tag (std::basic_string<Char, Traits, Allocator> const& tagname)
- {
- typedef std::basic_string<Char, Traits, Allocator> string_type;
- return boost::spirit::confix_spec<string_type>(
- string_type("<") + tagname + ">", string_type("</") + tagname + ">");
- }
-
- inline boost::spirit::confix_spec<std::string>
- tag (char const* tagname)
- {
- return tag(std::string(tagname));
- }
-
- typedef boost::spirit::confix_spec<std::string> html_tag_type;
-
- html_tag_type const ol = tag("ol");
-}
-
-int
-main()
-{
- using spirit_test::test;
- using namespace boost::spirit;
- using namespace boost::spirit::ascii;
-
- {
- BOOST_TEST(test("<tag>10</tag>", confix("<tag>", "</tag>")[int_]));
- BOOST_TEST(test(L"<tag>10</tag>", confix(L"<tag>", L"</tag>")[int_]));
- BOOST_TEST(test("//10\n", confix(lit("//"), eol)[int_]));
- BOOST_TEST(test(L"//10\n", confix(wlit("//"), eol)[int_]));
- BOOST_TEST(test("<ol>10</ol>", html::ol[int_]));
- BOOST_TEST(test(L"<ol>10</ol>", html::ol[int_]));
- }
-
- {
- BOOST_TEST(test(" <tag> 10 </tag>", confix("<tag>", "</tag>")[int_],
- ascii::space));
- BOOST_TEST(test(L" <tag> 10 </tag>", confix(L"<tag>", L"</tag>")[int_],
- ascii::space));
- BOOST_TEST(test("// 10 \n", confix(lit("//"), eol)[int_], ascii::space));
- BOOST_TEST(test(L"// 10 \n", confix(wlit("//"), eol)[int_], ascii::space));
- BOOST_TEST(test(" <ol> 10 </ol>", html::ol[int_], ascii::space));
- BOOST_TEST(test(L" <ol> 10 </ol>", html::ol[int_], ascii::space));
- }
-
- return boost::report_errors();
-}

Modified: branches/release/libs/spirit/test/qi/debug.cpp
==============================================================================
--- branches/release/libs/spirit/test/qi/debug.cpp (original)
+++ branches/release/libs/spirit/test/qi/debug.cpp 2009-09-14 12:45:39 EDT (Mon, 14 Sep 2009)
@@ -1,10 +1,9 @@
 /*=============================================================================
- 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)
 =============================================================================*/
-
 #define BOOST_SPIRIT_DEBUG
 
 #include <boost/detail/lightweight_test.hpp>
@@ -12,27 +11,40 @@
 #include <boost/spirit/include/qi_char.hpp>
 #include <boost/spirit/include/qi_string.hpp>
 #include <boost/spirit/include/qi_numeric.hpp>
+#include <boost/spirit/include/qi_auxiliary.hpp>
 #include <boost/spirit/include/qi_nonterminal.hpp>
 #include <boost/spirit/include/qi_action.hpp>
-#include <boost/spirit/include/qi_debug.hpp>
 #include <boost/spirit/include/phoenix_core.hpp>
 #include <boost/spirit/include/phoenix_operator.hpp>
 #include <boost/spirit/include/phoenix_object.hpp>
+#include <boost/spirit/include/phoenix_bind.hpp>
+#include <boost/fusion/include/std_pair.hpp>
 
 #include <string>
+#include <cstring>
 #include <iostream>
 #include "test.hpp"
 
-using namespace spirit_test;
-
 int
 main()
 {
- using namespace boost::spirit;
- using namespace boost::spirit::qi;
+ using spirit_test::test_attr;
+ using spirit_test::test;
+
     using namespace boost::spirit::ascii;
+ using namespace boost::spirit::qi::labels;
+ using boost::spirit::qi::locals;
+ using boost::spirit::qi::rule;
+ using boost::spirit::qi::int_;
+ using boost::spirit::qi::fail;
+ using boost::spirit::qi::on_error;
+ using boost::spirit::qi::debug;
+
+ namespace phx = boost::phoenix;
+
 
     { // basic tests
+
         rule<char const*> a, b, c, start;
 
         a = 'a';
@@ -50,6 +62,9 @@
         BOOST_SPIRIT_DEBUG_NODE(start);
         BOOST_TEST(test("aaaabababaaabbb", start));
         BOOST_TEST(test("aaaabababaaabba", start, false));
+
+ // ignore the skipper!
+ BOOST_TEST(test("aaaabababaaabba", start, space, false));
     }
 
     { // basic tests w/ skipper
@@ -64,11 +79,8 @@
         BOOST_SPIRIT_DEBUG_NODE(c);
 
         start = *(a | b | c);
- BOOST_TEST(test(" a b c a b c a c b", start, space));
-
- // allow no skipping too:
         BOOST_SPIRIT_DEBUG_NODE(start);
- BOOST_TEST(test("abcabcacb", start));
+ BOOST_TEST(test(" a b c a b c a c b ", start, space));
 
         start = (a | b) >> (start | b);
         BOOST_SPIRIT_DEBUG_NODE(start);
@@ -76,156 +88,23 @@
         BOOST_TEST(test(" a a a a b a b a b a a a b b a ", start, space, false));
     }
 
-// { // alias tests
-//
-// rule<char const*> a, b, c, d, start;
-//
-// a = 'a';
-// b = 'b';
-// c = 'c';
-// d = start.alias(); // d will always track start
-//
-// start = *(a | b | c);
-// BOOST_TEST(test("abcabcacb", d));
-//
-// start = (a | b) >> (start | b);
-// BOOST_TEST(test("aaaabababaaabbb", d));
-// }
-//
-// { // copy tests
-//
-// rule<char const*> a, b, c, start;
-//
-// a = 'a';
-// b = 'b';
-// c = 'c';
-//
-// // The FF is the dynamic equivalent of start = *(a | b | c);
-// start = a;
-// start = start.copy() | b;
-// start = start.copy() | c;
-// start = *(start.copy());
-//
-// BOOST_TEST(test("abcabcacb", start));
-//
-// // The FF is the dynamic equivalent of start = (a | b) >> (start | b);
-// start = b;
-// start = a | start.copy();
-// start = start.copy() >> (start | b);
-//
-// BOOST_TEST(test("aaaabababaaabbb", start));
-// BOOST_TEST(test("aaaabababaaabba", start, false));
-// }
-//
-// { // context tests
-//
-// using namespace boost::phoenix;
-// using namespace boost::spirit::ascii;
-// using boost::spirit::arg_names::_1;
-// using boost::spirit::arg_names::_val;
-//
-// char ch;
-// rule<char const*, char()> a;
-// a = alpha[_val = _1];
-//
-// BOOST_TEST(test("x", a[ref(ch) = _1]));
-// BOOST_TEST(ch == 'x');
-//
-// BOOST_TEST(test_attr("z", a, ch)); // attribute is given.
-// BOOST_TEST(ch == 'z');
-// }
-//
-// { // context (w/arg) tests
-//
-// using namespace boost::phoenix;
-// using namespace boost::spirit::ascii;
-// using boost::spirit::arg_names::_1;
-// using boost::spirit::arg_names::_r1;
-// using boost::spirit::arg_names::_r2;
-// using boost::spirit::arg_names::_val;
-//
-// char ch;
-// rule<char const*, char(int)> a; // 1 arg
-// a = alpha[_val = _1 + _r1];
-//
-// BOOST_TEST(test("x", a(val(1))[ref(ch) = _1]));
-// BOOST_TEST(ch == 'x' + 1);
-//
-// BOOST_TEST(test_attr("a", a(1), ch)); // allow scalars as rule args too.
-// BOOST_TEST(ch == 'a' + 1);
-//
-// rule<char const*, char(int, int)> b; // 2 args
-// b = alpha[_val = _1 + _r1 + _r2];
-// BOOST_TEST(test_attr("a", b(1, 2), ch));
-// BOOST_TEST(ch == 'a' + 1 + 2);
-// }
-//
-// { // context (w/locals) tests
-// using namespace boost::phoenix;
-// using namespace boost::spirit::ascii;
-// using boost::spirit::arg_names::_1;
-// using boost::spirit::arg_names::_a;
-// using boost::spirit::char_;
-// using boost::spirit::locals;
-//
-// rule<char const*, locals<char> > a; // 1 local
-// a = alpha[_a = _1] >> char_(_a);
-// BOOST_TEST(test("aa", a));
-// BOOST_TEST(!test("ax", a));
-// }
-//
-// { // context (w/args and locals) tests
-// using namespace boost::phoenix;
-// using namespace boost::spirit::ascii;
-// using boost::spirit::arg_names::_1;
-// using boost::spirit::arg_names::_r1;
-// using boost::spirit::arg_names::_a;
-// using boost::spirit::char_;
-// using boost::spirit::locals;
-//
-// rule<char const*, void(int), locals<char> > a; // 1 arg + 1 local
-// a = alpha[_a = _1 + _r1] >> char_(_a);
-// BOOST_TEST(test("ab", a(val(1))));
-// BOOST_TEST(test("xy", a(val(1))));
-// BOOST_TEST(!test("ax", a(val(1))));
-// }
-//
-// { // bug: test that injected attributes are ok
-// using namespace boost::phoenix;
-// using namespace boost::spirit::ascii;
-// using boost::spirit::arg_names::_1;
-// using boost::spirit::arg_names::_r1;
-// using boost::spirit::arg_names::_val;
-// using boost::spirit::char_;
-//
-// rule<char const*, char(int) > r;
-//
-// // problem code:
-// r = char_(_r1)[_val = _1];
-// }
-
     { // error handling
 
- using namespace boost::phoenix;
         using namespace boost::spirit::ascii;
- using boost::phoenix::val;
- using boost::spirit::int_;
- using boost::spirit::arg_names::_4; // what
- using boost::spirit::arg_names::_3; // error pos
- using boost::spirit::arg_names::_2; // end
- using boost::spirit::qi::fail;
+ using boost::phoenix::construct;
+ using boost::phoenix::bind;
 
         rule<char const*> r;
- r = char_('(') > int_ > ',' > int_ > ')';
+ r = '(' > int_ > ',' > int_ > ')';
 
         on_error<fail>
         (
             r, std::cout
- << val("Error! Expecting: ")
+ << phx::val("Error! Expecting: ")
                 << _4
- << val(" Here: \"")
+ << phx::val(", got: \"")
                 << construct<std::string>(_3, _2)
- << val("\"")
+ << phx::val("\"")
                 << std::endl
         );
 

Modified: branches/release/libs/spirit/test/qi/difference.cpp
==============================================================================
--- branches/release/libs/spirit/test/qi/difference.cpp (original)
+++ branches/release/libs/spirit/test/qi/difference.cpp 2009-09-14 12:45:39 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)
@@ -19,13 +19,12 @@
 #include <iostream>
 #include "test.hpp"
 
-using namespace spirit_test;
-
 int
 main()
 {
- using namespace boost::spirit;
     using namespace boost::spirit::ascii;
+ using boost::spirit::lit;
+ using spirit_test::test;
 
     {
         BOOST_TEST(test("b", char_ - 'a'));
@@ -47,16 +46,16 @@
     {
         // $$$ See difference.hpp why these tests are not done anymore. $$$
 
- //~ BOOST_TEST(test("switcher", lit("switcher") - "switch"));
- //~ BOOST_TEST(test(" switcher ", lit("switcher") - "switch", space));
+ // BOOST_TEST(test("switcher", lit("switcher") - "switch"));
+ // BOOST_TEST(test(" switcher ", lit("switcher") - "switch", space));
 
         BOOST_TEST(!test("switch", lit("switch") - "switch"));
     }
 
     {
- using boost::spirit::arg_names::_1;
+ using boost::spirit::_1;
         namespace phx = boost::phoenix;
-
+
         std::string s;
 
         BOOST_TEST(test(
@@ -67,7 +66,7 @@
         s.clear();
 
         BOOST_TEST(test(
- " /*abcdefghijk*/ "
+ " /*abcdefghijk*/"
           , "/*" >> *(char_ - "*/")[phx::ref(s) += _1] >> "*/"
           , space
         ));

Modified: branches/release/libs/spirit/test/qi/end.cpp
==============================================================================
--- branches/release/libs/spirit/test/qi/end.cpp (original)
+++ branches/release/libs/spirit/test/qi/end.cpp 2009-09-14 12:45:39 EDT (Mon, 14 Sep 2009)
@@ -1,6 +1,6 @@
 /*=============================================================================
- Copyright (c) 2001-2007 Joel de Guzman
- Copyright (c) 2001-2008 Hartmut Kaiser
+ 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)
@@ -8,6 +8,7 @@
 #include <boost/detail/lightweight_test.hpp>
 #include <boost/spirit/include/qi_char.hpp>
 #include <boost/spirit/include/qi_auxiliary.hpp>
+#include <boost/spirit/include/qi_operator.hpp>
 #include <boost/spirit/include/support_argument.hpp>
 #include <boost/spirit/include/phoenix_core.hpp>
 #include <boost/spirit/include/phoenix_operator.hpp>
@@ -19,60 +20,52 @@
 main()
 {
     using spirit_test::test;
- using namespace boost::spirit::qi;
- using namespace boost::spirit::ascii;
- using boost::spirit::char_;
- using boost::spirit::wchar;
- using boost::spirit::eol;
- using boost::spirit::eoi;
-
+ namespace qi = boost::spirit::qi;
+ namespace ascii = boost::spirit::ascii;
+ namespace wide = boost::spirit::standard_wide;
+
+ using qi::eol;
+ using qi::eoi;
+ using ascii::space;
+
     { // eol
         BOOST_TEST(test("\r", eol));
         BOOST_TEST(test("\r\n", eol));
         BOOST_TEST(test("\n", eol));
         BOOST_TEST(!test("\b", eol));
 
- BOOST_TEST(!test("\r", ~eol, false));
- BOOST_TEST(!test("\r\n", ~eol, false));
- BOOST_TEST(!test("\n", ~eol, false));
- BOOST_TEST(test("\b", ~eol, false));
-
- BOOST_TEST(test("\r", ~~eol));
- BOOST_TEST(test("\r\n", ~~eol));
- BOOST_TEST(test("\n", ~~eol));
- BOOST_TEST(!test("\b", ~~eol));
-
- BOOST_TEST(test(" \r", eol, char_(' ')));
- BOOST_TEST(test(" \r\n", eol, char_(' ')));
- BOOST_TEST(test(" \n", eol, char_(' ')));
- BOOST_TEST(!test(" \b", eol, char_(' ')));
+ BOOST_TEST(!test("\r", !eol, false));
+ BOOST_TEST(!test("\r\n", !eol, false));
+ BOOST_TEST(!test("\n", !eol, false));
+ BOOST_TEST(test("\b", !eol, false));
+
+ BOOST_TEST(test(" \r", eol, ascii::char_(' ')));
+ BOOST_TEST(test(" \r\n", eol, ascii::char_(' ')));
+ BOOST_TEST(test(" \n", eol, ascii::char_(' ')));
+ BOOST_TEST(!test(" \b", eol, ascii::char_(' ')));
 
         BOOST_TEST(test(L"\r", eol));
         BOOST_TEST(test(L"\r\n", eol));
         BOOST_TEST(test(L"\n", eol));
         BOOST_TEST(!test(L"\b", eol));
 
- BOOST_TEST(test(L" \r", eol, wchar(L' ')));
- BOOST_TEST(test(L" \r\n", eol, wchar(L' ')));
- BOOST_TEST(test(L" \n", eol, wchar(L' ')));
- BOOST_TEST(!test(L" \b", eol, wchar(L' ')));
+ BOOST_TEST(test(L" \r", eol, wide::char_(L' ')));
+ BOOST_TEST(test(L" \r\n", eol, wide::char_(L' ')));
+ BOOST_TEST(test(L" \n", eol, wide::char_(L' ')));
+ BOOST_TEST(!test(L" \b", eol, wide::char_(L' ')));
     }
-
+
     { // eoi
         BOOST_TEST(test("", eoi));
         BOOST_TEST(!test("a", eoi));
- BOOST_TEST(test("a", ~eoi, false));
- BOOST_TEST(!test("", ~eoi));
- BOOST_TEST(test("", ~~eoi));
- BOOST_TEST(!test("a", ~~eoi));
+ BOOST_TEST(test("a", !eoi, false));
+ BOOST_TEST(!test("", !eoi));
 
         BOOST_TEST(test(" ", eoi, space));
         BOOST_TEST(!test(" a", eoi, space));
- BOOST_TEST(test(" a", ~eoi, space, false));
- BOOST_TEST(!test(" ", ~eoi, space));
- BOOST_TEST(test(" ", ~~eoi, space));
- BOOST_TEST(!test(" a", ~~eoi, space));
+ BOOST_TEST(test(" a", !eoi, space, false));
+ BOOST_TEST(!test(" ", !eoi, space));
     }
-
+
     return boost::report_errors();
 }

Modified: branches/release/libs/spirit/test/qi/eps.cpp
==============================================================================
--- branches/release/libs/spirit/test/qi/eps.cpp (original)
+++ branches/release/libs/spirit/test/qi/eps.cpp 2009-09-14 12:45:39 EDT (Mon, 14 Sep 2009)
@@ -1,11 +1,12 @@
 /*=============================================================================
- 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)
 =============================================================================*/
 #include <boost/detail/lightweight_test.hpp>
 #include <boost/spirit/include/qi_auxiliary.hpp>
+#include <boost/spirit/include/qi_operator.hpp>
 #include <boost/spirit/include/phoenix_core.hpp>
 
 #include <iostream>
@@ -15,18 +16,28 @@
 main()
 {
     using spirit_test::test;
- using namespace boost::spirit;
+ using boost::spirit::eps;
 
     {
         BOOST_TEST((test("", eps)));
         BOOST_TEST((test("xxx", eps, false)));
+ BOOST_TEST((!test("", !eps))); // not predicate
     }
 
- { // test action
+ { // test non-lazy semantic predicate
+
+ BOOST_TEST((test("", eps(true))));
+ BOOST_TEST((!test("", eps(false))));
+ BOOST_TEST((test("", !eps(false)))); // not predicate
+ }
+
+ { // test lazy semantic predicate
+
+ using boost::phoenix::val;
 
- using namespace boost::phoenix;
         BOOST_TEST((test("", eps(val(true)))));
         BOOST_TEST((!test("", eps(val(false)))));
+ BOOST_TEST((test("", !eps(val(false))))); // not predicate
     }
 
     return boost::report_errors();

Modified: branches/release/libs/spirit/test/qi/expect.cpp
==============================================================================
--- branches/release/libs/spirit/test/qi/expect.cpp (original)
+++ branches/release/libs/spirit/test/qi/expect.cpp 2009-09-14 12:45:39 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)
@@ -11,6 +11,8 @@
 #include <boost/spirit/include/qi_numeric.hpp>
 #include <boost/spirit/include/qi_directive.hpp>
 #include <boost/spirit/include/qi_action.hpp>
+#include <boost/spirit/include/qi_nonterminal.hpp>
+#include <boost/spirit/include/qi_auxiliary.hpp>
 #include <boost/spirit/include/support_argument.hpp>
 #include <boost/fusion/include/vector.hpp>
 #include <boost/fusion/include/at.hpp>
@@ -28,6 +30,7 @@
     using namespace boost::spirit;
     using namespace boost::spirit::ascii;
     using spirit_test::test;
+ using spirit_test::print_info;
     using boost::spirit::qi::expectation_failure;
 
     {
@@ -42,10 +45,10 @@
         }
         catch (expectation_failure<char const*> const& x)
         {
- std::cout << "expected: " << x.what << std::endl;
+ std::cout << "expected: "; print_info(x.what);
             std::cout << "got: \"" << x.first << '"' << std::endl;
 
- BOOST_TEST(x.what == "'o'");
+ BOOST_TEST(boost::get<std::string>(x.what.value) == "o");
             BOOST_TEST(std::string(x.first, x.last) == "i");
         }
     }
@@ -53,17 +56,17 @@
     {
         try
         {
- BOOST_TEST((test(" a a ", char_ > char_, space)));
- BOOST_TEST((test(" x i ", char_('x') > char_('i'), space)));
- BOOST_TEST((!test(" x i ", char_('x') > char_('o'), space)));
+ BOOST_TEST((test(" a a", char_ > char_, space)));
+ BOOST_TEST((test(" x i", char_('x') > char_('i'), space)));
+ BOOST_TEST((!test(" x i", char_('x') > char_('o'), space)));
         }
         catch (expectation_failure<char const*> const& x)
         {
- std::cout << "expected: " << x.what << std::endl;
+ std::cout << "expected: "; print_info(x.what);
             std::cout << "got: \"" << x.first << '"' << std::endl;
 
- BOOST_TEST(x.what == "'o'");
- BOOST_TEST(std::string(x.first, x.last) == "i ");
+ BOOST_TEST(boost::get<std::string>(x.what.value) == "o");
+ BOOST_TEST(std::string(x.first, x.last) == "i");
         }
     }
 
@@ -76,14 +79,22 @@
         }
         catch (expectation_failure<char const*> const& x)
         {
- std::cout << "expected: " << x.what << std::endl;
+ std::cout << "expected: "; print_info(x.what);
             std::cout << "got: \"" << x.first << '"' << std::endl;
 
- BOOST_TEST(x.what == "case-insensitive \"nend\"");
+ BOOST_TEST(x.what.tag == "no-case-literal-string");
+ BOOST_TEST(boost::get<std::string>(x.what.value) == "nend");
             BOOST_TEST(std::string(x.first, x.last) == "END");
         }
     }
 
+ {
+ using boost::spirit::qi::rule;
+ using boost::spirit::eps;
+ rule<const wchar_t*, void(int)> r;
+ r = eps > eps(_r1);
+ }
+
     return boost::report_errors();
 }
 

Deleted: branches/release/libs/spirit/test/qi/functor.cpp
==============================================================================
--- branches/release/libs/spirit/test/qi/functor.cpp 2009-09-14 12:45:39 EDT (Mon, 14 Sep 2009)
+++ (empty file)
@@ -1,68 +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)
-=============================================================================*/
-#include <boost/detail/lightweight_test.hpp>
-#include <boost/spirit/include/qi_char.hpp>
-#include <boost/spirit/include/qi_auxiliary.hpp>
-#include <boost/spirit/include/qi_action.hpp>
-#include <boost/spirit/include/support_argument.hpp>
-#include <boost/spirit/include/phoenix_core.hpp>
-#include <boost/spirit/include/phoenix_operator.hpp>
-
-#include <iostream>
-#include "test.hpp"
-
-///////////////////////////////////////////////////////////////////////////////
-struct number_parser : public boost::spirit::qi::functor_base
-{
- template <typename Context, typename Iterator>
- struct apply
- {
- typedef int type;
- };
-
- template <typename Attribute, typename Iterator, typename Context>
- bool operator()(Attribute& attr, Context& ctx,
- Iterator& first, Iterator const& last) const
- {
- if (first == last)
- return false;
-
- char ch = *first;
- if (ch < '0' || ch > '9')
- return false;
-
- attr = 0;
- do {
- attr = attr * 10 + int(ch - '0');
- ++first;
- } while (first != last && (ch = *first, ch >= '0' && ch <= '9'));
- return true;
- }
-};
-
-boost::spirit::qi::functor_parser<number_parser> number;
-
-///////////////////////////////////////////////////////////////////////////////
-int main()
-{
- using spirit_test::test;
- using namespace boost::spirit;
- using namespace boost::spirit::qi;
-
- {
- using namespace boost::phoenix;
- using boost::spirit::arg_names::_1;
-
- int n = 0;
- BOOST_TEST(test("1234", number));
- BOOST_TEST(test("1234", number[ref(n) = _1]));
- BOOST_TEST(n == 1234);
- }
-
- return boost::report_errors();
-}

Modified: branches/release/libs/spirit/test/qi/grammar.cpp
==============================================================================
--- branches/release/libs/spirit/test/qi/grammar.cpp (original)
+++ branches/release/libs/spirit/test/qi/grammar.cpp 2009-09-14 12:45:39 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)
@@ -18,11 +18,17 @@
 #include <iostream>
 #include "test.hpp"
 
-using namespace spirit_test;
-using namespace boost::spirit;
-using namespace boost::spirit::qi;
-using namespace boost::spirit::ascii;
-using namespace boost::spirit::arg_names;
+using spirit_test::test;
+using spirit_test::test_attr;
+
+using boost::spirit::ascii::space_type;
+using boost::spirit::ascii::space;
+using boost::spirit::int_;
+using boost::spirit::qi::grammar;
+using boost::spirit::qi::rule;
+using boost::spirit::_val;
+using boost::spirit::_r1;
+using boost::spirit::lit;
 
 struct num_list : grammar<char const*, space_type>
 {
@@ -101,7 +107,7 @@
     { // direct access to the rules
 
         num_list g;
- BOOST_TEST(test("123", g.num));
+ BOOST_TEST(test("123", g.num, space));
         BOOST_TEST(test("123, 456, 789", g.start, space));
     }
 

Modified: branches/release/libs/spirit/test/qi/int.cpp
==============================================================================
--- branches/release/libs/spirit/test/qi/int.cpp (original)
+++ branches/release/libs/spirit/test/qi/int.cpp 2009-09-14 12:45:39 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
 
     Distributed under the Boost Software License, Version 1.0. (See accompanying
@@ -19,7 +19,7 @@
 ///////////////////////////////////////////////////////////////////////////////
 //
 // *** BEWARE PLATFORM DEPENDENT!!! ***
-// *** The following assumes 32 bit integers and 64 bit long longs.
+// *** The following assumes 32 bit or 64 bit integers and 64 bit long longs.
 // *** Modify these constant strings when appropriate.
 //
 ///////////////////////////////////////////////////////////////////////////////
@@ -27,16 +27,29 @@
 // Some compilers have long long, but don't define the
 // LONG_LONG_MIN and LONG_LONG_MAX macros in limits.h. This
 // assumes that long long is 64 bits.
+
+BOOST_STATIC_ASSERT(sizeof(long long) == 8);
+
 #if !defined(LONG_LONG_MIN) && !defined(LONG_LONG_MAX)
 # define LONG_LONG_MAX 0x7fffffffffffffffLL
 # define LONG_LONG_MIN (-LONG_LONG_MAX - 1)
 #endif
+
 #endif // BOOST_HAS_LONG_LONG
 
+#if INT_MAX != LLONG_MAX
+ BOOST_STATIC_ASSERT(sizeof(int) == 4);
     char const* max_int = "2147483647";
     char const* int_overflow = "2147483648";
     char const* min_int = "-2147483648";
     char const* int_underflow = "-2147483649";
+#else
+ BOOST_STATIC_ASSERT(sizeof(int) == 8);
+ char const* max_int = "9223372036854775807";
+ char const* int_overflow = "9223372036854775808";
+ char const* min_int = "-9223372036854775808";
+ char const* int_underflow = "-9223372036854775809";
+#endif
 
 #ifdef BOOST_HAS_LONG_LONG
     char const* max_long_long = "9223372036854775807";
@@ -45,10 +58,24 @@
     char const* long_long_underflow = "-9223372036854775809";
 #endif
 
+///////////////////////////////////////////////////////////////////////////////
+// A custom int type
+struct custom_int
+{
+ int n;
+ custom_int() : n(0) {}
+ explicit custom_int(int n_) : n(n_) {}
+ custom_int& operator=(int n_) { n = n_; return *this; }
+ friend custom_int operator*(custom_int a, custom_int b) { return custom_int(a.n * b.n); }
+ friend custom_int operator+(custom_int a, custom_int b) { return custom_int(a.n + b.n); }
+ friend custom_int operator-(custom_int a, custom_int b) { return custom_int(a.n - b.n); }
+};
+
 int
 main()
 {
- using namespace spirit_test;
+ using spirit_test::test;
+ using spirit_test::test_attr;
 
     ///////////////////////////////////////////////////////////////////////////
     // signed integer tests
@@ -130,12 +157,29 @@
 #endif
 
     ///////////////////////////////////////////////////////////////////////////
- // int_spec<unused_type> tests
+ // short_ and long_ tests
+ ///////////////////////////////////////////////////////////////////////////
+ {
+ using boost::spirit::short_;
+ using boost::spirit::long_;
+ int i;
+
+ BOOST_TEST(test("12345", short_));
+ BOOST_TEST(test_attr("12345", short_, i));
+ BOOST_TEST(i == 12345);
+
+ BOOST_TEST(test("1234567890", long_));
+ BOOST_TEST(test_attr("1234567890", long_, i));
+ BOOST_TEST(i == 1234567890);
+ }
+
+ ///////////////////////////////////////////////////////////////////////////
+ // int_parser<unused_type> tests
     ///////////////////////////////////////////////////////////////////////////
     {
- using boost::spirit::qi::int_spec;
+ using boost::spirit::qi::int_parser;
         using boost::spirit::unused_type;
- int_spec<unused_type> any_int;
+ int_parser<unused_type> any_int;
 
         BOOST_TEST(test("123456", any_int));
         BOOST_TEST(test("-123456", any_int));
@@ -146,8 +190,8 @@
     // action tests
     ///////////////////////////////////////////////////////////////////////////
     {
- using namespace boost::phoenix;
- using boost::spirit::arg_names::_1;
+ using boost::phoenix::ref;
+ using boost::spirit::_1;
         using boost::spirit::ascii::space;
         using boost::spirit::int_;
         int n, m;
@@ -159,6 +203,19 @@
         BOOST_TEST(test(" 456", int_[ref(n) = _1], space));
         BOOST_TEST(n == 456);
     }
+
+ ///////////////////////////////////////////////////////////////////////////
+ // custom int tests
+ ///////////////////////////////////////////////////////////////////////////
+ {
+ using boost::spirit::qi::int_;
+ using boost::spirit::qi::int_parser;
+ custom_int i;
+
+ BOOST_TEST(test_attr("-123456", int_, i));
+ int_parser<custom_int, 10, 1, 2> int2;
+ BOOST_TEST(test_attr("-12", int2, i));
+ }
 
     return boost::report_errors();
 }

Modified: branches/release/libs/spirit/test/qi/kleene.cpp
==============================================================================
--- branches/release/libs/spirit/test/qi/kleene.cpp (original)
+++ branches/release/libs/spirit/test/qi/kleene.cpp 2009-09-14 12:45:39 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)
@@ -24,13 +24,16 @@
 #include <iostream>
 #include "test.hpp"
 
-using namespace spirit_test;
-
 int
 main()
 {
- using namespace boost::spirit;
+ using spirit_test::test;
+ using spirit_test::test_attr;
     using namespace boost::spirit::ascii;
+ using boost::spirit::qi::omit;
+ using boost::spirit::qi::uint_;
+ using boost::spirit::qi::int_;
+ using boost::spirit::qi::lexeme;
 
     {
         BOOST_TEST(test("aaaaaaaa", *char_));
@@ -42,40 +45,38 @@
 
     {
         BOOST_TEST(test(" a a aaa aa", *char_, space));
- BOOST_TEST(test("12345 678 9 ", *digit, space));
+ BOOST_TEST(test("12345 678 9", *digit, space));
     }
 
     {
         BOOST_TEST(test("aBcdeFGH", no_case[*char_]));
- BOOST_TEST(test("a B cde FGH ", no_case[*char_], space));
+ BOOST_TEST(test("a B cde FGH", no_case[*char_], space));
     }
 
     {
- using boost::spirit::uint;
- BOOST_TEST(test("12345 678 955 987", *uint, space));
- BOOST_TEST(test("12345, 678, 955, 987", uint >> *(',' >> uint), space));
+ BOOST_TEST(test("12345 678 955 987", *uint_, space));
+ BOOST_TEST(test("12345, 678, 955, 987", uint_ >> *(',' >> uint_), space));
     }
 
     {
- std::vector<char> v;
- BOOST_TEST(test_attr("bbbb", *char_, v) && 4 == v.size() &&
- v[0] == 'b' && v[1] == 'b' && v[2] == 'b' && v[3] == 'b');
+ std::string s;
+ BOOST_TEST(test_attr("bbbb", *char_, s) && 4 == s.size() && s == "bbbb");
 
- v.clear();
- BOOST_TEST(test_attr("b b b b ", *char_, v, space) && 4 == v.size() &&
- v[0] == 'b' && v[1] == 'b' && v[2] == 'b' && v[3] == 'b');
+ s.clear();
+ BOOST_TEST(test_attr("b b b b ", *char_, s, space) && s == "bbbb");
 
- v.clear();
- BOOST_TEST(test_attr("bbbb", *omit[char_('b')], v) && 0 == v.size());
+ // The following 4 tests show that omit does not inhibit explicit attributes
+ s.clear();
+ BOOST_TEST(test_attr("bbbb", *omit[char_('b')], s) && s == "bbbb");
 
- v.clear();
- BOOST_TEST(test_attr("bbbb", omit[*char_('b')], v) && 0 == v.size());
+ s.clear();
+ BOOST_TEST(test_attr("bbbb", omit[*char_('b')], s) && s == "bbbb");
 
- v.clear();
- BOOST_TEST(test_attr("b b b b ", *omit[char_('b')], v, space) && 0 == v.size());
+ s.clear();
+ BOOST_TEST(test_attr("b b b b", *omit[char_('b')], s, space) && s == "bbbb");
 
- v.clear();
- BOOST_TEST(test_attr("b b b b ", omit[*char_('b')], v, space) && 0 == v.size());
+ s.clear();
+ BOOST_TEST(test_attr("b b b b", omit[*char_('b')], s, space) && s == "bbbb");
     }
 
     {
@@ -83,6 +84,12 @@
         BOOST_TEST(test_attr("123 456 789 10", *int_, v, space) && 4 == v.size() &&
             v[0] == 123 && v[1] == 456 && v[2] == 789 && v[3] == 10);
     }
+
+ {
+ std::vector<std::string> v;
+ BOOST_TEST(test_attr("a b c d", *lexeme[+alpha], v, space) && 4 == v.size() &&
+ v[0] == "a" && v[1] == "b" && v[2] == "c" && v[3] == "d");
+ }
 
     {
         std::vector<int> v;
@@ -92,7 +99,7 @@
 
     { // actions
         namespace phx = boost::phoenix;
- using boost::spirit::arg_names::_1;
+ using boost::spirit::_1;
 
         std::vector<char> v;
         BOOST_TEST(test("bbbb", (*char_)[phx::ref(v) = _1]) && 4 == v.size() &&
@@ -101,7 +108,7 @@
 
     { // more actions
         namespace phx = boost::phoenix;
- using boost::spirit::arg_names::_1;
+ using boost::spirit::_1;
 
         std::vector<int> v;
         BOOST_TEST(test("123 456 789", (*int_)[phx::ref(v) = _1], space) && 3 == v.size() &&

Modified: branches/release/libs/spirit/test/qi/lazy.cpp
==============================================================================
--- branches/release/libs/spirit/test/qi/lazy.cpp (original)
+++ branches/release/libs/spirit/test/qi/lazy.cpp 2009-09-14 12:45:39 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)
@@ -23,27 +23,44 @@
 main()
 {
     using spirit_test::test;
- using namespace boost::spirit;
- using namespace boost::spirit::qi;
- using namespace boost::phoenix;
- using namespace boost::spirit::arg_names;
+ using spirit_test::test_attr;
+
+ namespace qi = boost::spirit::qi;
+ using boost::spirit::qi::_1;
+ using boost::spirit::qi::_val;
+ using boost::spirit::qi::int_;
+ using boost::spirit::qi::rule;
+ using boost::spirit::ascii::char_;
+
+ using boost::phoenix::val;
+ using boost::phoenix::ref;
 
     {
- BOOST_TEST(test("123", lazy(val(int_))));
+ BOOST_TEST(test("123", val(int_)));
     }
 
     {
         int result;
- BOOST_TEST(test("123", lazy(val(int_))[ref(result) = _1]));
+ BOOST_TEST(test("123", qi::lazy(val(int_))[ref(result) = _1]));
         BOOST_TEST((result == 123));
     }
 
     {
+ rule<char const*, char()> r;
+
+ r = char_[_val = _1] >> *qi::lazy(_val);
+
+ BOOST_TEST(test("aaaaaaaaaaaa", r));
+ BOOST_TEST(!test("abbbbbbbbbb", r));
+ BOOST_TEST(test("bbbbbbbbbbb", r));
+ }
+
+ {
         rule<char const*, std::string()> r;
 
         r =
                 '<' >> *(char_ - '>')[_val += _1] >> '>'
- >> "</" >> lazy(_val) >> '>'
+ >> "</" >> qi::lazy(_val) >> '>'
         ;
 
         BOOST_TEST(test("<tag></tag>", r));

Modified: branches/release/libs/spirit/test/qi/lexeme.cpp
==============================================================================
--- branches/release/libs/spirit/test/qi/lexeme.cpp (original)
+++ branches/release/libs/spirit/test/qi/lexeme.cpp 2009-09-14 12:45:39 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)
@@ -17,8 +17,10 @@
 main()
 {
     using spirit_test::test;
- using namespace boost::spirit;
- using namespace boost::spirit::ascii;
+ using boost::spirit::ascii::space;
+ using boost::spirit::ascii::space_type;
+ using boost::spirit::ascii::digit;
+ using boost::spirit::qi::lexeme;
     using boost::spirit::qi::rule;
 
     {
@@ -27,7 +29,8 @@
         BOOST_TEST((test(" 12345", lexeme[+digit], space)));
         BOOST_TEST((test(" 12345 ", lexeme[+digit], space, false)));
 
- rule<char const*, space_type> r, rr;
+ rule<char const*, space_type> rr;
+ rule<char const*> r;
         r = +digit;
         rr = lexeme[r];
         BOOST_TEST((!test(" 1 2 3 4 5", rr, space)));

Modified: branches/release/libs/spirit/test/qi/list.cpp
==============================================================================
--- branches/release/libs/spirit/test/qi/list.cpp (original)
+++ branches/release/libs/spirit/test/qi/list.cpp 2009-09-14 12:45:39 EDT (Mon, 14 Sep 2009)
@@ -1,11 +1,13 @@
 /*=============================================================================
- 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)
 =============================================================================*/
 #include <string>
 #include <vector>
+#include <set>
+#include <map>
 
 #include <boost/detail/lightweight_test.hpp>
 #include <boost/utility/enable_if.hpp>
@@ -21,6 +23,7 @@
 #include <boost/spirit/include/phoenix_operator.hpp>
 #include <boost/spirit/include/phoenix_object.hpp>
 #include <boost/spirit/include/phoenix_stl.hpp>
+#include <boost/fusion/include/std_pair.hpp>
 
 #include <string>
 #include <iostream>
@@ -31,7 +34,6 @@
 int
 main()
 {
- using namespace boost::spirit;
     using namespace boost::spirit::ascii;
 
     {
@@ -50,13 +52,72 @@
         BOOST_TEST(s == "abcdefgh");
     }
 
+ {
+ using boost::spirit::int_;
+
+ std::vector<int> v;
+ BOOST_TEST(test_attr("1,2", int_ % ',', v));
+ BOOST_TEST(2 == v.size() && 1 == v[0] && 2 == v[1]);
+ }
+
+ {
+ using boost::spirit::int_;
+
+ std::vector<int> v;
+ BOOST_TEST(test_attr("(1,2)", '(' >> int_ % ',' >> ')', v));
+ BOOST_TEST(2 == v.size() && 1 == v[0] && 2 == v[1]);
+ }
+
+ {
+ std::vector<std::string> v;
+ BOOST_TEST(test_attr("a,b,c,d", +alpha % ',', v));
+ BOOST_TEST(4 == v.size() && "a" == v[0] && "b" == v[1]
+ && "c" == v[2] && "d" == v[3]);
+ }
+
+ {
+ std::vector<boost::optional<std::string> > v;
+ BOOST_TEST(test_attr("#a,#", ('#' >> -alpha) % ',', v));
+ BOOST_TEST(2 == v.size() &&
+ v[0] && "a" == boost::get<std::string>(v[0]) &&
+ v[1] && boost::get<std::string>(v[1]).size() == 1 &&
+ boost::get<std::string>(v[1])[0] == '\0');
+ }
+
+ {
+ typedef std::set<std::pair<std::string, std::string> > set_type;
+ set_type s;
+ BOOST_TEST(test_attr("k1=v1&k2=v2",
+ (*(char_ - '=') >> '=' >> *(char_ - '&')) % '&', s));
+
+ set_type::const_iterator it = s.begin();
+ BOOST_TEST(s.size() == 2);
+ BOOST_TEST(it != s.end() && (*it).first == "k1" && (*it).second == "v1");
+ BOOST_TEST(++it != s.end() && (*it).first == "k2" && (*it).second == "v2");
+ }
+
+ {
+ typedef std::map<std::string, std::string> map_type;
+ map_type m;
+ BOOST_TEST(test_attr("k1=v1&k2=v2",
+ (*(char_ - '=') >> '=' >> *(char_ - '&')) % '&', m));
+
+ map_type::const_iterator it = m.begin();
+ BOOST_TEST(m.size() == 2);
+ BOOST_TEST(it != m.end() && (*it).first == "k1" && (*it).second == "v1");
+ BOOST_TEST(++it != m.end() && (*it).first == "k2" && (*it).second == "v2");
+ }
+
     { // actions
- using namespace boost::phoenix;
- using boost::spirit::arg_names::_1;
+ namespace phx = boost::phoenix;
+ using boost::phoenix::begin;
+ using boost::phoenix::end;
+ using boost::phoenix::construct;
+ using boost::spirit::qi::_1;
 
         std::string s;
         BOOST_TEST(test("a,b,c,d,e,f,g,h", (char_ % ',')
- [ref(s) = construct<std::string>(begin(_1), end(_1))]));
+ [phx::ref(s) = construct<std::string>(begin(_1), end(_1))]));
     }
 
     return boost::report_errors();

Modified: branches/release/libs/spirit/test/qi/lit.cpp
==============================================================================
--- branches/release/libs/spirit/test/qi/lit.cpp (original)
+++ branches/release/libs/spirit/test/qi/lit.cpp 2009-09-14 12:45:39 EDT (Mon, 14 Sep 2009)
@@ -1,5 +1,5 @@
 /*=============================================================================
- Copyright (c) 2001-2007 Joel de Guzman
+ Copyright (c) 2001-2009 Joel de Guzman
     http://spirit.sourceforge.net/
 
     Distributed under the Boost Software License, Version 1.0. (See accompanying
@@ -9,7 +9,6 @@
 #include <boost/spirit/include/qi_string.hpp>
 #include <boost/spirit/include/qi_char.hpp>
 #include <boost/spirit/include/qi_action.hpp>
-#include <boost/spirit/include/support_argument.hpp>
 #include <boost/spirit/include/phoenix_core.hpp>
 #include <boost/spirit/include/phoenix_operator.hpp>
 
@@ -21,22 +20,29 @@
 {
     using spirit_test::test;
     using spirit_test::test_attr;
- using namespace boost::spirit;
+ using boost::spirit::qi::lit;
+ using boost::spirit::qi::_1;
 
     {
         BOOST_TEST((test("kimpo", "kimpo")));
         BOOST_TEST((test("kimpo", lit("kimpo"))));
         BOOST_TEST((test("x", lit("x"))));
- BOOST_TEST((test("x", lit('x'))));
- BOOST_TEST((test(L"x", lit(L'x'))));
+ BOOST_TEST((test(L"x", lit(L"x"))));
+
+ std::basic_string<char> s("kimpo");
+ std::basic_string<wchar_t> ws(L"kimpo");
+ BOOST_TEST((test("kimpo", s)));
+ BOOST_TEST((test(L"kimpo", ws)));
+ BOOST_TEST((test("kimpo", lit(s))));
+ BOOST_TEST((test(L"kimpo", lit(ws))));
     }
 
     {
         BOOST_TEST((test(L"kimpo", L"kimpo")));
- BOOST_TEST((test(L"kimpo", wlit(L"kimpo"))));
- BOOST_TEST((test(L"x", wlit(L"x"))));
- BOOST_TEST((test(L"x", wlit(L'x'))));
- BOOST_TEST((test(L"x", wlit(L'x'))));
+ BOOST_TEST((test(L"kimpo", lit(L"kimpo"))));
+ BOOST_TEST((test(L"x", lit(L"x"))));
+ BOOST_TEST((test(L"x", lit(L'x'))));
+ BOOST_TEST((test(L"x", lit(L'x'))));
     }
 
     {
@@ -58,21 +64,34 @@
 
     {
         using namespace boost::spirit::ascii;
- BOOST_TEST((test(" kimpo", wlit("kimpo"), space)));
- BOOST_TEST((test(L" kimpo", wlit(L"kimpo"), space)));
- BOOST_TEST((test(" x", wlit("x"), space)));
- BOOST_TEST((test(" x", wlit('x'), space)));
- BOOST_TEST((test(L" x", wlit(L'x'), space)));
+ BOOST_TEST((test(" kimpo", lit("kimpo"), space)));
+ BOOST_TEST((test(L" kimpo", lit(L"kimpo"), space)));
+ BOOST_TEST((test(" x", lit("x"), space)));
+ BOOST_TEST((test(" x", lit('x'), space)));
+ BOOST_TEST((test(L" x", lit(L'x'), space)));
+ }
+
+ {
+ using namespace boost::spirit::ascii;
+ std::string s;
+ BOOST_TEST((test_attr("kimpo", string("kimpo"), s)));
+ BOOST_TEST(s == "kimpo");
+ BOOST_TEST((test_attr(L"kimpo", string(L"kimpo"), s)));
+ BOOST_TEST(s == "kimpo");
+ BOOST_TEST((test_attr("x", string("x"), s)));
+ BOOST_TEST(s == "x");
     }
 
- { // lazy strings
+ { // lazy string
 
- using namespace boost::phoenix;
- std::basic_string<char> s("kimpo");
- BOOST_TEST((test("kimpo", lit(val(s)))));
+ using namespace boost::spirit::ascii;
+ namespace phx = boost::phoenix;
 
- std::basic_string<wchar_t> ws(L"kimpo");
- BOOST_TEST((test(L"kimpo", lit(ref(ws)))));
+ BOOST_TEST((test("x", string(phx::val("x")))));
+
+ std::string str; // make sure lazy lits have an attribute
+ BOOST_TEST(test("x", string(phx::val("x"))[phx::ref(str) = _1]));
+ BOOST_TEST(str == "x");
     }
 
     return boost::report_errors();

Modified: branches/release/libs/spirit/test/qi/match_manip.cpp
==============================================================================
--- branches/release/libs/spirit/test/qi/match_manip.cpp (original)
+++ branches/release/libs/spirit/test/qi/match_manip.cpp 2009-09-14 12:45:39 EDT (Mon, 14 Sep 2009)
@@ -1,9 +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)
-
-#include <boost/spirit/include/qi.hpp>
+/*=============================================================================
+ 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)
+=============================================================================*/
+#include <boost/spirit/include/support_argument.hpp>
+#include <boost/spirit/include/qi_action.hpp>
+#include <boost/spirit/include/qi_numeric.hpp>
+#include <boost/spirit/include/qi_operator.hpp>
+#include <boost/spirit/include/qi_char.hpp>
+#include <boost/spirit/include/qi_operator.hpp>
 #include <boost/spirit/include/qi_stream.hpp>
 #include <boost/spirit/include/phoenix_core.hpp>
 #include <boost/spirit/include/phoenix_operator.hpp>
@@ -14,37 +21,24 @@
 #include <vector>
 #include <list>
 
-#include <boost/static_assert.hpp>
 #include <boost/detail/lightweight_test.hpp>
 
 ///////////////////////////////////////////////////////////////////////////////
 template <typename Char, typename Expr>
-bool test(Char const *toparse, Expr const& xpr)
+bool test(Char const *toparse, Expr const& expr)
 {
     namespace spirit = boost::spirit;
- typedef
- spirit::traits::is_component<spirit::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 spirit::result_of::as_component<spirit::qi::domain, Expr>::type
- component;
- typedef typename component::director director;
-
- component c = spirit::as_component(spirit::qi::domain(), xpr);
+ BOOST_SPIRIT_ASSERT_MATCH(spirit::qi::domain, Expr);
 
     std::istringstream istrm(toparse);
- istrm >> c;
+ istrm >> spirit::qi::compile<spirit::qi::domain>(expr);
     return istrm.good() || istrm.eof();
 }
 
-template <typename Char, typename Expr, typename Attribute, typename Skipper>
+template <typename Char, typename Expr, typename Copy, typename Skipper
+ , typename Attribute>
 bool test(Char const *toparse,
- boost::spirit::qi::detail::match_manip<Expr, Attribute, Skipper> const& mm)
+ boost::spirit::qi::detail::match_manip<Expr, Copy, Skipper, Attribute> const& mm)
 {
     std::istringstream istrm(toparse);
     istrm >> mm;
@@ -67,28 +61,32 @@
 int
 main()
 {
- using namespace boost::spirit;
- using namespace boost::spirit::ascii;
- using namespace boost::spirit::arg_names;
- using namespace boost::spirit::qi;
+ using boost::spirit::qi::_1;
+ using boost::spirit::qi::_2;
+ using boost::spirit::qi::match;
+ using boost::spirit::qi::phrase_match;
+ using boost::spirit::qi::typed_stream;
+ using boost::spirit::qi::stream;
+ using boost::spirit::qi::int_;
 
+ using namespace boost::spirit::ascii;
     namespace fusion = boost::fusion;
- using namespace boost::phoenix;
+ namespace phx = boost::phoenix;
 
     {
         char c = '\0';
         BOOST_TEST(test( "a",
- char_[ref(c) = _1]
+ char_[phx::ref(c) = _1]
         ) && c == 'a');
 
         c = '\0';
         BOOST_TEST(test( "a",
- match(char_[ref(c) = _1])
+ match(char_[phx::ref(c) = _1])
         ) && c == 'a');
 
         c = '\0';
         BOOST_TEST(test( " a",
- phrase_match(char_[ref(c) = _1], space)
+ phrase_match(char_[phx::ref(c) = _1], space)
         ) && c == 'a');
 
         c = '\0';
@@ -98,7 +96,7 @@
 
         c = '\0';
         BOOST_TEST(test( " a",
- phrase_match(char_, c, space)
+ phrase_match(char_, space, c)
         ) && c == 'a');
     }
 
@@ -113,32 +111,32 @@
         ///////////////////////////////////////////////////////////////////////
         char c = '\0';
         BOOST_TEST(test( "a",
- char_stream[ref(c) = _1]
+ char_stream[phx::ref(c) = _1]
         ) && c == 'a');
 
         c = '\0';
         BOOST_TEST(test( "a",
- match(char_stream[ref(c) = _1])
+ match(char_stream[phx::ref(c) = _1])
         ) && c == 'a');
 
         c = '\0';
         BOOST_TEST(test( " a",
- phrase_match(char_stream[ref(c) = _1], space)
+ phrase_match(char_stream[phx::ref(c) = _1], space)
         ) && c == 'a');
 
         int i = 0;
         BOOST_TEST(test( "42",
- int_stream[ref(i) = _1]
+ int_stream[phx::ref(i) = _1]
         ) && i == 42);
 
         i = 0;
         BOOST_TEST(test( "42",
- match(int_stream[ref(i) = _1])
+ match(int_stream[phx::ref(i) = _1])
         ) && i == 42);
 
         i = 0;
         BOOST_TEST(test( " 42",
- phrase_match(int_stream[ref(i) = _1], space)
+ phrase_match(int_stream[phx::ref(i) = _1], space)
         ) && i == 42);
 
         ///////////////////////////////////////////////////////////////////////
@@ -149,7 +147,7 @@
 
         c = '\0';
         BOOST_TEST(test( " a",
- phrase_match(stream, c, space)
+ phrase_match(stream, space, c)
         ) && c == 'a');
 
         i = 0;
@@ -159,24 +157,24 @@
 
         i = 0;
         BOOST_TEST(test( " 42",
- phrase_match(stream, i, space)
+ phrase_match(stream, space, i)
         ) && i == 42);
     }
 
     {
         char a = '\0', b = '\0';
         BOOST_TEST(test( "ab",
- char_[ref(a) = _1] >> char_[ref(b) = _1]
+ char_[phx::ref(a) = _1] >> char_[phx::ref(b) = _1]
         ) && a == 'a' && b == 'b');
 
         a = '\0', b = '\0';
         BOOST_TEST(test( "ab",
- match(char_[ref(a) = _1] >> char_[ref(b) = _1])
+ match(char_[phx::ref(a) = _1] >> char_[phx::ref(b) = _1])
         ) && a == 'a' && b == 'b');
 
         a = '\0', b = '\0';
         BOOST_TEST(test( " a b",
- phrase_match(char_[ref(a) = _1] >> char_[ref(b) = _1], space)
+ phrase_match(char_[phx::ref(a) = _1] >> char_[phx::ref(b) = _1], space)
         ) && a == 'a' && b == 'b');
 
         fusion::vector<char, char> t;
@@ -186,14 +184,14 @@
 
         t = fusion::vector<char, char>();
         BOOST_TEST(test( " a b",
- phrase_match(char_ >> char_, t, space)
+ phrase_match(char_ >> char_, space, t)
         ) && fusion::at_c<0>(t) == 'a' && fusion::at_c<1>(t) == 'b');
     }
 
     {
         char a = '\0', b = '\0', c = '\0';
         BOOST_TEST(test( "abc",
- char_[ref(a) = _1] >> char_[ref(b) = _1] >> char_[ref(c) = _1]
+ char_[phx::ref(a) = _1] >> char_[phx::ref(b) = _1] >> char_[phx::ref(c) = _1]
         ) && a == 'a' && b == 'b' && c == 'c');
 
         BOOST_TEST(test( "abc",
@@ -219,7 +217,7 @@
 
         t = fusion::vector<char, char, char>();
         BOOST_TEST(test( " a b c",
- phrase_match(char_ >> char_ >> char_, t, space)
+ phrase_match(char_ >> char_ >> char_, space, t)
         ) && fusion::at_c<0>(t) == 'a' && fusion::at_c<1>(t) == 'b' && fusion::at_c<2>(t) == 'c');
     }
 
@@ -227,7 +225,7 @@
         char a = '\0';
         int i = 0;
         BOOST_TEST(test( "a2",
- (char_ >> int_)[ref(a) = _1, ref(i) = _2]
+ (char_ >> int_)[phx::ref(a) = _1, phx::ref(i) = _2]
         ) && a == 'a' && i == 2);
 
         fusion::vector<char, int> t;
@@ -237,14 +235,14 @@
 
         t = fusion::vector<char, int>();
         BOOST_TEST(test( " a 2",
- phrase_match(char_ >> int_, t, space)
+ phrase_match(char_ >> int_, space, t)
         ) && fusion::at_c<0>(t) == 'a' && fusion::at_c<1>(t) == 2);
 
         BOOST_TEST(!test( "a2",
             match(char_ >> alpha, t)
         ));
         BOOST_TEST(!test( " a 2",
- phrase_match(char_ >> alpha, t, space)
+ phrase_match(char_ >> alpha, space, t)
         ));
     }
 
@@ -252,7 +250,7 @@
         // output all elements of a vector
         std::vector<char> v;
         BOOST_TEST(test( "abc",
- (*char_)[ref(v) = _1]
+ (*char_)[phx::ref(v) = _1]
         ) && 3 == v.size() && v[0] == 'a' && v[1] == 'b' && v[2] == 'c');
 
         v.clear();
@@ -262,7 +260,7 @@
 
         v.clear();
         BOOST_TEST(test( " a b c",
- phrase_match(*char_, v, space)
+ phrase_match(*char_, space, v)
         ) && 3 == v.size() && v[0] == 'a' && v[1] == 'b' && v[2] == 'c');
 
         // parse a comma separated list of vector elements
@@ -273,7 +271,7 @@
 
         v.clear();
         BOOST_TEST(test( " a , b , c",
- phrase_match(char_ % ',', v, space)
+ phrase_match(char_ % ',', space, v)
         ) && 3 == v.size() && v[0] == 'a' && v[1] == 'b' && v[2] == 'c');
 
         // output all elements of a list
@@ -284,7 +282,7 @@
 
         l.clear();
         BOOST_TEST(test( " a b c",
- phrase_match(*char_, l, space)
+ phrase_match(*char_, space, l)
         ) && 3 == l.size() && is_list_ok(l));
     }
 

Modified: branches/release/libs/spirit/test/qi/no_case.cpp
==============================================================================
--- branches/release/libs/spirit/test/qi/no_case.cpp (original)
+++ branches/release/libs/spirit/test/qi/no_case.cpp 2009-09-14 12:45:39 EDT (Mon, 14 Sep 2009)
@@ -1,5 +1,5 @@
 /*=============================================================================
- Copyright (c) 2001-2007 Joel de Guzman
+ Copyright (c) 2001-2009 Joel de Guzman
     http://spirit.sourceforge.net/
 
     Distributed under the Boost Software License, Version 1.0. (See accompanying
@@ -9,6 +9,9 @@
 #include <boost/spirit/include/qi_char.hpp>
 #include <boost/spirit/include/qi_string.hpp>
 #include <boost/spirit/include/qi_directive.hpp>
+#include <boost/spirit/include/qi_action.hpp>
+#include <boost/spirit/include/phoenix_core.hpp>
+#include <boost/spirit/include/phoenix_operator.hpp>
 
 #include <iostream>
 #include "test.hpp"
@@ -17,7 +20,8 @@
 main()
 {
     using spirit_test::test;
- using namespace boost::spirit;
+ using spirit_test::test_attr;
+ using boost::spirit::qi::lit;
 
     {
         using namespace boost::spirit::ascii;
@@ -36,12 +40,41 @@
 
     {
         using namespace boost::spirit::ascii;
+ BOOST_TEST(test("X", no_case['x']));
+ BOOST_TEST(test("X", no_case['X']));
+ BOOST_TEST(test("x", no_case['X']));
+ BOOST_TEST(test("x", no_case['x']));
+ BOOST_TEST(!test("z", no_case['X']));
+ BOOST_TEST(!test("z", no_case['x']));
+ }
+
+ {
+ using namespace boost::spirit::iso8859_1;
+ BOOST_TEST(test("Á", no_case[char_('á')]));
+ }
+
+ {
+ using namespace boost::spirit::iso8859_1;
+ BOOST_TEST(test("X", no_case[char_("a-z")]));
+ BOOST_TEST(!test("1", no_case[char_("a-z")]));
+ BOOST_TEST(test("É", no_case[char_("å-ï")]));
+ BOOST_TEST(!test("ÿ", no_case[char_("å-ï")]));
+ }
+
+ {
+ using namespace boost::spirit::ascii;
         BOOST_TEST(test("Bochi Bochi", no_case[lit("bochi bochi")]));
         BOOST_TEST(test("BOCHI BOCHI", no_case[lit("bochi bochi")]));
         BOOST_TEST(!test("Vavoo", no_case[lit("bochi bochi")]));
     }
 
     {
+ using namespace boost::spirit::iso8859_1;
+ BOOST_TEST(test("Áá", no_case[lit("áÁ")]));
+ BOOST_TEST(test("áá", no_case[no_case[lit("áÁ")]]));
+ }
+
+ {
         // should work!
         using namespace boost::spirit::ascii;
         BOOST_TEST(test("x", no_case[no_case[char_]]));
@@ -92,12 +125,50 @@
     }
 
     {
- using namespace boost::spirit::standard;
         // chsets
- BOOST_TEST(test("x", no_case[char_("a-z")]));
- BOOST_TEST(test("X", no_case[char_("a-z")]));
- BOOST_TEST(test(L"X", no_case[wchar(L"a-z")]));
- BOOST_TEST(test(L"X", no_case[wchar(L"X")]));
+ namespace standard = boost::spirit::standard;
+ namespace standard_wide = boost::spirit::standard_wide;
+
+ BOOST_TEST(test("x", standard::no_case[standard::char_("a-z")]));
+ BOOST_TEST(test("X", standard::no_case[standard::char_("a-z")]));
+ BOOST_TEST(test(L"X", standard_wide::no_case[standard_wide::char_(L"a-z")]));
+ BOOST_TEST(test(L"X", standard_wide::no_case[standard_wide::char_(L"X")]));
+ }
+
+ {
+ using namespace boost::spirit::standard;
+ std::string s("bochi bochi");
+ BOOST_TEST(test("Bochi Bochi", no_case[lit(s.c_str())]));
+ BOOST_TEST(test("Bochi Bochi", no_case[lit(s)]));
+ BOOST_TEST(test("Bochi Bochi", no_case[s.c_str()]));
+ BOOST_TEST(test("Bochi Bochi", no_case[s]));
+ }
+
+ { // lazy no_case chars
+
+ using namespace boost::spirit::ascii;
+
+ using boost::phoenix::val;
+ using boost::phoenix::ref;
+ using boost::spirit::_1;
+
+ BOOST_TEST((test("X", no_case[val('x')])));
+ BOOST_TEST((test("h", no_case[char_(val('a'), val('n'))])));
+ BOOST_TEST(test("0", no_case[char_(val("a-z0-9"))]));
+
+ char ch; // make sure lazy chars have an attribute
+ BOOST_TEST(test("x", no_case[char_(val('x'))][ref(ch) = _1]));
+ BOOST_TEST(ch == 'x');
+ }
+
+ { // lazy no_case lits
+
+ using namespace boost::spirit::ascii;
+ using boost::phoenix::val;
+
+ BOOST_TEST(test("Bochi Bochi", no_case[val("bochi bochi")]));
+ BOOST_TEST(test("BOCHI BOCHI", no_case[val("bochi bochi")]));
+ BOOST_TEST(!test("Vavoo", no_case[val("bochi bochi")]));
     }
 
     return boost::report_errors();

Deleted: branches/release/libs/spirit/test/qi/none.cpp
==============================================================================
--- branches/release/libs/spirit/test/qi/none.cpp 2009-09-14 12:45:39 EDT (Mon, 14 Sep 2009)
+++ (empty file)
@@ -1,25 +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)
-=============================================================================*/
-#include <boost/detail/lightweight_test.hpp>
-#include <boost/spirit/include/qi_auxiliary.hpp>
-
-#include <iostream>
-#include "test.hpp"
-
-int
-main()
-{
- using spirit_test::test;
- using namespace boost::spirit;
-
- {
- BOOST_TEST((!test("", none)));
- BOOST_TEST((!test("xxx", none)));
- }
-
- return boost::report_errors();
-}

Modified: branches/release/libs/spirit/test/qi/not_predicate.cpp
==============================================================================
--- branches/release/libs/spirit/test/qi/not_predicate.cpp (original)
+++ branches/release/libs/spirit/test/qi/not_predicate.cpp 2009-09-14 12:45:39 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)
@@ -16,11 +16,12 @@
 main()
 {
     using spirit_test::test;
- using namespace boost::spirit;
+ using boost::spirit::qi::int_;
 
     {
         BOOST_TEST((!test("1234", !int_)));
         BOOST_TEST((test("abcd", !int_, false)));
+ BOOST_TEST((!test("abcd", !!int_, false)));
     }
 
     return boost::report_errors();

Modified: branches/release/libs/spirit/test/qi/optional.cpp
==============================================================================
--- branches/release/libs/spirit/test/qi/optional.cpp (original)
+++ branches/release/libs/spirit/test/qi/optional.cpp 2009-09-14 12:45:39 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)
@@ -22,7 +22,11 @@
 {
     using spirit_test::test;
     using spirit_test::test_attr;
- using namespace boost::spirit;
+
+ using boost::spirit::qi::_1;
+ using boost::spirit::qi::int_;
+ using boost::spirit::qi::omit;
+ using boost::spirit::ascii::char_;
 
     {
         BOOST_TEST((test("1234", -int_)));
@@ -30,7 +34,8 @@
     }
 
     { // test propagation of unused
- using namespace boost::fusion;
+ using boost::fusion::at_c;
+ using boost::fusion::vector;
 
         vector<char, char> v;
         BOOST_TEST((test_attr("a1234c", char_ >> -omit[int_] >> char_, v)));
@@ -42,16 +47,14 @@
         BOOST_TEST((at_c<0>(v) == 'a'));
         BOOST_TEST((at_c<1>(v) == 'c'));
 
- //~ char ch;
- //~ BOOST_TEST((test_attr(",c", -(',' >> char_), ch)));
- //~ BOOST_TEST((ch == 'c'));
+ char ch;
+ BOOST_TEST((test_attr(",c", -(',' >> char_), ch)));
+ BOOST_TEST((ch == 'c'));
     }
 
     { // test action
 
- using namespace boost::phoenix;
         namespace phx = boost::phoenix;
- using namespace boost::spirit::arg_names;
 
         boost::optional<int> n = 0;
         BOOST_TEST((test("1234", (-int_)[phx::ref(n) = _1])));

Modified: branches/release/libs/spirit/test/qi/permutation.cpp
==============================================================================
--- branches/release/libs/spirit/test/qi/permutation.cpp (original)
+++ branches/release/libs/spirit/test/qi/permutation.cpp 2009-09-14 12:45:39 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)
@@ -28,9 +28,13 @@
 int
 main()
 {
- using namespace boost::spirit;
- using boost::spirit::ascii::alpha;
+ using boost::spirit::qi::int_;
+ using boost::spirit::qi::_1;
+ using boost::spirit::qi::_2;
     using boost::spirit::qi::rule;
+ using boost::spirit::ascii::alpha;
+ using boost::spirit::ascii::char_;
+
     using boost::fusion::vector;
     using boost::fusion::at_c;
     using boost::optional;
@@ -76,7 +80,6 @@
 
     { // test action
         using namespace boost::phoenix;
- using namespace boost::spirit::arg_names;
         namespace phx = boost::phoenix;
 
         optional<int> i;

Modified: branches/release/libs/spirit/test/qi/plus.cpp
==============================================================================
--- branches/release/libs/spirit/test/qi/plus.cpp (original)
+++ branches/release/libs/spirit/test/qi/plus.cpp 2009-09-14 12:45:39 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)
@@ -29,8 +29,12 @@
 int
 main()
 {
- using namespace boost::spirit;
     using namespace boost::spirit::ascii;
+ using boost::spirit::qi::int_;
+ using boost::spirit::qi::omit;
+ using boost::spirit::qi::lit;
+ using boost::spirit::qi::_1;
+ using boost::spirit::qi::lexeme;
 
     {
         BOOST_TEST(test("aaaaaaaa", +char_));
@@ -57,27 +61,33 @@
     }
 
     {
+ std::vector<std::string> v;
+ BOOST_TEST(test_attr("a b c d", +lexeme[+alpha], v, space) && 4 == v.size() &&
+ v[0] == "a" && v[1] == "b" && v[2] == "c" && v[3] == "d");
+ }
+
+ {
         BOOST_TEST(test("Kim Kim Kim", +lit("Kim"), space));
     }
 
     {
- std::vector<char> v;
- v.clear();
- BOOST_TEST(test_attr("bbbb", +omit[char_('b')], v) && 0 == v.size());
+ // The following 4 tests show that omit does not inhibit explicit attributes
+
+ std::string s;
+ BOOST_TEST(test_attr("bbbb", +omit[char_('b')], s) && s == "bbbb");
 
- v.clear();
- BOOST_TEST(test_attr("bbbb", omit[+char_('b')], v) && 0 == v.size());
+ s.clear();
+ BOOST_TEST(test_attr("bbbb", omit[+char_('b')], s) && s == "bbbb");
 
- v.clear();
- BOOST_TEST(test_attr("b b b b ", +omit[char_('b')], v, space) && 0 == v.size());
+ s.clear();
+ BOOST_TEST(test_attr("b b b b ", +omit[char_('b')], s, space) && s == "bbbb");
 
- v.clear();
- BOOST_TEST(test_attr("b b b b ", omit[+char_('b')], v, space) && 0 == v.size());
+ s.clear();
+ BOOST_TEST(test_attr("b b b b ", omit[+char_('b')], s, space) && s == "bbbb");
     }
 
     { // actions
         namespace phx = boost::phoenix;
- using boost::spirit::arg_names::_1;
 
         std::vector<char> v;
         BOOST_TEST(test("bbbb", (+char_)[phx::ref(v) = _1]) && 4 == v.size() &&
@@ -86,7 +96,6 @@
 
     { // more actions
         namespace phx = boost::phoenix;
- using boost::spirit::arg_names::_1;
 
         std::vector<int> v;
         BOOST_TEST(test("1 2 3", (+int_)[phx::ref(v) = _1], space) && 3 == v.size() &&

Modified: branches/release/libs/spirit/test/qi/range_run.cpp
==============================================================================
--- branches/release/libs/spirit/test/qi/range_run.cpp (original)
+++ branches/release/libs/spirit/test/qi/range_run.cpp 2009-09-14 12:45:39 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,7 @@
 #include <iostream>
 #include <cctype>
 #include <boost/detail/lightweight_test.hpp>
-#include <boost/spirit/home/qi/char/detail/range_run.hpp>
+#include <boost/spirit/home/support/char_set/range_run.hpp>
 #include <boost/random.hpp>
 #include <boost/dynamic_bitset.hpp>
 #include <boost/integer_traits.hpp>
@@ -23,8 +23,8 @@
         return; // don't do this test if we have a Char that's very big.
                 // the smaller chars will suffice for testing.
 
- using boost::spirit::qi::detail::range_run;
- using boost::spirit::qi::detail::range;
+ using boost::spirit::support::detail::range_run;
+ using boost::spirit::support::detail::range;
 
     typedef boost::integer_traits<Char> integer_traits;
     Char const const_min = integer_traits::const_min;
@@ -69,15 +69,15 @@
 int
 main()
 {
- using boost::spirit::qi::detail::range_run;
- using boost::spirit::qi::detail::range;
+ using boost::spirit::support::detail::range_run;
+ using boost::spirit::support::detail::range;
 
     {
         range_run<char> rr;
         rr.set(range<char>('a', 'a'));
         for (char c = 0; c < 127; ++c)
         {
- BOOST_TEST(c == 'a' == rr.test(c));
+ BOOST_TEST((c == 'a') == rr.test(c));
         }
     }
     {
@@ -95,7 +95,7 @@
         rr.set(range<char>(0, 0));
         for (char c = 0; c < 127; ++c)
         {
- BOOST_TEST(c == 0 == rr.test(c));
+ BOOST_TEST((c == 0) == rr.test(c));
         }
         rr.set(range<char>(0, 50));
         for (char c = 0; c < 127; ++c)
@@ -108,7 +108,7 @@
         rr.set(range<unsigned char>(255, 255));
         for (unsigned char c = 0; c < 255; ++c)
         {
- BOOST_TEST(c == 255 == rr.test(c));
+ BOOST_TEST((c == 255) == rr.test(c));
         }
         rr.set(range<unsigned char>(250, 255));
         for (unsigned char c = 0; c < 255; ++c)

Modified: branches/release/libs/spirit/test/qi/raw.cpp
==============================================================================
--- branches/release/libs/spirit/test/qi/raw.cpp (original)
+++ branches/release/libs/spirit/test/qi/raw.cpp 2009-09-14 12:45:39 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)
@@ -8,7 +8,7 @@
 #include <boost/spirit/include/qi_directive.hpp>
 #include <boost/spirit/include/qi_char.hpp>
 #include <boost/spirit/include/qi_operator.hpp>
-#include <boost/spirit/include/qi_nonterminal.hpp>
+#include <boost/spirit/include/qi_auxiliary.hpp>
 
 #include <iostream>
 #include <string>
@@ -17,16 +17,19 @@
 int
 main()
 {
+ using spirit_test::test;
     using spirit_test::test_attr;
- using namespace boost::spirit;
     using namespace boost::spirit::ascii;
- using boost::spirit::qi::rule;
+ using boost::spirit::qi::raw;
+ using boost::spirit::qi::eps;
 
     {
         boost::iterator_range<char const*> range;
         std::string str;
         BOOST_TEST((test_attr("spirit_test_123", raw[alpha >> *(alnum | '_')], range)));
         BOOST_TEST((std::string(range.begin(), range.end()) == "spirit_test_123"));
+ BOOST_TEST((test_attr(" spirit", raw[*alpha], range, space)));
+ BOOST_TEST((range.size() == 6));
     }
 
     {
@@ -35,5 +38,12 @@
         BOOST_TEST((str == "spirit_test_123"));
     }
 
+ {
+ boost::iterator_range<char const*> range;
+ BOOST_TEST((test("x", raw[alpha])));
+ BOOST_TEST((test_attr("x", raw[alpha], range)));
+ //~ BOOST_TEST((test_attr("x", raw[alpha] >> eps, range)));
+ }
+
     return boost::report_errors();
 }

Modified: branches/release/libs/spirit/test/qi/real.cpp
==============================================================================
--- branches/release/libs/spirit/test/qi/real.cpp (original)
+++ branches/release/libs/spirit/test/qi/real.cpp 2009-09-14 12:45:39 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
 
     Use, modification and distribution is subject to the Boost Software
@@ -12,11 +12,10 @@
 #include <boost/spirit/include/qi_char.hpp>
 #include <boost/spirit/include/qi_numeric.hpp>
 #include <boost/spirit/include/qi_operator.hpp>
-#include <boost/spirit/home/support/detail/math/fpclassify.hpp>
-#include <boost/spirit/home/support/detail/math/signbit.hpp>
+#include <boost/math/special_functions/fpclassify.hpp>
+#include <boost/math/special_functions/sign.hpp>
 
 #include "test.hpp"
-using namespace spirit_test;
 
 ///////////////////////////////////////////////////////////////////////////////
 // These policies can be used to parse thousand separated
@@ -56,11 +55,11 @@
     static bool
     parse_n(Iterator& first, Iterator const& last, Attribute& attr)
     {
- using namespace boost::spirit::qi;
- using namespace boost::spirit;
+ using boost::spirit::qi::uint_parser;
+ namespace qi = boost::spirit::qi;
 
- uint_spec<unsigned, 10, 1, 3> uint3;
- uint_spec<unsigned, 10, 3, 3> uint3_3;
+ uint_parser<unsigned, 10, 1, 3> uint3;
+ uint_parser<unsigned, 10, 3, 3> uint3_3;
 
         T result = 0;
         if (parse(first, last, uint3, result))
@@ -69,7 +68,7 @@
             T n;
             Iterator save = first;
 
- while (parse(first, last, ',') && parse(first, last, uint3_3, n))
+ while (qi::parse(first, last, ',') && qi::parse(first, last, uint3_3, n))
             {
                 result = result * 1000 + n;
                 save = first;
@@ -101,23 +100,41 @@
 bool
 compare(T n, double expected)
 {
- double const eps = 0.00001;
+ T const eps = std::pow(10.0, -std::numeric_limits<T>::digits10);
     T delta = n - expected;
     return (delta >= -eps) && (delta <= eps);
 }
 
+///////////////////////////////////////////////////////////////////////////////
+// A custom real type
+struct custom_real
+{
+ double n;
+ custom_real() : n(0) {}
+ custom_real(double n_) : n(n_) {}
+ friend custom_real operator*(custom_real a, custom_real b)
+ { return custom_real(a.n * b.n); }
+ friend custom_real operator+(custom_real a, custom_real b)
+ { return custom_real(a.n + b.n); }
+ friend custom_real operator-(custom_real a, custom_real b)
+ { return custom_real(a.n - b.n); }
+};
+
 int
 main()
 {
+ using spirit_test::test;
+ using spirit_test::test_attr;
+
     ///////////////////////////////////////////////////////////////////////////////
     // thousand separated numbers
     ///////////////////////////////////////////////////////////////////////////////
     {
- using boost::spirit::qi::uint_spec;
+ using boost::spirit::qi::uint_parser;
         using boost::spirit::qi::parse;
 
- uint_spec<unsigned, 10, 1, 3> uint3;
- uint_spec<unsigned, 10, 3, 3> uint3_3;
+ uint_parser<unsigned, 10, 1, 3> uint3;
+ uint_parser<unsigned, 10, 3, 3> uint3_3;
 
     #define r (uint3 >> *(',' >> uint3_3))
 
@@ -133,11 +150,11 @@
     // unsigned real number tests
     ///////////////////////////////////////////////////////////////////////////////
     {
- using boost::spirit::qi::real_spec;
+ using boost::spirit::qi::real_parser;
         using boost::spirit::qi::parse;
         using boost::spirit::qi::ureal_policies;
 
- real_spec<double, ureal_policies<double> > udouble;
+ real_parser<double, ureal_policies<double> > udouble;
         double d;
 
         BOOST_TEST(test("1234", udouble));
@@ -204,7 +221,7 @@
 // signed real number tests
 ///////////////////////////////////////////////////////////////////////////////
     {
- using boost::spirit::double_;
+ using boost::spirit::qi::double_;
         using boost::spirit::qi::parse;
         double d;
 
@@ -238,8 +255,21 @@
         BOOST_TEST(!test("-1.2e", double_));
         BOOST_TEST(!test_attr("-1.2e", double_, d));
 
- using boost::spirit::math::fpclassify;
- using boost::spirit::math::signbit;
+ BOOST_TEST(test_attr("-5.7222349715140557e+307", double_, d));
+ BOOST_TEST(d == -5.7222349715140557e+307); // exact!
+
+ BOOST_TEST(test_attr("2.0332938517515416e-308", double_, d));
+ BOOST_TEST(d == 2.0332938517515416e-308); // exact!
+
+ BOOST_TEST(test_attr("20332938517515416e291", double_, d));
+ BOOST_TEST(d == 20332938517515416e291); // exact!
+
+ BOOST_TEST(test_attr("2.0332938517515416e307", double_, d));
+ BOOST_TEST(d == 2.0332938517515416e307); // exact!
+
+ using boost::math::fpclassify;
+ using boost::spirit::detail::signbit; // Boost version is broken
+
         BOOST_TEST(test("-inf", double_));
         BOOST_TEST(test("-infinity", double_));
         BOOST_TEST(test_attr("-inf", double_, d) &&
@@ -272,13 +302,13 @@
     // strict real number tests
     ///////////////////////////////////////////////////////////////////////////////
     {
- using boost::spirit::qi::real_spec;
+ using boost::spirit::qi::real_parser;
         using boost::spirit::qi::parse;
         using boost::spirit::qi::strict_ureal_policies;
         using boost::spirit::qi::strict_real_policies;
 
- real_spec<double, strict_ureal_policies<double> > strict_udouble;
- real_spec<double, strict_real_policies<double> > strict_double;
+ real_parser<double, strict_ureal_policies<double> > strict_udouble;
+ real_parser<double, strict_real_policies<double> > strict_double;
         double d;
 
         BOOST_TEST(!test("1234", strict_udouble));
@@ -296,8 +326,8 @@
         BOOST_TEST(test("3.E6", strict_double));
         BOOST_TEST(test_attr("3.E6", strict_double, d) && compare(d, 3e6));
 
- real_spec<double, no_trailing_dot_policy<double> > notrdot_real;
- real_spec<double, no_leading_dot_policy<double> > nolddot_real;
+ real_parser<double, no_trailing_dot_policy<double> > notrdot_real;
+ real_parser<double, no_leading_dot_policy<double> > nolddot_real;
 
         BOOST_TEST(!test("1234.", notrdot_real)); // Bad trailing dot
         BOOST_TEST(!test(".1234", nolddot_real)); // Bad leading dot
@@ -307,9 +337,9 @@
     // Special thousands separated numbers
     ///////////////////////////////////////////////////////////////////////////
     {
- using boost::spirit::qi::real_spec;
+ using boost::spirit::qi::real_parser;
         using boost::spirit::qi::parse;
- real_spec<double, ts_real_policies<double> > ts_real;
+ real_parser<double, ts_real_policies<double> > ts_real;
         double d;
 
         BOOST_TEST(test("123,456,789.01", ts_real));
@@ -332,13 +362,13 @@
     ///////////////////////////////////////////////////////////////////////////
     {
         using boost::math::concepts::real_concept;
- using boost::spirit::qi::real_spec;
+ using boost::spirit::qi::real_parser;
         using boost::spirit::qi::real_policies;
         using boost::spirit::qi::parse;
-
- real_spec<real_concept, real_policies<real_concept> > custom_real;
+
+ real_parser<real_concept, real_policies<real_concept> > custom_real;
         real_concept d;
-
+
         BOOST_TEST(test("-1234", custom_real));
         BOOST_TEST(test_attr("-1234", custom_real, d) && compare(d, -1234));
 
@@ -370,5 +400,15 @@
         BOOST_TEST(!test_attr("-1.2e", custom_real, d));
     }
     
+ ///////////////////////////////////////////////////////////////////////////
+ // custom real tests
+ ///////////////////////////////////////////////////////////////////////////
+ //~ {
+ //~ using boost::spirit::qi::double_;
+ //~ custom_real n;
+
+ //~ BOOST_TEST(test_attr("-123456e6", double_, n));
+ //~ }
+
     return boost::report_errors();
 }

Modified: branches/release/libs/spirit/test/qi/rule.cpp
==============================================================================
--- branches/release/libs/spirit/test/qi/rule.cpp (original)
+++ branches/release/libs/spirit/test/qi/rule.cpp 2009-09-14 12:45:39 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)
@@ -9,23 +9,37 @@
 #include <boost/spirit/include/qi_char.hpp>
 #include <boost/spirit/include/qi_string.hpp>
 #include <boost/spirit/include/qi_numeric.hpp>
+#include <boost/spirit/include/qi_auxiliary.hpp>
 #include <boost/spirit/include/qi_nonterminal.hpp>
 #include <boost/spirit/include/qi_action.hpp>
 #include <boost/spirit/include/phoenix_core.hpp>
 #include <boost/spirit/include/phoenix_operator.hpp>
 #include <boost/spirit/include/phoenix_object.hpp>
+#include <boost/spirit/include/phoenix_bind.hpp>
+#include <boost/fusion/include/std_pair.hpp>
 
 #include <string>
+#include <cstring>
 #include <iostream>
 #include "test.hpp"
 
-using namespace spirit_test;
-
 int
 main()
 {
- using namespace boost::spirit::qi;
+ using spirit_test::test_attr;
+ using spirit_test::test;
+
     using namespace boost::spirit::ascii;
+ using namespace boost::spirit::qi::labels;
+ using boost::spirit::qi::locals;
+ using boost::spirit::qi::rule;
+ using boost::spirit::qi::int_;
+ using boost::spirit::qi::fail;
+ using boost::spirit::qi::on_error;
+ using boost::spirit::qi::debug;
+
+ namespace phx = boost::phoenix;
+
 
     { // basic tests
 
@@ -35,33 +49,116 @@
         b = 'b';
         c = 'c';
 
+ a.name("a");
+ b.name("b");
+ c.name("c");
+ start.name("start");
+
+ debug(a);
+ debug(b);
+ debug(c);
+ debug(start);
+
         start = *(a | b | c);
         BOOST_TEST(test("abcabcacb", start));
 
         start = (a | b) >> (start | b);
         BOOST_TEST(test("aaaabababaaabbb", start));
         BOOST_TEST(test("aaaabababaaabba", start, false));
+
+ // ignore the skipper!
+ BOOST_TEST(test("aaaabababaaabba", start, space, false));
     }
 
- { // basic tests w/ skipper
+ { // basic tests with direct initialization
+
+ rule<char const*> a ('a');
+ rule<char const*> b ('b');
+ rule<char const*> c ('c');
+ rule<char const*> start = (a | b) >> (start | b);
 
+ BOOST_TEST(test("aaaabababaaabbb", start));
+ BOOST_TEST(test("aaaabababaaabba", start, false));
+
+ // ignore the skipper!
+ BOOST_TEST(test("aaaabababaaabba", start, space, false));
+ }
+
+ { // basic tests w/ skipper
         rule<char const*, space_type> a, b, c, start;
 
         a = 'a';
         b = 'b';
         c = 'c';
 
- start = *(a | b | c);
- BOOST_TEST(test(" a b c a b c a c b", start, space));
+ a.name("a");
+ b.name("b");
+ c.name("c");
+ start.name("start");
+
+ debug(a);
+ debug(b);
+ debug(c);
+ debug(start);
 
- // allow no skipping too:
- BOOST_TEST(test("abcabcacb", start));
+ start = *(a | b | c);
+ BOOST_TEST(test(" a b c a b c a c b ", start, space));
 
         start = (a | b) >> (start | b);
         BOOST_TEST(test(" a a a a b a b a b a a a b b b ", start, space));
         BOOST_TEST(test(" a a a a b a b a b a a a b b a ", start, space, false));
     }
 
+ { // basic tests w/ skipper but no final post-skip
+
+ rule<char const*, space_type> a, b, c, start;
+
+ a = 'a';
+ b = 'b';
+ c = 'c';
+
+ a.name("a");
+ b.name("b");
+ c.name("c");
+ start.name("start");
+
+ debug(a);
+ debug(b);
+ debug(c);
+ debug(start);
+
+ start = *(a | b) >> c;
+
+ using boost::spirit::qi::phrase_parse;
+ using boost::spirit::qi::skip_flag;
+ {
+ char const *s1 = " a b a a b b a c ... "
+ , *const e1 = s1 + std::strlen(s1);
+ BOOST_TEST(phrase_parse(s1, e1, start, space, skip_flag::dont_postskip)
+ && s1 == e1 - 5);
+ }
+
+ start = (a | b) >> (start | c);
+ {
+ char const *s1 = " a a a a b a b a b a a a b b b c "
+ , *const e1 = s1 + std::strlen(s1);
+ BOOST_TEST(phrase_parse(s1, e1, start, space, skip_flag::postskip)
+ && s1 == e1);
+ }
+ {
+ char const *s1 = " a a a a b a b a b a a a b b b c "
+ , *const e1 = s1 + std::strlen(s1);
+ BOOST_TEST(phrase_parse(s1, e1, start, space, skip_flag::dont_postskip)
+ && s1 == e1 - 1);
+ }
+ }
+
+ { // test unassigned rule
+
+ rule<char const*> a;
+ BOOST_TEST(!test("x", a));
+ }
+
     { // alias tests
 
         rule<char const*> a, b, c, d, start;
@@ -105,36 +202,78 @@
 
     { // context tests
 
- using namespace boost::phoenix;
- using namespace boost::spirit::ascii;
- using boost::spirit::arg_names::_1;
- using boost::spirit::arg_names::_val;
-
         char ch;
         rule<char const*, char()> a;
         a = alpha[_val = _1];
 
- BOOST_TEST(test("x", a[ref(ch) = _1]));
+ BOOST_TEST(test("x", a[phx::ref(ch) = _1]));
         BOOST_TEST(ch == 'x');
 
         BOOST_TEST(test_attr("z", a, ch)); // attribute is given.
         BOOST_TEST(ch == 'z');
     }
 
- { // context (w/arg) tests
+ { // auto rules tests
 
- using namespace boost::phoenix;
- using namespace boost::spirit::ascii;
- using boost::spirit::arg_names::_1;
- using boost::spirit::arg_names::_r1;
- using boost::spirit::arg_names::_r2;
- using boost::spirit::arg_names::_val;
+ char ch;
+ rule<char const*, char()> a;
+ a %= alpha;
+
+ BOOST_TEST(test("x", a[phx::ref(ch) = _1]));
+ BOOST_TEST(ch == 'x');
+
+ BOOST_TEST(test_attr("z", a, ch)); // attribute is given.
+ BOOST_TEST(ch == 'z');
+ }
+
+ { // auto rules tests: allow stl containers as attributes to
+ // sequences (in cases where attributes of the elements
+ // are convertible to the value_type of the container or if
+ // the element itself is an stl container with value_type
+ // that is convertible to the value_type of the attribute).
+
+ std::string s;
+ rule<char const*, std::string()> r;
+ r %= char_ >> *(',' >> char_);
+
+ BOOST_TEST(test("a,b,c,d,e,f", r[phx::ref(s) = _1]));
+ BOOST_TEST(s == "abcdef");
+
+ r %= char_ >> char_ >> char_ >> char_ >> char_ >> char_;
+ BOOST_TEST(test("abcdef", r[phx::ref(s) = _1]));
+ BOOST_TEST(s == "abcdef");
+ }
+
+ { // synth attribute value-init
+
+ std::string s;
+ rule<char const*, char()> r;
+ r = alpha[_val += _1];
+ BOOST_TEST(test_attr("abcdef", +r, s));
+ BOOST_TEST(s == "abcdef");
+ }
+
+ { // auto rules aliasing tests
+
+ char ch;
+ rule<char const*, char()> a, b;
+ a %= b;
+ b %= alpha;
+
+ BOOST_TEST(test("x", a[phx::ref(ch) = _1]));
+ BOOST_TEST(ch == 'x');
+
+ BOOST_TEST(test_attr("z", a, ch)); // attribute is given.
+ BOOST_TEST(ch == 'z');
+ }
+
+ { // context (w/arg) tests
 
         char ch;
         rule<char const*, char(int)> a; // 1 arg
         a = alpha[_val = _1 + _r1];
 
- BOOST_TEST(test("x", a(val(1))[ref(ch) = _1]));
+ BOOST_TEST(test("x", a(phx::val(1))[phx::ref(ch) = _1]));
         BOOST_TEST(ch == 'x' + 1);
 
         BOOST_TEST(test_attr("a", a(1), ch)); // allow scalars as rule args too.
@@ -146,13 +285,17 @@
         BOOST_TEST(ch == 'a' + 1 + 2);
     }
 
+ { // context (w/ reference arg) tests
+
+ char ch;
+ rule<char const*, void(char&)> a; // 1 arg (reference)
+ a = alpha[_r1 = _1];
+
+ BOOST_TEST(test("x", a(phx::ref(ch))));
+ BOOST_TEST(ch == 'x');
+ }
+
     { // context (w/locals) tests
- using namespace boost::phoenix;
- using namespace boost::spirit::ascii;
- using boost::spirit::arg_names::_1;
- using boost::spirit::arg_names::_a;
- using boost::spirit::char_;
- using boost::spirit::locals;
 
         rule<char const*, locals<char> > a; // 1 local
         a = alpha[_a = _1] >> char_(_a);
@@ -161,28 +304,25 @@
     }
 
     { // context (w/args and locals) tests
- using namespace boost::phoenix;
- using namespace boost::spirit::ascii;
- using boost::spirit::arg_names::_1;
- using boost::spirit::arg_names::_r1;
- using boost::spirit::arg_names::_a;
- using boost::spirit::char_;
- using boost::spirit::locals;
 
         rule<char const*, void(int), locals<char> > a; // 1 arg + 1 local
         a = alpha[_a = _1 + _r1] >> char_(_a);
- BOOST_TEST(test("ab", a(val(1))));
- BOOST_TEST(test("xy", a(val(1))));
- BOOST_TEST(!test("ax", a(val(1))));
+ BOOST_TEST(test("ab", a(phx::val(1))));
+ BOOST_TEST(test("xy", a(phx::val(1))));
+ BOOST_TEST(!test("ax", a(phx::val(1))));
+ }
+
+ { // void() has unused type (void == unused_type)
+
+ std::pair<int, char> attr;
+ rule<char const*, void()> r;
+ r = char_;
+ BOOST_TEST(test_attr("123ax", int_ >> char_ >> r, attr));
+ BOOST_TEST(attr.first == 123);
+ BOOST_TEST(attr.second == 'a');
     }
 
     { // bug: test that injected attributes are ok
- using namespace boost::phoenix;
- using namespace boost::spirit::ascii;
- using boost::spirit::arg_names::_1;
- using boost::spirit::arg_names::_r1;
- using boost::spirit::arg_names::_val;
- using boost::spirit::char_;
 
         rule<char const*, char(int) > r;
 
@@ -190,16 +330,37 @@
         r = char_(_r1)[_val = _1];
     }
 
+ { // show that ra = rb and ra %= rb works as expected
+ rule<char const*, int() > ra, rb;
+ int attr;
+
+ ra %= int_;
+ BOOST_TEST(test_attr("123", ra, attr));
+ BOOST_TEST(attr == 123);
+
+ rb %= ra;
+ BOOST_TEST(test_attr("123", rb, attr));
+ BOOST_TEST(attr == 123);
+
+ rb = ra;
+ BOOST_TEST(test_attr("123", rb, attr));
+ BOOST_TEST(attr == 123);
+ }
+
+ { // std::string as container attribute with auto rules
+
+ rule<char const*, std::string()> text;
+ text %= +(!char_(')') >> !char_('>') >> char_);
+ std::string attr;
+ BOOST_TEST(test_attr("x", text, attr));
+ BOOST_TEST(attr == "x");
+ }
+
     { // error handling
 
- using namespace boost::phoenix;
         using namespace boost::spirit::ascii;
- using boost::phoenix::val;
- using boost::spirit::int_;
- using boost::spirit::arg_names::_4; // what
- using boost::spirit::arg_names::_3; // error pos
- using boost::spirit::arg_names::_2; // end
- using boost::spirit::qi::fail;
+ using boost::phoenix::construct;
+ using boost::phoenix::bind;
 
         rule<char const*> r;
         r = '(' > int_ > ',' > int_ > ')';
@@ -207,11 +368,11 @@
         on_error<fail>
         (
             r, std::cout
- << val("Error! Expecting: ")
+ << phx::val("Error! Expecting: ")
                 << _4
- << val(" Here: \"")
+ << phx::val(", got: \"")
                 << construct<std::string>(_3, _2)
- << val("\"")
+ << phx::val("\"")
                 << std::endl
         );
 

Modified: branches/release/libs/spirit/test/qi/sequence.cpp
==============================================================================
--- branches/release/libs/spirit/test/qi/sequence.cpp (original)
+++ branches/release/libs/spirit/test/qi/sequence.cpp 2009-09-14 12:45:39 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)
@@ -11,9 +11,8 @@
 #include <boost/spirit/include/qi_numeric.hpp>
 #include <boost/spirit/include/qi_directive.hpp>
 #include <boost/spirit/include/qi_action.hpp>
+#include <boost/spirit/include/qi_nonterminal.hpp>
 #include <boost/spirit/include/support_argument.hpp>
-#include <boost/fusion/include/vector.hpp>
-#include <boost/fusion/include/at.hpp>
 #include <boost/spirit/include/phoenix_core.hpp>
 #include <boost/spirit/include/phoenix_operator.hpp>
 #include <boost/spirit/include/phoenix_statement.hpp>
@@ -25,12 +24,22 @@
 int
 main()
 {
- using namespace boost::spirit;
     using namespace boost::spirit::ascii;
+ using boost::spirit::qi::lit;
+ using boost::spirit::qi::unused;
+ using boost::spirit::qi::int_;
+ using boost::spirit::qi::double_;
+ using boost::spirit::qi::what;
+ using boost::spirit::qi::rule;
+ using boost::spirit::qi::_1;
+ using boost::spirit::qi::_2;
+
     using boost::fusion::vector;
     using boost::fusion::at_c;
+
     using spirit_test::test;
     using spirit_test::test_attr;
+ using spirit_test::print_info;
 
     {
         BOOST_TEST((test("aa", char_ >> char_)));
@@ -42,9 +51,9 @@
     }
 
     {
- BOOST_TEST((test(" a a ", char_ >> char_, space)));
- BOOST_TEST((test(" x i ", char_('x') >> char_('i'), space)));
- BOOST_TEST((!test(" x i ", char_('x') >> char_('o'), space)));
+ BOOST_TEST((test(" a a", char_ >> char_, space)));
+ BOOST_TEST((test(" x i", char_('x') >> char_('i'), space)));
+ BOOST_TEST((!test(" x i", char_('x') >> char_('o'), space)));
     }
 
     {
@@ -60,7 +69,7 @@
 
     {
         vector<char, char, char> attr;
- BOOST_TEST((test_attr(" a\n b\n c\n ", char_ >> char_ >> char_, attr, space)));
+ BOOST_TEST((test_attr(" a\n b\n c", char_ >> char_ >> char_, attr, space)));
         BOOST_TEST((at_c<0>(attr) == 'a'));
         BOOST_TEST((at_c<1>(attr) == 'b'));
         BOOST_TEST((at_c<2>(attr) == 'c'));
@@ -75,47 +84,6 @@
     }
 
     {
- // omit[] means we don't receive the attribute
- vector<char> attr;
- BOOST_TEST((test_attr("abc", omit[char_] >> omit['b'] >> char_, attr)));
- BOOST_TEST((at_c<0>(attr) == 'c'));
- }
-
- {
- // If all elements except 1 is omitted, the attribute is
- // a single-element sequence. For this case alone, we allow
- // naked attributes (unwrapped in a fusion sequence).
- char attr;
- BOOST_TEST((test_attr("abc", omit[char_] >> 'b' >> char_, attr)));
- BOOST_TEST((attr == 'c'));
- }
-
- {
- // omit[] means we don't receive the attribute
- vector<> attr;
- BOOST_TEST((test_attr("abc", omit[char_] >> omit['b'] >> omit[char_], attr)));
- }
-
- {
- // omit[] means we don't receive the attribute
- // this test is merely a compile test, because using a unused as the
- // explicit attribute doesn't make any sense
- unused_type attr;
- BOOST_TEST((test_attr("abc", omit[char_ >> 'b' >> char_], attr)));
- }
-
- {
- // omit[] means we don't receive the attribute, if all elements of a
- // sequence have unused attributes, the whole sequence has an unused
- // attribute as well
- vector<char, char> attr;
- BOOST_TEST((test_attr("abcde",
- char_ >> (omit[char_] >> omit['c'] >> omit[char_]) >> char_, attr)));
- BOOST_TEST((at_c<0>(attr) == 'a'));
- BOOST_TEST((at_c<1>(attr) == 'e'));
- }
-
- {
         // "hello" has an unused_type. unused attrubutes are not part of the sequence
         vector<char, char> attr;
         BOOST_TEST((test_attr("a hello c", char_ >> "hello" >> char_, attr, space)));
@@ -124,18 +92,20 @@
     }
 
     {
- // omit[] means we don't receive the attribute
- vector<char> attr;
- BOOST_TEST((test_attr("a hello c", char_ >> "hello" >> omit[char_], attr, space)));
- BOOST_TEST((at_c<0>(attr) == 'a'));
+ // a single element
+ char attr;
+ BOOST_TEST((test_attr("ab", char_ >> 'b', attr)));
+ BOOST_TEST((attr == 'a'));
     }
 
     {
- // if only one node in a sequence is left (all the others are omitted),
- // then we should also allow "naked" attributes (unwraped in a tuple)
- int attr;
- BOOST_TEST((test_attr("a 123 c", omit['a'] >> int_ >> omit['c'], attr, space)));
- BOOST_TEST((attr == 123));
+ // make sure single element tuples get passed through if the rhs
+ // has a single element tuple as its attribute
+ vector<double, int> fv;
+ rule<char const*, vector<double, int>()> r;
+ r %= double_ >> ',' >> int_;
+ BOOST_TEST((test_attr("test:2.0,1", "test:" >> r, fv) &&
+ fv == vector<double, int>(2.0, 1)));
     }
 
     {
@@ -150,14 +120,36 @@
     }
 
     {
-#ifdef SPIRIT_TEST_COMPILE_FAIL // $$$
+#ifdef SPIRIT_NO_COMPILE_CHECK
         char_ >> char_ = char_ >> char_; // disallow this!
 #endif
     }
 
+ { // alternative forms of attributes. Allow sequences to take in
+ // stl containers.
+
+ std::vector<char> v;
+ BOOST_TEST(test_attr("abc", char_ >> char_ >> char_, v));
+ BOOST_TEST(v.size() == 3);
+ BOOST_TEST(v[0] == 'a');
+ BOOST_TEST(v[1] == 'b');
+ BOOST_TEST(v[2] == 'c');
+ }
+
+ { // alternative forms of attributes. Allow sequences to take in
+ // stl containers.
+
+ std::vector<char> v;
+ BOOST_TEST(test_attr("a,b,c", char_ >> *(',' >> char_), v));
+ BOOST_TEST(v.size() == 3);
+ BOOST_TEST(v[0] == 'a');
+ BOOST_TEST(v[1] == 'b');
+ BOOST_TEST(v[2] == 'c');
+
+ }
+
     { // test action
- using namespace boost::phoenix;
- using namespace boost::spirit::arg_names;
+ using boost::phoenix::ref;
         char c = 0;
         int n = 0;
 
@@ -167,19 +159,8 @@
         BOOST_TEST(n == 123);
     }
 
- { // test action with omitted attribute
- using namespace boost::phoenix;
- using namespace boost::spirit::arg_names;
- char c = 0;
-
- BOOST_TEST(test("x123\"a string\"", (char_ >> omit[int_] >> "\"a string\"")
- [ref(c) = _1]));
- BOOST_TEST(c == 'x');
- }
-
     { // test action
- using namespace boost::phoenix;
- using namespace boost::spirit::arg_names;
+ using boost::phoenix::ref;
         char c = 0;
         int n = 0;
 
@@ -189,14 +170,9 @@
         BOOST_TEST(n == 123);
     }
 
- { // test action with omitted attribute
- using namespace boost::phoenix;
- using namespace boost::spirit::arg_names;
- int n = 0;
+ { // testing "what"
 
- BOOST_TEST(test("x 123 \"a string\"",
- (omit[char_] >> int_ >> "\"a string\"")[ref(n) = _1], space));
- BOOST_TEST(n == 123);
+ print_info(what(alpha | char_('x') >> lit("hello") >> int_));
     }
 
     return boost::report_errors();

Modified: branches/release/libs/spirit/test/qi/sequential_or.cpp
==============================================================================
--- branches/release/libs/spirit/test/qi/sequential_or.cpp (original)
+++ branches/release/libs/spirit/test/qi/sequential_or.cpp 2009-09-14 12:45:39 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)
@@ -22,12 +22,16 @@
 #include <iostream>
 #include "test.hpp"
 
-using namespace spirit_test;
-
 int
 main()
 {
- using namespace boost::spirit;
+ using spirit_test::test;
+ using spirit_test::test_attr;
+
+ using boost::spirit::qi::int_;
+ using boost::spirit::qi::_1;
+ using boost::spirit::qi::_2;
+ using boost::spirit::ascii::char_;
     using boost::spirit::ascii::alpha;
     using boost::fusion::vector;
     using boost::fusion::at_c;
@@ -59,9 +63,22 @@
         BOOST_TEST((!test("a123", int_ || alpha)));
     }
 
+ { // test unused attribute handling
+
+ vector<optional<int>, optional<char> > attr;
+ BOOST_TEST((test_attr("123ab", int_ || ("a" >> char_), attr)));
+ BOOST_TEST((at_c<0>(attr).get() == 123));
+ BOOST_TEST((at_c<1>(attr).get() == 'b'));
+ }
+
+ { // test unused attribute handling
+
+ optional<int> attr;
+ BOOST_TEST((test_attr("123a", int_ || "a", attr)));
+ BOOST_TEST((attr == 123));
+ }
+
     { // test action
- using namespace boost::phoenix;
- using namespace boost::spirit::arg_names;
         namespace phx = boost::phoenix;
 
         optional<int> i;

Modified: branches/release/libs/spirit/test/qi/symbols.cpp
==============================================================================
--- branches/release/libs/spirit/test/qi/symbols.cpp (original)
+++ branches/release/libs/spirit/test/qi/symbols.cpp 2009-09-14 12:45:39 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)
@@ -8,7 +8,10 @@
 #include <boost/spirit/include/qi_string.hpp>
 #include <boost/spirit/include/qi_char.hpp>
 #include <boost/spirit/include/qi_action.hpp>
+#include <boost/spirit/include/qi_auxiliary.hpp>
 #include <boost/spirit/include/qi_directive.hpp>
+#include <boost/spirit/include/qi_operator.hpp>
+#include <boost/spirit/include/qi_nonterminal.hpp>
 #include <boost/spirit/include/support_argument.hpp>
 #include <boost/spirit/include/phoenix_core.hpp>
 #include <boost/spirit/include/phoenix_operator.hpp>
@@ -16,12 +19,27 @@
 #include <iostream>
 #include "test.hpp"
 
+// Custom string type with a C-style string conversion.
+struct custom_string_c
+{
+ custom_string_c(char c) { str[0] = c; str[1] = '\0'; }
+
+ operator char*() { return str; }
+ operator char const*() const { return str; }
+
+private:
+ char str[2];
+};
+
 int
 main()
 {
     using spirit_test::test;
     using spirit_test::test_attr;
- using namespace boost::spirit::qi;
+ using boost::spirit::qi::symbols;
+ using boost::spirit::qi::rule;
+ using boost::spirit::qi::lazy;
+ using boost::spirit::qi::_r1;
 
     { // basics
         symbols<char, int> sym;
@@ -35,6 +53,8 @@
             ("Joey")
         ;
 
+ boost::mpl::true_ f = boost::mpl::bool_<boost::spirit::traits::is_parser<symbols<char, int> >::value>();
+
         BOOST_TEST((test("Joel", sym)));
         BOOST_TEST((test("Ruby", sym)));
         BOOST_TEST((test("Tenji", sym)));
@@ -43,6 +63,20 @@
         BOOST_TEST((test("Joey", sym)));
         BOOST_TEST((!test("XXX", sym)));
 
+ // test copy
+ symbols<char, int> sym2;
+ sym2 = sym;
+ BOOST_TEST((test("Joel", sym2)));
+ BOOST_TEST((test("Ruby", sym2)));
+ BOOST_TEST((test("Tenji", sym2)));
+ BOOST_TEST((test("Tutit", sym2)));
+ BOOST_TEST((test("Kim", sym2)));
+ BOOST_TEST((test("Joey", sym2)));
+ BOOST_TEST((!test("XXX", sym2)));
+
+ // make sure it plays well with other parsers
+ BOOST_TEST((test("Joelyo", sym >> "yo")));
+
         sym.remove
             ("Joel")
             ("Ruby")
@@ -90,6 +124,9 @@
         BOOST_TEST((test("TUTIT", no_case[sym])));
         BOOST_TEST((test("KIM", no_case[sym])));
         BOOST_TEST((test("JOEY", no_case[sym])));
+
+ // make sure it plays well with other parsers
+ BOOST_TEST((test("Joelyo", no_case[sym] >> "yo")));
     }
 
     { // attributes
@@ -118,11 +155,17 @@
         BOOST_TEST((test_attr("Joey", sym, i)));
         BOOST_TEST(i == 6);
         BOOST_TEST((!test_attr("XXX", sym, i)));
+
+ // double add:
+
+ sym.add("Joel", 265);
+ BOOST_TEST((test_attr("Joel", sym, i)));
+ BOOST_TEST(i == 1);
     }
 
     { // actions
- using namespace boost::phoenix;
- using boost::spirit::arg_names::_1;
+ namespace phx = boost::phoenix;
+ using boost::spirit::_1;
 
         symbols<char, int> sym;
         sym.add
@@ -135,19 +178,19 @@
         ;
 
         int i;
- BOOST_TEST((test("Joel", sym[ref(i) = _1])));
+ BOOST_TEST((test("Joel", sym[phx::ref(i) = _1])));
         BOOST_TEST(i == 1);
- BOOST_TEST((test("Ruby", sym[ref(i) = _1])));
+ BOOST_TEST((test("Ruby", sym[phx::ref(i) = _1])));
         BOOST_TEST(i == 2);
- BOOST_TEST((test("Tenji", sym[ref(i) = _1])));
+ BOOST_TEST((test("Tenji", sym[phx::ref(i) = _1])));
         BOOST_TEST(i == 3);
- BOOST_TEST((test("Tutit", sym[ref(i) = _1])));
+ BOOST_TEST((test("Tutit", sym[phx::ref(i) = _1])));
         BOOST_TEST(i == 4);
- BOOST_TEST((test("Kim", sym[ref(i) = _1])));
+ BOOST_TEST((test("Kim", sym[phx::ref(i) = _1])));
         BOOST_TEST(i == 5);
- BOOST_TEST((test("Joey", sym[ref(i) = _1])));
+ BOOST_TEST((test("Joey", sym[phx::ref(i) = _1])));
         BOOST_TEST(i == 6);
- BOOST_TEST((!test("XXX", sym[ref(i) = _1])));
+ BOOST_TEST((!test("XXX", sym[phx::ref(i) = _1])));
     }
 
     { // construction from symbol array
@@ -185,5 +228,54 @@
         BOOST_TEST((!test_attr("XXX", sym, i)));
     }
 
+ { // allow std::string and other string types
+ symbols<> sym;
+
+ // const and non-const std::string
+ std::string a("abc");
+ std::string const b("def");
+ sym += a;
+ sym += b;
+ BOOST_TEST((test("abc", sym)));
+ BOOST_TEST((test("def", sym)));
+ sym = a;
+ BOOST_TEST((test("abc", sym)));
+ BOOST_TEST((!test("def", sym)));
+
+ // non-const C-style string
+ char arr[2]; arr[0] = 'a'; arr[1] = '\0';
+ sym = arr;
+ BOOST_TEST((test("a", sym)));
+ BOOST_TEST((!test("b", sym)));
+
+ // const and non-const custom string type
+ custom_string_c c('x');
+ custom_string_c const cc('y');
+ sym = c, cc;
+ BOOST_TEST((test("x", sym)));
+ BOOST_TEST((test("y", sym)));
+ BOOST_TEST((!test("z", sym)));
+ }
+
+ {
+ namespace phx = boost::phoenix;
+
+ symbols<char, int> sym;
+ sym.add
+ ("a", 1)
+ ("b", 2)
+ ;
+
+ rule<char const*, int(symbols<char, int>&)> r;
+ r %= lazy(_r1);
+
+ int i = 0;
+ BOOST_TEST(test_attr("a", r(phx::ref(sym)), i));
+ BOOST_TEST(i == 1);
+ BOOST_TEST(test_attr("b", r(phx::ref(sym)), i));
+ BOOST_TEST(i == 2);
+ BOOST_TEST(!test("c", r(phx::ref(sym))));
+ }
+
     return boost::report_errors();
 }

Modified: branches/release/libs/spirit/test/qi/test.hpp
==============================================================================
--- branches/release/libs/spirit/test/qi/test.hpp (original)
+++ branches/release/libs/spirit/test/qi/test.hpp 2009-09-14 12:45:39 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_TEST_FEB_01_2007_0605PM)
-#define BOOST_SPIRIT_TEST_FEB_01_2007_0605PM
+#if !defined(BOOST_SPIRIT_TEST_FEBRUARY_01_2007_0605PM)
+#define BOOST_SPIRIT_TEST_FEBRUARY_01_2007_0605PM
 
 #include <boost/spirit/include/qi_parse.hpp>
 #include <boost/spirit/include/qi_what.hpp>
+#include <boost/variant/apply_visitor.hpp>
+#include <boost/foreach.hpp>
+#include <iostream>
 
 namespace spirit_test
 {
@@ -67,9 +70,34 @@
         Char const* last = in;
         while (*last)
             last++;
- return boost::spirit::qi::phrase_parse(in, last, p, attr, s)
+ return boost::spirit::qi::phrase_parse(in, last, p, s, attr)
             && (!full_match || (in == last));
     }
+
+ struct printer
+ {
+ typedef boost::spirit::utf8_string string;
+
+ void element(string const& tag, string const& value, int depth) const
+ {
+ for (int i = 0; i < (depth*4); ++i) // indent to depth
+ std::cout << ' ';
+
+ std::cout << "tag: " << tag;
+ if (value != "")
+ std::cout << ", value: " << value;
+ std::cout << std::endl;
+ }
+ };
+
+ void print_info(boost::spirit::info const& what)
+ {
+ using boost::spirit::basic_info_walker;
+
+ printer pr;
+ basic_info_walker<printer> walker(pr, what.tag, 0);
+ boost::apply_visitor(walker, what.value);
+ }
 }
 
 #endif

Modified: branches/release/libs/spirit/test/qi/tst.cpp
==============================================================================
--- branches/release/libs/spirit/test/qi/tst.cpp (original)
+++ branches/release/libs/spirit/test/qi/tst.cpp 2009-09-14 12:45:39 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)
@@ -341,10 +341,10 @@
     }
 }
 
-int
-main()
+int main()
 {
- using namespace boost::spirit::qi;
+ using boost::spirit::qi::tst;
+ using boost::spirit::qi::tst_map;
 
     tests<tst<char, int>, tst<wchar_t, int> >();
     tests<tst_map<char, int>, tst_map<wchar_t, int> >();

Modified: branches/release/libs/spirit/test/qi/uint.cpp
==============================================================================
--- branches/release/libs/spirit/test/qi/uint.cpp (original)
+++ branches/release/libs/spirit/test/qi/uint.cpp 2009-09-14 12:45:39 EDT (Mon, 14 Sep 2009)
@@ -1,6 +1,6 @@
 /*=============================================================================
- Copyright (c) 2001-2007 Joel de Guzman
- Copyright (c) 2001-2007 Hartmut Kaiser
+ 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)
@@ -15,6 +15,7 @@
 #include <boost/spirit/include/phoenix_operator.hpp>
 
 #include "test.hpp"
+#include <cstring>
 
 ///////////////////////////////////////////////////////////////////////////////
 //
@@ -37,35 +38,49 @@
     char const* max_hex = "FFFFFFFF";
     char const* hex_overflow = "100000000";
 
+///////////////////////////////////////////////////////////////////////////////
+// A custom int type
+struct custom_int
+{
+ int n;
+ custom_int() : n(0) {}
+ explicit custom_int(int n_) : n(n_) {}
+ custom_int& operator=(int n_) { n = n_; return *this; }
+ friend custom_int operator*(custom_int a, custom_int b)
+ { return custom_int(a.n * b.n); }
+ friend custom_int operator+(custom_int a, custom_int b)
+ { return custom_int(a.n + b.n); }
+};
+
 int
 main()
 {
- using namespace spirit_test;
-
+ using spirit_test::test;
+ using spirit_test::test_attr;
     ///////////////////////////////////////////////////////////////////////////
     // unsigned tests
     ///////////////////////////////////////////////////////////////////////////
     {
- using boost::spirit::uint;
+ using boost::spirit::qi::uint_;
         unsigned u;
 
- BOOST_TEST(test("123456", uint));
- BOOST_TEST(test_attr("123456", uint, u));
+ BOOST_TEST(test("123456", uint_));
+ BOOST_TEST(test_attr("123456", uint_, u));
         BOOST_TEST(u == 123456);
 
- BOOST_TEST(test(max_unsigned, uint));
- BOOST_TEST(test_attr(max_unsigned, uint, u));
+ BOOST_TEST(test(max_unsigned, uint_));
+ BOOST_TEST(test_attr(max_unsigned, uint_, u));
         BOOST_TEST(u == UINT_MAX);
 
- BOOST_TEST(!test(unsigned_overflow, uint));
- BOOST_TEST(!test_attr(unsigned_overflow, uint, u));
+ BOOST_TEST(!test(unsigned_overflow, uint_));
+ BOOST_TEST(!test_attr(unsigned_overflow, uint_, u));
     }
 
     ///////////////////////////////////////////////////////////////////////////
     // binary tests
     ///////////////////////////////////////////////////////////////////////////
     {
- using boost::spirit::bin;
+ using boost::spirit::qi::bin;
         unsigned u;
 
         BOOST_TEST(test("11111110", bin));
@@ -84,7 +99,7 @@
     // octal tests
     ///////////////////////////////////////////////////////////////////////////
     {
- using boost::spirit::oct;
+ using boost::spirit::qi::oct;
         unsigned u;
 
         BOOST_TEST(test("12545674515", oct));
@@ -103,7 +118,7 @@
     // hex tests
     ///////////////////////////////////////////////////////////////////////////
     {
- using boost::spirit::hex;
+ using boost::spirit::qi::hex;
         unsigned u;
 
         BOOST_TEST(test("95BC8DF", hex));
@@ -127,29 +142,41 @@
     ///////////////////////////////////////////////////////////////////////////
     {
         unsigned u;
- using boost::spirit::qi::uint_spec;
+ using boost::spirit::qi::uint_parser;
 
- uint_spec<unsigned, 10, 1, 3> uint3;
+ uint_parser<unsigned, 10, 1, 3> uint3;
         BOOST_TEST(test("123456", uint3, false));
         BOOST_TEST(test_attr("123456", uint3, u, false));
         BOOST_TEST(u == 123);
 
- uint_spec<unsigned, 10, 2, 4> uint4;
+ uint_parser<unsigned, 10, 2, 4> uint4;
         BOOST_TEST(test("123456", uint4, false));
         BOOST_TEST(test_attr("123456", uint4, u, false));
         BOOST_TEST(u == 1234);
 
+ char const * first = "0000000";
+ char const * last = first + std::strlen(first);
+ uint_parser<unsigned, 10, 4, 4> uint_exact4;
+ BOOST_TEST(boost::spirit::qi::parse(first, last, uint_exact4, u)
+ && first != last && (last-first == 3) && u == 0);
+
+ first = "0001400";
+ last = first + std::strlen(first);
+ BOOST_TEST(boost::spirit::qi::parse(first, last, uint_exact4, u)
+ && first != last && (last-first == 3) && u == 1);
+
         BOOST_TEST(!test("1", uint4));
         BOOST_TEST(!test_attr("1", uint4, u));
+ BOOST_TEST(test_attr("014567", uint4, u, false) && u == 145);
     }
 
     ///////////////////////////////////////////////////////////////////////////
- // uint_spec<unused_type> tests
+ // uint_parser<unused_type> tests
     ///////////////////////////////////////////////////////////////////////////
     {
- using boost::spirit::qi::uint_spec;
- using boost::spirit::unused_type;
- uint_spec<unused_type> any_int;
+ using boost::spirit::qi::uint_parser;
+ using boost::spirit::qi::unused_type;
+ uint_parser<unused_type> any_int;
 
         BOOST_TEST(test("123456", any_int));
         BOOST_TEST(test("1234567890123456789", any_int));
@@ -159,17 +186,41 @@
     // action tests
     ///////////////////////////////////////////////////////////////////////////
     {
- using namespace boost::phoenix;
- using boost::spirit::arg_names::_1;
+ using boost::phoenix::ref;
+ using boost::spirit::qi::_1;
+ using boost::spirit::qi::uint_;
         using boost::spirit::ascii::space;
- using boost::spirit::uint;
         int n;
 
- BOOST_TEST(test("123", uint[ref(n) = _1]));
+ BOOST_TEST(test("123", uint_[ref(n) = _1]));
         BOOST_TEST(n == 123);
- BOOST_TEST(test(" 456", uint[ref(n) = _1], space));
+ BOOST_TEST(test(" 456", uint_[ref(n) = _1], space));
         BOOST_TEST(n == 456);
     }
+
+ ///////////////////////////////////////////////////////////////////////////
+ // Check overflow is parse error
+ ///////////////////////////////////////////////////////////////////////////
+ {
+ using boost::spirit::qi::uint_;
+ boost::uint8_t u;
+
+ BOOST_TEST(!test_attr("999", uint_, u));
+ }
+
+ ///////////////////////////////////////////////////////////////////////////
+ // custom uint tests
+ ///////////////////////////////////////////////////////////////////////////
+ {
+ using boost::spirit::qi::uint_;
+ using boost::spirit::qi::uint_parser;
+ custom_int u;
+
+ BOOST_TEST(test_attr("123456", uint_, u));
+
+ uint_parser<custom_int, 10, 1, 2> uint2;
+ BOOST_TEST(test_attr("12", uint2, u));
+ }
 
     return boost::report_errors();
 }

Deleted: branches/release/libs/spirit/test/support/hold_any.cpp
==============================================================================
--- branches/release/libs/spirit/test/support/hold_any.cpp 2009-09-14 12:45:39 EDT (Mon, 14 Sep 2009)
+++ (empty file)
@@ -1,201 +0,0 @@
-// Copyright (c) 2007-2009 Hartmut Kaiser
-// Copyright (c) Christopher Diggins 2005
-//
-// Distributed under the Boost Software License, Version 1.0. (See accompanying
-// file LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt)
-
-// #define BOOST_SPIRIT_ANY_IMPLICIT_CASTING
-
-#include <cassert>
-#include <stdexcept>
-#include <typeinfo>
-#include <iostream>
-#include <vector>
-#include <complex>
-#include <string>
-
-#include <boost/detail/lightweight_test.hpp>
-#include <boost/spirit/home/support/detail/hold_any.hpp>
-
-using namespace std;
-using namespace boost::spirit;
-
-///////////////////////////////////////////////////////////////////////////////
-bool output_any (hold_any const& a, std::string expected)
-{
- std::ostringstream o;
- if (a.type() == typeid(int))
- {
- o << any_cast<int>(a);
- }
- else if (a.type() == typeid(char))
- {
- o << any_cast<char>(a);
- }
- else if (a.type() == typeid(double))
- {
- o << any_cast<double>(a);
- }
- else if (a.type() == typeid(std::complex<int>))
- {
- o << any_cast<std::complex<int> >(a);
- }
- else
- {
- o << "unexpected type: " << a.type().name();
- return false;
- }
- return o.str() == expected;
-}
-
-template <typename T>
-bool output_any_direct (T const& v, std::string expected)
-{
- std::ostringstream o;
- o << v;
- return o.str() == expected;
-}
-
-void simple_any_test()
-{
- BOOST_TEST(output_any(42, "42"));
- BOOST_TEST(output_any('q', "q"));
- BOOST_TEST(output_any(3.14, "3.14"));
- BOOST_TEST(output_any(std::complex<int>(1, 2), "(1,2)"));
-
- int n = 42; BOOST_TEST(output_any(n, "42"));
- char c = 'q'; BOOST_TEST(output_any(c, "q"));
- double d = 3.14; BOOST_TEST(output_any(d, "3.14"));
- std::complex<int> x(1, 2); BOOST_TEST(output_any(x, "(1,2)"));
-
- hold_any a;
- BOOST_TEST(output_any(a = n, "42"));
- BOOST_TEST(output_any(a = c, "q"));
- BOOST_TEST(output_any(a = d, "3.14"));
- BOOST_TEST(output_any(a = x, "(1,2)"));
- BOOST_TEST(output_any(a = 13, "13"));
-
-#ifdef BOOST_SPIRIT_ANY_IMPLICIT_CASTING
- BOOST_TEST(output_any_direct(n = hold_any(42), "42"));
- BOOST_TEST(output_any_direct(c = hold_any('q'), "q"));
- BOOST_TEST(output_any_direct(d = hold_any(3.14), "3.14"));
- BOOST_TEST(output_any_direct(x = std::complex<int>(hold_any(std::complex<int>(1, 2))), "(1,2)"));
-#endif
-
- BOOST_TEST(output_any_direct(hold_any(42), "42"));
- BOOST_TEST(output_any_direct(hold_any('q'), "q"));
- BOOST_TEST(output_any_direct(hold_any(3.14), "3.14"));
- BOOST_TEST(output_any_direct(hold_any(std::complex<int>(1, 2)), "(1,2)"));
-
- BOOST_TEST(!a.empty());
- a = 0;
- BOOST_TEST(!a.empty());
- a.reset();
- BOOST_TEST(a.empty());
-
- try {
- any_cast<int>(a);
- BOOST_TEST(false);
- }
- catch (boost::spirit::bad_any_cast const&) {
- BOOST_TEST(true);
- }
- catch (...) {
- BOOST_TEST(false);
- }
-}
-
-void test2(hold_any const& x, hold_any const& y)
-{
- BOOST_TEST(x.type() != y.type());
- BOOST_TEST(x.type().name() != y.type().name());
-}
-
-///////////////////////////////////////////////////////////////////////////////
-int state;
-
-///////////////////////////////////////////////////////////////////////////////
-struct small_object
-{
- small_object() {}
- small_object(small_object const&) { state = 1; }
- ~small_object() { state = 2; }
-};
-
-inline std::istream&
-operator>> (std::istream& i, small_object&)
-{
- return i;
-}
-
-inline std::ostream&
-operator<< (std::ostream& o, small_object const&)
-{
- return o;
-}
-
-///////////////////////////////////////////////////////////////////////////////
-struct large_object
-{
- large_object() {}
- large_object(large_object const&) { state = 3; }
- ~large_object() { state = 4; }
-
- int data0;
- int data1;
- int data2;
- int data3;
-};
-
-inline std::istream&
-operator>> (std::istream& i, large_object&)
-{
- return i;
-}
-
-inline std::ostream&
-operator<< (std::ostream& o, large_object const&)
-{
- return o;
-}
-
-void constructor_test()
-{
- small_object lfb;
- large_object bfb;
- hold_any a;
- state = 0;
-
- a = lfb; BOOST_TEST(1 == state); state = 0;
- a = 42; BOOST_TEST(2 == state); state = 0;
- a = bfb; BOOST_TEST(3 == state); state = 0;
- a = 42; BOOST_TEST(4 == state); state = 0;
-
- // test assignment of large objects
- a = bfb;
- a = bfb;
-}
-
-int main()
-{
- test2(std::string("10"), std::complex<double>(20));
-
- constructor_test();
- simple_any_test();
-
- hold_any non_const(10);
- BOOST_TEST(any_cast<int>(non_const) == 10);
- *any_cast<int>(&non_const) = 15;
- BOOST_TEST(any_cast<int>(non_const) == 15);
-
- hold_any const const_(10);
- BOOST_TEST(any_cast<int>(const_) == *any_cast<int>(&const_));
-
- hold_any a = 42, b = 'q';
- swap(a, b);
- BOOST_TEST(any_cast<int>(b) == 42);
- BOOST_TEST(any_cast<char>(a) == 'q');
-
- return boost::report_errors();
-}
-

Deleted: branches/release/libs/spirit/test/support/multi_pass.cpp
==============================================================================
--- branches/release/libs/spirit/test/support/multi_pass.cpp 2009-09-14 12:45:39 EDT (Mon, 14 Sep 2009)
+++ (empty file)
@@ -1,770 +0,0 @@
-/*=============================================================================
- Copyright (c) 2001-2003 Daniel Nuffer
- 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)
-=============================================================================*/
-
-#include <boost/spirit/support/iterators/detail/buf_id_check_policy.hpp>
-#include <boost/spirit/support/iterators/detail/ref_counted_policy.hpp>
-#include <boost/spirit/support/iterators/detail/functor_input_policy.hpp>
-#include <boost/spirit/include/support_multi_pass.hpp>
-#include <boost/spirit/support/iterators/look_ahead.hpp>
-
-#include <boost/scoped_ptr.hpp>
-#include <iterator>
-#include <string>
-#include <boost/detail/lightweight_test.hpp>
-#include "detail/sstream.hpp"
-
-using namespace std;
-using namespace boost::spirit;
-
-sstream_t res;
-
-typedef boost::spirit::multi_pass<istream_iterator<char> > default_multi_pass_t;
-
-typedef look_ahead<istream_iterator<char>, 6> fixed_multi_pass_t;
-
-typedef multi_pass<
- istream_iterator<char>,
- multi_pass_policies::input_iterator,
- multi_pass_policies::first_owner,
- multi_pass_policies::buf_id_check,
- multi_pass_policies::std_deque
-> first_owner_multi_pass_t;
-
-
-// a functor to test out the functor_multi_pass
-class my_functor
-{
- public:
- typedef char result_type;
- my_functor()
- : c('A')
- {}
-
- char operator()()
- {
- if (c == 'M')
- return eof;
- else
- return c++;
- }
-
- static result_type eof;
- private:
- char c;
-};
-
-my_functor::result_type my_functor::eof = '\0';
-
-typedef multi_pass<
- my_functor,
- multi_pass_policies::functor_input,
- multi_pass_policies::first_owner,
- multi_pass_policies::no_check,
- multi_pass_policies::std_deque
-> functor_multi_pass_t;
-
-void test_default_multi_pass()
-{
- res << "-*= test_default_multi_pass =*-\n";
- istream_iterator<char> end;
- boost::scoped_ptr<default_multi_pass_t> mpend(new default_multi_pass_t(end));
-
- {
- sstream_t ss;
- ss << "test string";
-
- istream_iterator<char> a(ss);
- boost::scoped_ptr<default_multi_pass_t> mp1(new default_multi_pass_t(a));
-
- while (*mp1 != *mpend)
- {
- res << *((*mp1)++);
- }
-
- res << endl;
- }
-
- {
- sstream_t ss;
- ss << "test string";
- istream_iterator<char> b(ss);
- boost::scoped_ptr<default_multi_pass_t> mp2(new default_multi_pass_t(b));
- boost::scoped_ptr<default_multi_pass_t> mp3(new default_multi_pass_t(b));
- *mp3 = *mp2;
-
- for (int i = 0; i < 4; ++i)
- {
- res << **mp2;
- ++*mp2;
- }
-
- mp3.reset();
-
- while (*mp2 != *mpend)
- {
- res << **mp2;
- ++*mp2;
- }
-
- res << endl;
- }
-
- {
- sstream_t ss;
- ss << "test string";
- istream_iterator<char> a(ss);
- boost::scoped_ptr<default_multi_pass_t> mp1(new default_multi_pass_t(a));
- boost::scoped_ptr<default_multi_pass_t> mp2(new default_multi_pass_t(*mp1));
-
- for (int i = 0; i < 4; ++i)
- {
- res << **mp1;
- ++*mp1;
- }
-
- while (*mp2 != *mpend)
- {
- res << **mp2;
- ++*mp2;
- }
-
- while (*mp1 != *mpend)
- {
- res << **mp1;
- ++*mp1;
- }
-
- res << endl;
- }
-
- {
- sstream_t ss;
- ss << "test string";
- istream_iterator<char> b(ss);
- boost::scoped_ptr<default_multi_pass_t> mp2(new default_multi_pass_t(b));
- boost::scoped_ptr<default_multi_pass_t> mp3(new default_multi_pass_t(b));
- *mp3 = *mp2;
-
- for (int i = 0; i < 4; ++i)
- {
- res << **mp2;
- ++*mp2;
- }
-
- mp3.reset();
- ++*mp2;
-
- while (*mp2 != *mpend)
- {
- res << **mp2;
- ++*mp2;
- }
-
- res << endl;
- }
-
- {
- sstream_t ss;
- ss << "test string";
- istream_iterator<char> a(ss);
- boost::scoped_ptr<default_multi_pass_t> mp1(new default_multi_pass_t(a));
- boost::scoped_ptr<default_multi_pass_t> mp2(new default_multi_pass_t(*mp1));
-
- BOOST_TEST(*mp1 == *mp2);
- BOOST_TEST(*mp1 >= *mp2);
- BOOST_TEST(*mp1 <= *mp2);
- for (int i = 0; i < 4; ++i)
- {
- res << **mp1;
- ++*mp1;
- }
-
- BOOST_TEST(*mp1 != *mp2);
- BOOST_TEST(*mp1 > *mp2);
- BOOST_TEST(*mp1 >= *mp2);
- BOOST_TEST(*mp2 < *mp1);
- BOOST_TEST(*mp2 <= *mp1);
- while (*mp2 != *mp1)
- {
- res << **mp2;
- ++*mp2;
- }
-
- BOOST_TEST(*mp1 == *mp2);
- BOOST_TEST(*mp1 >= *mp2);
- BOOST_TEST(*mp1 <= *mp2);
- while (*mp1 != *mpend)
- {
- res << **mp1;
- ++*mp1;
- }
-
- BOOST_TEST(*mp1 != *mp2);
- BOOST_TEST(*mp1 > *mp2);
- BOOST_TEST(*mp1 >= *mp2);
- BOOST_TEST(*mp2 < *mp1);
- BOOST_TEST(*mp2 <= *mp1);
- while (*mp2 != *mpend)
- {
- res << **mp2;
- ++*mp2;
- }
-
- BOOST_TEST(*mp1 == *mp2);
- BOOST_TEST(*mp1 >= *mp2);
- BOOST_TEST(*mp1 <= *mp2);
- res << endl;
- }
-
- {
- sstream_t ss;
- ss << "test string";
- istream_iterator<char> a(ss);
- boost::scoped_ptr<default_multi_pass_t> mp1(new default_multi_pass_t(a));
- boost::scoped_ptr<default_multi_pass_t> mp2(new default_multi_pass_t(a));
- BOOST_TEST(*mp1 != *mp2);
- ++*mp1;
- BOOST_TEST(*mp1 != *mp2);
-
- }
-
- {
- sstream_t ss;
- ss << "test string";
- istream_iterator<char> b(ss);
- boost::scoped_ptr<default_multi_pass_t> mp2(new default_multi_pass_t(b));
- boost::scoped_ptr<default_multi_pass_t> mp3(new default_multi_pass_t(b));
- *mp3 = *mp2;
-
- for (int i = 0; i < 4; ++i)
- {
- res << **mp2;
- ++*mp2;
- }
-
- mp2->clear_queue();
-
- while (*mp2 != *mpend)
- {
- res << **mp2;
- ++*mp2;
- }
-
- try
- {
- res << **mp3; // this should throw illegal_backtracking
- BOOST_TEST(0);
- }
- catch (const boost::spirit::multi_pass_policies::illegal_backtracking& /*e*/)
- {
- }
- res << endl;
- }
-
-
-}
-
-void test_fixed_multi_pass()
-{
- res << "-*= test_fixed_multi_pass =*-\n";
- istream_iterator<char> end;
- boost::scoped_ptr<fixed_multi_pass_t> mpend(new fixed_multi_pass_t(end));
-
- {
- sstream_t ss;
- ss << "test string";
-
- istream_iterator<char> a(ss);
- boost::scoped_ptr<fixed_multi_pass_t> mp1(new fixed_multi_pass_t(a));
-
- while (*mp1 != *mpend)
- {
- res << *((*mp1)++);
- }
-
- res << endl;
- }
-
- {
- sstream_t ss;
- ss << "test string";
- istream_iterator<char> b(ss);
- boost::scoped_ptr<fixed_multi_pass_t> mp2(new fixed_multi_pass_t(b));
- boost::scoped_ptr<fixed_multi_pass_t> mp3(new fixed_multi_pass_t(*mp2));
-
- for (int i = 0; i < 4; ++i)
- {
- res << **mp2;
- ++*mp2;
- }
-
- mp3.reset();
-
- while (*mp2 != *mpend)
- {
- res << **mp2;
- ++*mp2;
- }
-
- res << endl;
- }
-
- {
- sstream_t ss;
- ss << "test string";
- istream_iterator<char> a(ss);
- boost::scoped_ptr<fixed_multi_pass_t> mp1(new fixed_multi_pass_t(a));
- boost::scoped_ptr<fixed_multi_pass_t> mp2(new fixed_multi_pass_t(*mp1));
-
- for (int i = 0; i < 4; ++i)
- {
- res << **mp1;
- ++*mp1;
- }
-
- while (*mp2 != *mpend)
- {
- res << **mp2;
- ++*mp2;
- }
-
- while (*mp1 != *mpend)
- {
- res << **mp1;
- ++*mp1;
- }
-
- res << endl;
- }
-
- {
- sstream_t ss;
- ss << "test string";
- istream_iterator<char> b(ss);
- boost::scoped_ptr<fixed_multi_pass_t> mp2(new fixed_multi_pass_t(b));
- boost::scoped_ptr<fixed_multi_pass_t> mp3(new fixed_multi_pass_t(*mp2));
-
- for (int i = 0; i < 4; ++i)
- {
- res << **mp2;
- ++*mp2;
- }
-
- mp3.reset();
- ++*mp2;
-
- while (*mp2 != *mpend)
- {
- res << **mp2;
- ++*mp2;
- }
-
- res << endl;
- }
-
- {
- sstream_t ss;
- ss << "test string";
- istream_iterator<char> a(ss);
- boost::scoped_ptr<fixed_multi_pass_t> mp1(new fixed_multi_pass_t(a));
- boost::scoped_ptr<fixed_multi_pass_t> mp2(new fixed_multi_pass_t(*mp1));
-
- BOOST_TEST(*mp1 == *mp2);
- BOOST_TEST(*mp1 >= *mp2);
- BOOST_TEST(*mp1 <= *mp2);
- for (int i = 0; i < 4; ++i)
- {
- res << **mp1;
- ++*mp1;
- }
-
- BOOST_TEST(*mp1 != *mp2);
- BOOST_TEST(*mp1 > *mp2);
- BOOST_TEST(*mp1 >= *mp2);
- BOOST_TEST(*mp2 < *mp1);
- BOOST_TEST(*mp2 <= *mp1);
- while (*mp2 != *mp1)
- {
- res << **mp2;
- ++*mp2;
- }
-
- BOOST_TEST(*mp1 == *mp2);
- BOOST_TEST(*mp1 >= *mp2);
- BOOST_TEST(*mp1 <= *mp2);
- while (*mp1 != *mpend)
- {
- res << **mp1;
- ++*mp1;
- }
-
- BOOST_TEST(*mp1 != *mp2);
- BOOST_TEST(*mp1 > *mp2);
- BOOST_TEST(*mp1 >= *mp2);
- BOOST_TEST(*mp2 < *mp1);
- BOOST_TEST(*mp2 <= *mp1);
- while (*mp2 != *mpend)
- {
- res << **mp2;
- ++*mp2;
- }
-
- BOOST_TEST(*mp1 == *mp2);
- BOOST_TEST(*mp1 >= *mp2);
- BOOST_TEST(*mp1 <= *mp2);
- res << endl;
- }
-
- {
- sstream_t ss;
- ss << "test string";
- istream_iterator<char> a(ss);
- boost::scoped_ptr<fixed_multi_pass_t> mp1(new fixed_multi_pass_t(a));
- boost::scoped_ptr<fixed_multi_pass_t> mp2(new fixed_multi_pass_t(a));
- BOOST_TEST(*mp1 != *mp2);
- ++*mp1;
- BOOST_TEST(*mp1 != *mp2);
-
- }
-
-}
-
-void test_first_owner_multi_pass()
-{
- res << "-*= test_first_owner_multi_pass =*-\n";
- istream_iterator<char> end;
- boost::scoped_ptr<first_owner_multi_pass_t> mpend(new first_owner_multi_pass_t(end));
-
- {
- sstream_t ss;
- ss << "test string";
-
- istream_iterator<char> a(ss);
- boost::scoped_ptr<first_owner_multi_pass_t> mp1(new first_owner_multi_pass_t(a));
-
- while (*mp1 != *mpend)
- {
- res << *((*mp1)++);
- }
-
- res << endl;
- }
-
- {
- sstream_t ss;
- ss << "test string";
- istream_iterator<char> b(ss);
- boost::scoped_ptr<first_owner_multi_pass_t> mp2(new first_owner_multi_pass_t(b));
- boost::scoped_ptr<first_owner_multi_pass_t> mp3(new first_owner_multi_pass_t(*mp2));
-
- for (int i = 0; i < 4; ++i)
- {
- res << **mp2;
- ++*mp2;
- }
-
- mp3.reset();
-
- while (*mp2 != *mpend)
- {
- res << **mp2;
- ++*mp2;
- }
-
- res << endl;
- }
-
- {
- sstream_t ss;
- ss << "test string";
- istream_iterator<char> a(ss);
- boost::scoped_ptr<first_owner_multi_pass_t> mp1(new first_owner_multi_pass_t(a));
- boost::scoped_ptr<first_owner_multi_pass_t> mp2(new first_owner_multi_pass_t(*mp1));
-
- for (int i = 0; i < 4; ++i)
- {
- res << **mp1;
- ++*mp1;
- }
-
- while (*mp2 != *mpend)
- {
- res << **mp2;
- ++*mp2;
- }
-
- while (*mp1 != *mpend)
- {
- res << **mp1;
- ++*mp1;
- }
-
- res << endl;
- }
-
- {
- sstream_t ss;
- ss << "test string";
- istream_iterator<char> b(ss);
- boost::scoped_ptr<first_owner_multi_pass_t> mp2(new first_owner_multi_pass_t(b));
- boost::scoped_ptr<first_owner_multi_pass_t> mp3(new first_owner_multi_pass_t(*mp2));
-
- for (int i = 0; i < 4; ++i)
- {
- res << **mp2;
- ++*mp2;
- }
-
- mp3.reset();
- ++*mp2;
-
- while (*mp2 != *mpend)
- {
- res << **mp2;
- ++*mp2;
- }
-
- res << endl;
- }
-
- {
- sstream_t ss;
- ss << "test string";
- istream_iterator<char> a(ss);
- boost::scoped_ptr<first_owner_multi_pass_t> mp1(new first_owner_multi_pass_t(a));
- boost::scoped_ptr<first_owner_multi_pass_t> mp2(new first_owner_multi_pass_t(*mp1));
-
- BOOST_TEST(*mp1 == *mp2);
- BOOST_TEST(*mp1 >= *mp2);
- BOOST_TEST(*mp1 <= *mp2);
- for (int i = 0; i < 4; ++i)
- {
- res << **mp1;
- ++*mp1;
- }
-
- BOOST_TEST(*mp1 != *mp2);
- BOOST_TEST(*mp1 > *mp2);
- BOOST_TEST(*mp1 >= *mp2);
- BOOST_TEST(*mp2 < *mp1);
- BOOST_TEST(*mp2 <= *mp1);
- while (*mp2 != *mp1)
- {
- res << **mp2;
- ++*mp2;
- }
-
- BOOST_TEST(*mp1 == *mp2);
- BOOST_TEST(*mp1 >= *mp2);
- BOOST_TEST(*mp1 <= *mp2);
- while (*mp1 != *mpend)
- {
- res << **mp1;
- ++*mp1;
- }
-
- BOOST_TEST(*mp1 != *mp2);
- BOOST_TEST(*mp1 > *mp2);
- BOOST_TEST(*mp1 >= *mp2);
- BOOST_TEST(*mp2 < *mp1);
- BOOST_TEST(*mp2 <= *mp1);
- while (*mp2 != *mpend)
- {
- res << **mp2;
- ++*mp2;
- }
-
- BOOST_TEST(*mp1 == *mp2);
- BOOST_TEST(*mp1 >= *mp2);
- BOOST_TEST(*mp1 <= *mp2);
- res << endl;
- }
-
- {
- sstream_t ss;
- ss << "test string";
- istream_iterator<char> a(ss);
- boost::scoped_ptr<first_owner_multi_pass_t> mp1(new first_owner_multi_pass_t(a));
- boost::scoped_ptr<first_owner_multi_pass_t> mp2(new first_owner_multi_pass_t(a));
- BOOST_TEST(*mp1 != *mp2);
- ++*mp1;
- BOOST_TEST(*mp1 != *mp2);
-
- }
-
- {
- sstream_t ss;
- ss << "test string";
- istream_iterator<char> b(ss);
- boost::scoped_ptr<first_owner_multi_pass_t> mp2(new first_owner_multi_pass_t(b));
- boost::scoped_ptr<first_owner_multi_pass_t> mp3(new first_owner_multi_pass_t(*mp2));
-
- for (int i = 0; i < 4; ++i)
- {
- res << **mp2;
- ++*mp2;
- }
-
- mp2->clear_queue();
-
- while (*mp2 != *mpend)
- {
- res << **mp2;
- ++*mp2;
- }
-
- try
- {
- res << **mp3; // this should throw illegal_backtracking
- BOOST_TEST(0);
- }
- catch (const boost::spirit::multi_pass_policies::illegal_backtracking& /*e*/)
- {
- }
- res << endl;
- }
-
-}
-
-
-void test_functor_multi_pass()
-{
- res << "-*= test_functor_multi_pass =*-\n";
- functor_multi_pass_t mpend;
-
- {
- functor_multi_pass_t mp1 = functor_multi_pass_t(my_functor());
-
- while (mp1 != mpend)
- {
- res << *(mp1++);
- }
-
- res << endl;
- }
-
- {
- functor_multi_pass_t mp1 = functor_multi_pass_t(my_functor());
- functor_multi_pass_t mp2 = functor_multi_pass_t(mp1);
-
- for (int i = 0; i < 4; ++i)
- {
- res << *mp1;
- ++mp1;
- }
-
- while (mp2 != mpend)
- {
- res << *mp2;
- ++mp2;
- }
-
- while (mp1 != mpend)
- {
- res << *mp1;
- ++mp1;
- }
-
- res << endl;
- }
-
- {
- functor_multi_pass_t mp1 = functor_multi_pass_t(my_functor());
- functor_multi_pass_t mp2 = functor_multi_pass_t(mp1);
-
- BOOST_TEST(mp1 == mp2);
- BOOST_TEST(mp1 >= mp2);
- BOOST_TEST(mp1 <= mp2);
- for (int i = 0; i < 4; ++i)
- {
- res << *mp1;
- ++mp1;
- }
-
- BOOST_TEST(mp1 != mp2);
- BOOST_TEST(mp1 > mp2);
- BOOST_TEST(mp1 >= mp2);
- BOOST_TEST(mp2 < mp1);
- BOOST_TEST(mp2 <= mp1);
- while (mp2 != mp1)
- {
- res << *mp2;
- ++mp2;
- }
-
- BOOST_TEST(mp1 == mp2);
- BOOST_TEST(mp1 >= mp2);
- BOOST_TEST(mp1 <= mp2);
- while (mp1 != mpend)
- {
- res << *mp1;
- ++mp1;
- }
-
- BOOST_TEST(mp1 != mp2);
- BOOST_TEST(mp1 > mp2);
- BOOST_TEST(mp1 >= mp2);
- BOOST_TEST(mp2 < mp1);
- BOOST_TEST(mp2 <= mp1);
- while (mp2 != mpend)
- {
- res << *mp2;
- ++mp2;
- }
-
- BOOST_TEST(mp1 == mp2);
- BOOST_TEST(mp1 >= mp2);
- BOOST_TEST(mp1 <= mp2);
- res << endl;
- }
-
- {
- functor_multi_pass_t mp1 = functor_multi_pass_t(my_functor());
- functor_multi_pass_t mp2 = functor_multi_pass_t(my_functor());
- BOOST_TEST(mp1 != mp2);
- ++mp1;
- BOOST_TEST(mp1 != mp2);
-
- }
-}
-
-int main(int, char**)
-{
-
- test_default_multi_pass();
- test_fixed_multi_pass();
- test_first_owner_multi_pass();
- test_functor_multi_pass();
-
- BOOST_TEST(getstring(res) == "-*= test_default_multi_pass =*-\n"
- "teststring\n"
- "teststring\n"
- "testteststringstring\n"
- "testtring\n"
- "testteststringstring\n"
- "teststring\n"
- "-*= test_fixed_multi_pass =*-\n"
- "teststring\n"
- "teststring\n"
- "testteststringstring\n"
- "testtring\n"
- "testteststringstring\n"
- "-*= test_first_owner_multi_pass =*-\n"
- "teststring\n"
- "teststring\n"
- "testteststringstring\n"
- "testtring\n"
- "testteststringstring\n"
- "teststring\n"
- "-*= test_functor_multi_pass =*-\n"
- "ABCDEFGHIJKL\n"
- "ABCDABCDEFGHIJKLEFGHIJKL\n"
- "ABCDABCDEFGHIJKLEFGHIJKL\n");
-
- return boost::report_errors();
-}

Deleted: branches/release/libs/spirit/test/support/multi_pass_compile.cpp
==============================================================================
--- branches/release/libs/spirit/test/support/multi_pass_compile.cpp 2009-09-14 12:45:39 EDT (Mon, 14 Sep 2009)
+++ (empty file)
@@ -1,63 +0,0 @@
-/*=============================================================================
- Copyright (c) 2004-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)
-=============================================================================*/
-
-// This is a compile only test for verifying, whether the multi_pass<>
-// iterator works ok with an input iterator, which returns a value_type and not
-// a reference from its dereferencing operator.
-
-#include <cstdio>
-#include <fstream>
-#include <iterator>
-#include <boost/detail/lightweight_test.hpp>
-
-#include <boost/spirit/include/qi_char.hpp>
-#include <boost/spirit/include/qi_numeric.hpp>
-#include <boost/spirit/include/qi_operator.hpp>
-#include <boost/spirit/include/qi_nonterminal.hpp>
-#include <boost/spirit/include/qi_parse.hpp>
-#include <boost/spirit/include/support_multi_pass.hpp>
-
-#if defined(BOOST_HAS_UNISTD_H)
-#include <unistd.h> // unlink()
-#endif
-
-#if defined(__MINGW32__)
-#include <io.h> // unlink()
-#endif
-
-using namespace boost::spirit;
-using namespace boost::spirit::qi;
-using namespace std;
-
-int main ()
-{
- // create a sample file
- {
- ofstream out("./input_file.txt");
- out << 1.0 << "," << 2.0;
- }
-
- // read in the values from the sample file
- {
- ifstream in("./input_file.txt"); // we get our input from this file
-
- typedef multi_pass<istreambuf_iterator<char> > iterator_type;
-
- iterator_type first(make_multi_pass(istreambuf_iterator<char>(in)));
- iterator_type last(make_multi_pass(istreambuf_iterator<char>()));
-
- rule<iterator_type> n_list;
- n_list = double_ >> *(char_(',') >> double_);
- BOOST_TEST(parse(first, last, n_list));
- }
-
-#if !defined(__COMO_VERSION__)
- unlink("./input_file.txt");
-#endif
-
- return boost::report_errors();
-}


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