Skip to content

Commit

Permalink
Merge pull request #27069 from dschwen/spirit_27068
Browse files Browse the repository at this point in the history
Add boost::spirit
  • Loading branch information
loganharbour authored Mar 13, 2024
2 parents 6babef3 + 9cd6d06 commit 9873be4
Show file tree
Hide file tree
Showing 1,012 changed files with 146,534 additions and 2 deletions.
32 changes: 32 additions & 0 deletions framework/contrib/boost/include/boost/spirit/home/classic.hpp
Original file line number Diff line number Diff line change
@@ -0,0 +1,32 @@
/*=============================================================================
Copyright (c) 1998-2008 Joel de Guzman
Copyright (c) 2001-2008 Hartmut Kaiser
Copyright (c) 2001-2003 Daniel Nuffer
Copyright (c) 2002-2003 Martin Wille
Copyright (c) 2002 Juan Carlos Arevalo-Baeza
Copyright (c) 2002 Raghavendra Satish
Copyright (c) 2002 Jeff Westfahl
Copyright (c) 2001 Bruce Florman
Copyright (c) 2003 Giovanni Bajo
Copyright (c) 2003 Vaclav Vesely
Copyright (c) 2003 Jonathan de Halleux
http://spirit.sourceforge.net/
http://www.boost.org/libs/spirit
Distributed under the Boost Software License, Version 1.0. (See accompanying
file LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt)
See http://www.boost.org/libs/spirit for documentation
=============================================================================*/
#if !defined(BOOST_SPIRIT_CLASSIC_APRIL_11_2008_0849AM)
#define BOOST_SPIRIT_CLASSIC_APRIL_11_2008_0849AM

#include <boost/spirit/home/classic/core.hpp>
#include <boost/spirit/home/classic/meta.hpp>
#include <boost/spirit/home/classic/error_handling.hpp>
#include <boost/spirit/home/classic/iterator.hpp>
#include <boost/spirit/home/classic/symbols.hpp>
#include <boost/spirit/home/classic/utility.hpp>
#include <boost/spirit/home/classic/attribute.hpp>

#endif
113 changes: 113 additions & 0 deletions framework/contrib/boost/include/boost/spirit/home/classic/actor.hpp
Original file line number Diff line number Diff line change
@@ -0,0 +1,113 @@
/*=============================================================================
Copyright (c) 2003 Jonathan de Halleux ([email protected])
http://spirit.sourceforge.net/
Distributed under the Boost Software License, Version 1.0. (See accompanying
file LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt)
=============================================================================*/
#ifndef BOOST_SPIRIT_ACTOR_HPP
#define BOOST_SPIRIT_ACTOR_HPP

#include <boost/spirit/home/classic/version.hpp>

