|
Boost-Commit : |
Subject: [Boost-commit] svn:boost r56453 - in trunk/boost/spirit/home/qi: . numeric operator
From: hartmut.kaiser_at_[hidden]
Date: 2009-09-28 08:33:18
Author: hkaiser
Date: 2009-09-28 08:33:16 EDT (Mon, 28 Sep 2009)
New Revision: 56453
URL: http://svn.boost.org/trac/boost/changeset/56453
Log:
Spirit: doc additions from Andreas
Text files modified:
trunk/boost/spirit/home/qi/numeric/int.hpp | 20 ++++++++++++++++++++
trunk/boost/spirit/home/qi/operator/kleene.hpp | 7 +++++++
trunk/boost/spirit/home/qi/parser.hpp | 3 +++
3 files changed, 30 insertions(+), 0 deletions(-)
Modified: trunk/boost/spirit/home/qi/numeric/int.hpp
==============================================================================
--- trunk/boost/spirit/home/qi/numeric/int.hpp (original)
+++ trunk/boost/spirit/home/qi/numeric/int.hpp 2009-09-28 08:33:16 EDT (Mon, 28 Sep 2009)
@@ -24,22 +24,30 @@
///////////////////////////////////////////////////////////////////////////
// Enablers
///////////////////////////////////////////////////////////////////////////
+ //[primitive_parsers_enable_short_
template <>
struct use_terminal<qi::domain, tag::short_> // enables short_
: mpl::true_ {};
+ //]
+ //[primitive_parsers_enable_int_
template <>
struct use_terminal<qi::domain, tag::int_> // enables int_
: mpl::true_ {};
+ //]
+ //[primitive_parsers_enable_long_
template <>
struct use_terminal<qi::domain, tag::long_> // enables long_
: mpl::true_ {};
+ //]
#ifdef BOOST_HAS_LONG_LONG
+ //[primitive_parsers_enable_long_long_
template <>
struct use_terminal<qi::domain, tag::long_long> // enables long_long
: mpl::true_ {};
+ //]
#endif
}}
@@ -59,6 +67,7 @@
///////////////////////////////////////////////////////////////////////////
// This is the actual int parser
///////////////////////////////////////////////////////////////////////////
+ //[primitive_parsers_int
template <
typename T
, unsigned Radix = 10
@@ -95,6 +104,7 @@
return info("integer");
}
};
+ //]
///////////////////////////////////////////////////////////////////////////
// This one is the class that the user can instantiate directly
@@ -112,6 +122,7 @@
///////////////////////////////////////////////////////////////////////////
// Parser generators: make_xxx function (objects)
///////////////////////////////////////////////////////////////////////////
+ //[primitive_parsers_make_int
template <typename T>
struct make_int
{
@@ -121,19 +132,28 @@
return result_type();
}
};
+ //]
+ //[primitive_parsers_short_
template <typename Modifiers>
struct make_primitive<tag::short_, Modifiers> : make_int<short> {};
+ //]
+ //[primitive_parsers_int_
template <typename Modifiers>
struct make_primitive<tag::int_, Modifiers> : make_int<int> {};
+ //]
+ //[primitive_parsers_long_
template <typename Modifiers>
struct make_primitive<tag::long_, Modifiers> : make_int<long> {};
+ //]
#ifdef BOOST_HAS_LONG_LONG
+ //[primitive_parsers_long_long_
template <typename Modifiers>
struct make_primitive<tag::long_long, Modifiers> : make_int<long long> {};
+ //]
#endif
}}}
Modified: trunk/boost/spirit/home/qi/operator/kleene.hpp
==============================================================================
--- trunk/boost/spirit/home/qi/operator/kleene.hpp (original)
+++ trunk/boost/spirit/home/qi/operator/kleene.hpp 2009-09-28 08:33:16 EDT (Mon, 28 Sep 2009)
@@ -22,13 +22,17 @@
///////////////////////////////////////////////////////////////////////////
// Enablers
///////////////////////////////////////////////////////////////////////////
+ //[composite_parsers_kleene_enable_
template <>
struct use_operator<qi::domain, proto::tag::dereference> // enables *p
: mpl::true_ {};
+ //]
}}
namespace boost { namespace spirit { namespace qi
{
+
+ //[composite_parsers_kleene
template <typename Subject>
struct kleene : unary_parser<kleene<Subject> >
{
@@ -80,14 +84,17 @@
Subject subject;
};
+ //]
///////////////////////////////////////////////////////////////////////////
// Parser generators: make_xxx function (objects)
///////////////////////////////////////////////////////////////////////////
+ //[composite_parsers_kleene_generator
template <typename Elements, typename Modifiers>
struct make_composite<proto::tag::dereference, Elements, Modifiers>
: make_unary_composite<Elements, kleene>
{};
+ //]
}}}
namespace boost { namespace spirit { namespace traits
Modified: trunk/boost/spirit/home/qi/parser.hpp
==============================================================================
--- trunk/boost/spirit/home/qi/parser.hpp (original)
+++ trunk/boost/spirit/home/qi/parser.hpp 2009-09-28 08:33:16 EDT (Mon, 28 Sep 2009)
@@ -16,6 +16,8 @@
namespace boost { namespace spirit { namespace qi
{
+
+ //[parser_base_parser
template <typename Derived>
struct parser
{
@@ -47,6 +49,7 @@
return *static_cast<Derived const*>(this);
}
};
+ //]
template <typename Derived>
struct primitive_parser : parser<Derived>
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