diff options
author | Chanho Park <chanho61.park@samsung.com> | 2014-12-11 18:55:56 +0900 |
---|---|---|
committer | Chanho Park <chanho61.park@samsung.com> | 2014-12-11 18:55:56 +0900 |
commit | 08c1e93fa36a49f49325a07fe91ff92c964c2b6c (patch) | |
tree | 7a7053ceb8874b28ec4b868d4c49b500008a102e /boost/spirit/home/qi/directive | |
parent | bb4dd8289b351fae6b55e303f189127a394a1edd (diff) | |
download | boost-08c1e93fa36a49f49325a07fe91ff92c964c2b6c.tar.gz boost-08c1e93fa36a49f49325a07fe91ff92c964c2b6c.tar.bz2 boost-08c1e93fa36a49f49325a07fe91ff92c964c2b6c.zip |
Imported Upstream version 1.57.0upstream/1.57.0
Diffstat (limited to 'boost/spirit/home/qi/directive')
-rw-r--r-- | boost/spirit/home/qi/directive/as.hpp | 12 | ||||
-rw-r--r-- | boost/spirit/home/qi/directive/hold.hpp | 10 | ||||
-rw-r--r-- | boost/spirit/home/qi/directive/lexeme.hpp | 24 | ||||
-rw-r--r-- | boost/spirit/home/qi/directive/matches.hpp | 8 | ||||
-rw-r--r-- | boost/spirit/home/qi/directive/no_skip.hpp | 22 | ||||
-rw-r--r-- | boost/spirit/home/qi/directive/omit.hpp | 8 | ||||
-rw-r--r-- | boost/spirit/home/qi/directive/raw.hpp | 8 | ||||
-rw-r--r-- | boost/spirit/home/qi/directive/repeat.hpp | 28 | ||||
-rw-r--r-- | boost/spirit/home/qi/directive/skip.hpp | 30 |
9 files changed, 94 insertions, 56 deletions
diff --git a/boost/spirit/home/qi/directive/as.hpp b/boost/spirit/home/qi/directive/as.hpp index 9ace587caf..e0376eb2ec 100644 --- a/boost/spirit/home/qi/directive/as.hpp +++ b/boost/spirit/home/qi/directive/as.hpp @@ -76,8 +76,8 @@ namespace boost { namespace spirit { namespace qi struct as_directive : unary_parser<as_directive<Subject, T> > { typedef Subject subject_type; - as_directive(Subject const& subject) - : subject(subject) {} + as_directive(Subject const& subject_) + : subject(subject_) {} template <typename Context, typename Iterator> struct attribute @@ -88,13 +88,13 @@ namespace boost { namespace spirit { namespace qi template <typename Iterator, typename Context , typename Skipper, typename Attribute> bool parse(Iterator& first, Iterator const& last - , Context& context, Skipper const& skipper, Attribute& attr) const + , Context& context, Skipper const& skipper, Attribute& attr_) const { Iterator i = first; T as_attr; if (subject.parse(i, last, context, skipper, as_attr)) { - spirit::traits::assign_to(as_attr, attr); + spirit::traits::assign_to(as_attr, attr_); first = i; return true; } @@ -103,10 +103,10 @@ namespace boost { namespace spirit { namespace qi template <typename Iterator, typename Context, typename Skipper> bool parse(Iterator& first, Iterator const& last - , Context& context, Skipper const& skipper, T& attr) const + , Context& context, Skipper const& skipper, T& attr_) const { Iterator i = first; - if (subject.parse(i, last, context, skipper, attr)) + if (subject.parse(i, last, context, skipper, attr_)) { first = i; return true; diff --git a/boost/spirit/home/qi/directive/hold.hpp b/boost/spirit/home/qi/directive/hold.hpp index d5b2ed5601..9cd905cf79 100644 --- a/boost/spirit/home/qi/directive/hold.hpp +++ b/boost/spirit/home/qi/directive/hold.hpp @@ -42,8 +42,8 @@ namespace boost { namespace spirit { namespace qi struct hold_directive : unary_parser<hold_directive<Subject> > { typedef Subject subject_type; - hold_directive(Subject const& subject) - : subject(subject) {} + hold_directive(Subject const& subject_) + : subject(subject_) {} template <typename Context, typename Iterator> struct attribute @@ -56,12 +56,12 @@ namespace boost { namespace spirit { namespace qi template <typename Iterator, typename Context , typename Skipper, typename Attribute> bool parse(Iterator& first, Iterator const& last - , Context& context, Skipper const& skipper, Attribute& attr) const + , Context& context, Skipper const& skipper, Attribute& attr_) const { - Attribute copy(attr); + Attribute copy(attr_); if (subject.parse(first, last, context, skipper, copy)) { - traits::swap_impl(copy, attr); + traits::swap_impl(copy, attr_); return true; } return false; diff --git a/boost/spirit/home/qi/directive/lexeme.hpp b/boost/spirit/home/qi/directive/lexeme.hpp index f0b83993ef..691d4fa52c 100644 --- a/boost/spirit/home/qi/directive/lexeme.hpp +++ b/boost/spirit/home/qi/directive/lexeme.hpp @@ -20,6 +20,7 @@ #include <boost/spirit/home/qi/detail/attributes.hpp> #include <boost/spirit/home/support/info.hpp> #include <boost/spirit/home/support/handles_container.hpp> +#include <boost/utility/enable_if.hpp> namespace boost { namespace spirit { @@ -42,8 +43,8 @@ namespace boost { namespace spirit { namespace qi struct lexeme_directive : unary_parser<lexeme_directive<Subject> > { typedef Subject subject_type; - lexeme_directive(Subject const& subject) - : subject(subject) {} + lexeme_directive(Subject const& subject_) + : subject(subject_) {} template <typename Context, typename Iterator> struct attribute @@ -55,13 +56,26 @@ namespace boost { namespace spirit { namespace qi template <typename Iterator, typename Context , typename Skipper, typename Attribute> - bool parse(Iterator& first, Iterator const& last + typename disable_if<detail::is_unused_skipper<Skipper>, bool>::type + parse(Iterator& first, Iterator const& last , Context& context, Skipper const& skipper - , Attribute& attr) const + , Attribute& attr_) const { qi::skip_over(first, last, skipper); return subject.parse(first, last, context - , detail::unused_skipper<Skipper>(skipper), attr); + , detail::unused_skipper<Skipper>(skipper), attr_); + } + template <typename Iterator, typename Context + , typename Skipper, typename Attribute> + typename enable_if<detail::is_unused_skipper<Skipper>, bool>::type + parse(Iterator& first, Iterator const& last + , Context& context, Skipper const& skipper + , Attribute& attr_) const + { + // no need to pre-skip if skipper is unused + //- qi::skip_over(first, last, skipper); + return subject.parse(first, last, context + , skipper, attr_); } template <typename Context> diff --git a/boost/spirit/home/qi/directive/matches.hpp b/boost/spirit/home/qi/directive/matches.hpp index b5349272d4..b6fecb994d 100644 --- a/boost/spirit/home/qi/directive/matches.hpp +++ b/boost/spirit/home/qi/directive/matches.hpp @@ -44,8 +44,8 @@ namespace boost { namespace spirit { namespace qi struct matches_directive : unary_parser<matches_directive<Subject> > { typedef Subject subject_type; - matches_directive(Subject const& subject) - : subject(subject) {} + matches_directive(Subject const& subject_) + : subject(subject_) {} template <typename Context, typename Iterator> struct attribute @@ -56,10 +56,10 @@ namespace boost { namespace spirit { namespace qi template <typename Iterator, typename Context , typename Skipper, typename Attribute> bool parse(Iterator& first, Iterator const& last - , Context& context, Skipper const& skipper, Attribute& attr) const + , Context& context, Skipper const& skipper, Attribute& attr_) const { bool result = subject.parse(first, last, context, skipper, unused); - spirit::traits::assign_to(result, attr); + spirit::traits::assign_to(result, attr_); return true; } diff --git a/boost/spirit/home/qi/directive/no_skip.hpp b/boost/spirit/home/qi/directive/no_skip.hpp index 9764d4a661..119b0c80c3 100644 --- a/boost/spirit/home/qi/directive/no_skip.hpp +++ b/boost/spirit/home/qi/directive/no_skip.hpp @@ -22,6 +22,7 @@ #include <boost/spirit/home/support/info.hpp> #include <boost/spirit/home/support/has_semantic_action.hpp> #include <boost/spirit/home/support/handles_container.hpp> +#include <boost/utility/enable_if.hpp> namespace boost { namespace spirit { @@ -45,8 +46,8 @@ namespace boost { namespace spirit { namespace qi struct no_skip_directive : unary_parser<no_skip_directive<Subject> > { typedef Subject subject_type; - no_skip_directive(Subject const& subject) - : subject(subject) {} + no_skip_directive(Subject const& subject_) + : subject(subject_) {} template <typename Context, typename Iterator> struct attribute @@ -58,12 +59,23 @@ namespace boost { namespace spirit { namespace qi template <typename Iterator, typename Context , typename Skipper, typename Attribute> - bool parse(Iterator& first, Iterator const& last + typename disable_if<detail::is_unused_skipper<Skipper>, bool>::type + parse(Iterator& first, Iterator const& last , Context& context, Skipper const& skipper - , Attribute& attr) const + , Attribute& attr_) const { return subject.parse(first, last, context - , detail::unused_skipper<Skipper>(skipper), attr); + , detail::unused_skipper<Skipper>(skipper), attr_); + } + template <typename Iterator, typename Context + , typename Skipper, typename Attribute> + typename enable_if<detail::is_unused_skipper<Skipper>, bool>::type + parse(Iterator& first, Iterator const& last + , Context& context, Skipper const& skipper + , Attribute& attr_) const + { + return subject.parse(first, last, context + , skipper, attr_); } template <typename Context> diff --git a/boost/spirit/home/qi/directive/omit.hpp b/boost/spirit/home/qi/directive/omit.hpp index b0ed86b0a7..05a6a76d75 100644 --- a/boost/spirit/home/qi/directive/omit.hpp +++ b/boost/spirit/home/qi/directive/omit.hpp @@ -45,8 +45,8 @@ namespace boost { namespace spirit { namespace qi struct omit_directive : unary_parser<omit_directive<Subject> > { typedef Subject subject_type; - omit_directive(Subject const& subject) - : subject(subject) {} + omit_directive(Subject const& subject_) + : subject(subject_) {} template <typename Context, typename Iterator> struct attribute @@ -57,9 +57,9 @@ namespace boost { namespace spirit { namespace qi template <typename Iterator, typename Context , typename Skipper, typename Attribute> bool parse(Iterator& first, Iterator const& last - , Context& context, Skipper const& skipper, Attribute& attr) const + , Context& context, Skipper const& skipper, Attribute& attr_) const { - return subject.parse(first, last, context, skipper, attr); + return subject.parse(first, last, context, skipper, attr_); } template <typename Context> diff --git a/boost/spirit/home/qi/directive/raw.hpp b/boost/spirit/home/qi/directive/raw.hpp index b88458ea28..e1d208e759 100644 --- a/boost/spirit/home/qi/directive/raw.hpp +++ b/boost/spirit/home/qi/directive/raw.hpp @@ -44,8 +44,8 @@ namespace boost { namespace spirit { namespace qi struct raw_directive : unary_parser<raw_directive<Subject> > { typedef Subject subject_type; - raw_directive(Subject const& subject) - : subject(subject) {} + raw_directive(Subject const& subject_) + : subject(subject_) {} template <typename Context, typename Iterator> struct attribute @@ -56,13 +56,13 @@ namespace boost { namespace spirit { namespace qi template <typename Iterator, typename Context , typename Skipper, typename Attribute> bool parse(Iterator& first, Iterator const& last - , Context& context, Skipper const& skipper, Attribute& attr) const + , Context& context, Skipper const& skipper, Attribute& attr_) const { qi::skip_over(first, last, skipper); Iterator i = first; if (subject.parse(i, last, context, skipper, unused)) { - spirit::traits::assign_to(first, i, attr); + spirit::traits::assign_to(first, i, attr_); first = i; return true; } diff --git a/boost/spirit/home/qi/directive/repeat.hpp b/boost/spirit/home/qi/directive/repeat.hpp index 252e18f743..72c3a998be 100644 --- a/boost/spirit/home/qi/directive/repeat.hpp +++ b/boost/spirit/home/qi/directive/repeat.hpp @@ -81,8 +81,8 @@ namespace boost { namespace spirit { namespace qi template <typename T> struct exact_iterator // handles repeat(exact)[p] { - exact_iterator(T const exact) - : exact(exact) {} + exact_iterator(T const exact_) + : exact(exact_) {} typedef T type; T start() const { return 0; } @@ -99,9 +99,9 @@ namespace boost { namespace spirit { namespace qi template <typename T> struct finite_iterator // handles repeat(min, max)[p] { - finite_iterator(T const min, T const max) - : min BOOST_PREVENT_MACRO_SUBSTITUTION (min) - , max BOOST_PREVENT_MACRO_SUBSTITUTION (max) {} + finite_iterator(T const min_, T const max_) + : min BOOST_PREVENT_MACRO_SUBSTITUTION (min_) + , max BOOST_PREVENT_MACRO_SUBSTITUTION (max_) {} typedef T type; T start() const { return 0; } @@ -119,8 +119,8 @@ namespace boost { namespace spirit { namespace qi template <typename T> struct infinite_iterator // handles repeat(min, inf)[p] { - infinite_iterator(T const min) - : min BOOST_PREVENT_MACRO_SUBSTITUTION (min) {} + infinite_iterator(T const min_) + : min BOOST_PREVENT_MACRO_SUBSTITUTION (min_) {} typedef T type; T start() const { return 0; } @@ -153,8 +153,8 @@ namespace boost { namespace spirit { namespace qi type; }; - repeat_parser(Subject const& subject, LoopIter const& iter) - : subject(subject), iter(iter) {} + repeat_parser(Subject const& subject_, LoopIter const& iter_) + : subject(subject_), iter(iter_) {} template <typename F> bool parse_container(F f) const @@ -183,17 +183,17 @@ namespace boost { namespace spirit { namespace qi , typename Skipper, typename Attribute> bool parse(Iterator& first, Iterator const& last , Context& context, Skipper const& skipper - , Attribute& attr) const + , Attribute& attr_) const { typedef detail::fail_function<Iterator, Context, Skipper> fail_function; // ensure the attribute is actually a container type - traits::make_container(attr); + traits::make_container(attr_); - Iterator iter = first; - fail_function f(iter, last, context, skipper); - if (!parse_container(detail::make_pass_container(f, attr))) + Iterator iter_local = first; + fail_function f(iter_local, last, context, skipper); + if (!parse_container(detail::make_pass_container(f, attr_))) return false; first = f.first; diff --git a/boost/spirit/home/qi/directive/skip.hpp b/boost/spirit/home/qi/directive/skip.hpp index 28539da3a0..6cc6f77454 100644 --- a/boost/spirit/home/qi/directive/skip.hpp +++ b/boost/spirit/home/qi/directive/skip.hpp @@ -26,6 +26,7 @@ #include <boost/spirit/home/support/handles_container.hpp> #include <boost/fusion/include/at.hpp> #include <boost/fusion/include/vector.hpp> +#include <boost/utility/enable_if.hpp> namespace boost { namespace spirit { @@ -70,17 +71,28 @@ namespace boost { namespace spirit { namespace qi type; }; - reskip_parser(Subject const& subject) - : subject(subject) {} + reskip_parser(Subject const& subject_) + : subject(subject_) {} template <typename Iterator, typename Context , typename Skipper, typename Attribute> - bool parse(Iterator& first, Iterator const& last + typename enable_if<detail::is_unused_skipper<Skipper>, bool>::type + parse(Iterator& first, Iterator const& last , Context& context, Skipper const& u // --> The skipper is reintroduced - , Attribute& attr) const + , Attribute& attr_) const + { + return subject.parse(first, last, context + , detail::get_skipper(u), attr_); + } + template <typename Iterator, typename Context + , typename Skipper, typename Attribute> + typename disable_if<detail::is_unused_skipper<Skipper>, bool>::type + parse(Iterator& first, Iterator const& last + , Context& context, Skipper const& skipper + , Attribute& attr_) const { return subject.parse(first, last, context - , detail::get_skipper(u), attr); + , skipper, attr_); } template <typename Context> @@ -106,16 +118,16 @@ namespace boost { namespace spirit { namespace qi type; }; - skip_parser(Subject const& subject, Skipper const& skipper) - : subject(subject), skipper(skipper) {} + skip_parser(Subject const& subject_, Skipper const& skipper_) + : subject(subject_), skipper(skipper_) {} template <typename Iterator, typename Context , typename Skipper_, typename Attribute> bool parse(Iterator& first, Iterator const& last , Context& context, Skipper_ const& //skipper --> bypass the supplied skipper - , Attribute& attr) const + , Attribute& attr_) const { - return subject.parse(first, last, context, skipper, attr); + return subject.parse(first, last, context, skipper, attr_); } template <typename Context> |