///////////////////////////////////////////////////////////////////////////////
//
// Actors documentation and convention
//
// Actors
//
// Actors are predefined semantic action functors. They are used to do an
// action on the parse result if the parser has had a successful match. An
// example of actor is the append_actor described in the Spirit
// documentation.
//
// The action takes place through a call to the () operator: single argument
// () operator call for character parsers and two argument (first,last) call
// for phrase parsers. Actors should implement at least one of the two ()
// operator.
//
// Actor instances are not created directly since they usually involve a
// number of template parameters. Instead generator functions ("helper
// functions") are provided to generate actors according to their arguments.
// All helper functions have the "_a" suffix. For example, append_actor is
// created using the append_a function.
//
// Policy holder actors and policy actions
//
// A lot of actors need to store reference to one or more objects. For
// example, actions on container need to store a reference to the container.
// Therefore, this kind of actor have been broken down into
//
// - a action policy that does the action (act method),
// - a policy holder actor that stores the references and feeds the act
// method.
//
// Policy holder actors
//
// Policy holder have the following naming convention:
// <member>_ >> *<member> >> !value >> actor
// where member are the policy stored member, they can be of type:
//
// - ref, a reference,
// - const_ref, a const reference,
// - value, by value,
// - empty, no stored members
// - !value states if the policy uses the parse result or not.
//
// The available policy holder are enumerated below:
//
// - empty_actor, nothing stored, feeds parse result
// - value_actor, 1 object stored by value, feeds value
// - ref_actor, 1 reference stored, feeds ref
// - ref_value_actor, 1 reference stored, feeds ref and parse result
//
// Doc. convention
//
// - ref is a reference to an object stored in a policy holder actor,
// - value_ref,value1_ref, value2_ref are a const reference stored in a
// policy holder actor,
// - value is the parse result in the single argument () operator,
// - first,last are the parse result in the two argument () operator
//
// Actors (generator functions) and quick description
//
// - assign_a(ref) assign parse result to ref
// - assign_a(ref, value_ref) assign value_ref to ref
// - increment_a(ref) increment ref
// - decrement_a(ref) decrement ref
// - push_back_a(ref) push back the parse result in ref
// - push_back_a(ref, value_ref) push back value_ref in ref
// - push_front_a(ref) push front the parse result in ref
// - push_front_a(ref, value_ref) push front value_ref in ref
// - insert_key_a(ref,value_ref) insert value_ref in ref using the
// parse result as key
// - insert_at_a(ref, key_ref) insert the parse result in ref at key_ref
// - insert_at_a(ref, key_ref insert value_ref in ref at key_ref
// , value_ref)
// - assign_key_a(ref, value_ref) assign value_ref in ref using the
// parse result as key
// - erase_a(ref, key) erase data at key from ref
// - clear_a(ref) clears ref
// - swap_a(aref, bref) swaps aref and bref
//
///////////////////////////////////////////////////////////////////////////////

#include <boost/spirit/home/classic/actor/ref_actor.hpp>
#include <boost/spirit/home/classic/actor/ref_value_actor.hpp>
#include <boost/spirit/home/classic/actor/ref_const_ref_actor.hpp>
#include <boost/spirit/home/classic/actor/ref_const_ref_value_actor.hpp>
#include <boost/spirit/home/classic/actor/ref_const_ref_const_ref_a.hpp>

#include <boost/spirit/home/classic/actor/assign_actor.hpp>
#include <boost/spirit/home/classic/actor/clear_actor.hpp>
#include <boost/spirit/home/classic/actor/increment_actor.hpp>
#include <boost/spirit/home/classic/actor/decrement_actor.hpp>
#include <boost/spirit/home/classic/actor/push_back_actor.hpp>
#include <boost/spirit/home/classic/actor/push_front_actor.hpp>
#include <boost/spirit/home/classic/actor/erase_actor.hpp>
#include <boost/spirit/home/classic/actor/insert_key_actor.hpp>
#include <boost/spirit/home/classic/actor/insert_at_actor.hpp>
#include <boost/spirit/home/classic/actor/assign_key_actor.hpp>
#include <boost/spirit/home/classic/actor/swap_actor.hpp>

#endif
Original file line number Diff line number Diff line change
@@ -0,0 +1,100 @@
/*=============================================================================
Copyright (c) 2003 Jonathan de Halleux ([email protected])
http://spirit.sourceforge.net/
Distributed under the Boost Software License, Version 1.0. (See accompanying
file LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt)
=============================================================================*/
#ifndef BOOST_SPIRIT_ACTOR_ASSIGN_ACTOR_HPP
#define BOOST_SPIRIT_ACTOR_ASSIGN_ACTOR_HPP

#include <boost/spirit/home/classic/namespace.hpp>
#include <boost/spirit/home/classic/actor/ref_value_actor.hpp>
#include <boost/spirit/home/classic/actor/ref_const_ref_actor.hpp>

