num_list3.qbk 1002 B

123456789101112131415161718192021222324252627282930313233
  1. [/==============================================================================
  2. Copyright (C) 2001-2011 Joel de Guzman
  3. Copyright (C) 2001-2011 Hartmut Kaiser
  4. Distributed under the Boost Software License, Version 1.0. (See accompanying
  5. file LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt)
  6. ===============================================================================/]
  7. [section Number List Redux - list syntax]
  8. So far, we've been using the syntax:
  9. double_ >> *(',' >> double_)
  10. to parse a comma-delimited list of numbers. Such lists are common in parsing and
  11. Spirit provides a simpler shortcut for them. The expression above can be
  12. simplified to:
  13. double_ % ','
  14. read as: a list of doubles separated by `','`.
  15. This sample, again a variation of our previous example, demonstrates just that:
  16. [import ../../example/qi/num_list3.cpp]
  17. [tutorial_numlist3]
  18. The full cpp file for this example can be found here: [@../../example/qi/num_list3.cpp]
  19. [endsect]