namespace boost { namespace spirit {

BOOST_SPIRIT_CLASSIC_NAMESPACE_BEGIN

///////////////////////////////////////////////////////////////////////////
// Summary:
// A semantic action policy that applies the assignment operator.
// (This doc uses convention available in actors.hpp)
//
// Actions (what it does):
// ref = value;
// ref = T(first,last);
// ref = value_ref;
//
// Policy name:
// assign_action
//
// Policy holder, corresponding helper method:
// ref_value_actor, assign_a( ref );
// ref_const_ref_actor, assign_a( ref, value_ref );
//
// () operators: both
//
// See also ref_value_actor and ref_const_ref_actor for more details.
///////////////////////////////////////////////////////////////////////////
struct assign_action
{
template<
typename T,
typename ValueT
>
void act(T& ref_, ValueT const& value_) const
{
ref_ = value_;
}
template<
typename T,
typename IteratorT
>
void act(
T& ref_,
IteratorT const& first_,
IteratorT const& last_
) const
{
typedef T value_type;
#ifndef BOOST_NO_TEMPLATED_ITERATOR_CONSTRUCTORS
value_type value(first_,last_);
#else
value_type value;
std::copy(first_, last_, std::inserter(value, value.end()));
#endif
ref_ = value;
}
};

// Deprecated. Please use assign_a
template<typename T>
inline ref_value_actor<T,assign_action> assign(T& ref_)
{
return ref_value_actor<T,assign_action>(ref_);
}

template<typename T>
inline ref_value_actor<T,assign_action> assign_a(T& ref_)
{
return ref_value_actor<T,assign_action>(ref_);
}

template<
typename T,
typename ValueT
>
inline ref_const_ref_actor<T,ValueT,assign_action> assign_a(
T& ref_,
ValueT const& value_
)
{
return ref_const_ref_actor<T,ValueT,assign_action>(ref_,value_);
}

BOOST_SPIRIT_CLASSIC_NAMESPACE_END

}}

#endif
Original file line number Diff line number Diff line change
@@ -0,0 +1,96 @@
/*=============================================================================
Copyright (c) 2003 Jonathan de Halleux ([email protected])
http://spirit.sourceforge.net/
Distributed under the Boost Software License, Version 1.0. (See accompanying
file LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt)
=============================================================================*/
#ifndef BOOST_SPIRIT_ACTOR_ASSIGN_KEY_ACTOR_HPP
#define BOOST_SPIRIT_ACTOR_ASSIGN_KEY_ACTOR_HPP

#include <boost/spirit/home/classic/namespace.hpp>
#include <boost/spirit/home/classic/actor/ref_const_ref_value_actor.hpp>
#include <boost/spirit/home/classic/actor/ref_const_ref_const_ref_a.hpp>

namespace boost { namespace spirit {

BOOST_SPIRIT_CLASSIC_NAMESPACE_BEGIN

struct assign_key_action
{
template<
typename T,
typename ValueT,
typename KeyT
>
void act(T& ref_, ValueT const& value_, KeyT const& key_) const
{
ref_[ key_ ] = value_;
}

template<
typename T,
typename ValueT,
typename IteratorT
>
void act(
T& ref_,
ValueT const& value_,
IteratorT const& first_,
IteratorT const& last_
) const
{
typedef typename T::key_type key_type;
key_type key(first_,last_);

ref_[key] = value_;
}
};

template<
typename T,
typename ValueT
>
inline ref_const_ref_value_actor<T,ValueT,assign_key_action>
assign_key_a(T& ref_, ValueT const& value_)
{
return ref_const_ref_value_actor<T,ValueT,assign_key_action>(
ref_,
value_
);
}

template<
typename T,
typename ValueT,
typename KeyT
>
inline ref_const_ref_const_ref_actor<
T,
ValueT,
KeyT,
assign_key_action
>
assign_key_a(
T& ref_,
ValueT const& value_,
KeyT const& key_
)
{
return ref_const_ref_const_ref_actor<
T,
ValueT,
KeyT,
assign_key_action
>(
ref_,
value_,
key_
);
}

BOOST_SPIRIT_CLASSIC_NAMESPACE_END

}}

#endif
Loading

0 comments on commit 9873be4

Please sign in to comment.