|
Boost-Commit : |
Subject: [Boost-commit] svn:boost r76840 - in sandbox/metagraph: boost/metagraph/angly boost/metagraph/mpl_graph/detail libs/metagraph/example
From: gordon_at_[hidden]
Date: 2012-02-02 15:40:32
Author: gordon.woodhull
Date: 2012-02-02 15:40:31 EST (Thu, 02 Feb 2012)
New Revision: 76840
URL: http://svn.boost.org/trac/boost/changeset/76840
Log:
just a little formatting and comments
Text files modified:
sandbox/metagraph/boost/metagraph/angly/dfa.hpp | 2 +-
sandbox/metagraph/boost/metagraph/angly/dfa_lang.hpp | 30 ++++++++++++++++++------------
sandbox/metagraph/boost/metagraph/mpl_graph/detail/incidence_list_graph.ipp | 2 ++
sandbox/metagraph/libs/metagraph/example/depth_first_search.cpp | 2 +-
4 files changed, 22 insertions(+), 14 deletions(-)
Modified: sandbox/metagraph/boost/metagraph/angly/dfa.hpp
==============================================================================
--- sandbox/metagraph/boost/metagraph/angly/dfa.hpp (original)
+++ sandbox/metagraph/boost/metagraph/angly/dfa.hpp 2012-02-02 15:40:31 EST (Thu, 02 Feb 2012)
@@ -338,7 +338,7 @@
// currently (undocumented ;) in dfa_iter<>::state
template<typename DFA, typename StartState, typename Input, typename PropFn>
struct dfa_sequence {
- typedef typename detail::de_arg<Input>::type token;
+ typedef typename detail::de_arg<Input>::type token; // unchecked; we should actually work with single_view<Input> as starting sequence and add start state to parsers
typedef typename detail::arg_seq<Input>::type inner_seq;
typedef typename detail::create_stack<typename get_state_start_data<typename PropFn::template apply<StartState>::type>::type, StartState, typename mpl::begin<inner_seq>::type, typename mpl::end<inner_seq>::type>::type stack;
typedef detail::dfa_iter<DFA, stack, PropFn> begin;
Modified: sandbox/metagraph/boost/metagraph/angly/dfa_lang.hpp
==============================================================================
--- sandbox/metagraph/boost/metagraph/angly/dfa_lang.hpp (original)
+++ sandbox/metagraph/boost/metagraph/angly/dfa_lang.hpp 2012-02-02 15:40:31 EST (Thu, 02 Feb 2012)
@@ -19,6 +19,11 @@
struct state {};
template<typename ...>
struct transition {};
+ // we'd prefer true attributes but are settling for crude semantic actions for now
+ // this special one records a map of names to data, a common requirement for graph parsers
+ // key lambda and value lambda are applied to _1 parent data and _2 child data as all other lambdas
+ template<typename KeyLambda, typename ValueLambda>
+ struct record {};
// parser for descriptions of parsers
// dfa<state<name, [is_finish, [data,]] [transition<name, target, [match_fn, [recurse_rule, [post_action, [pre_action]]]]>],
@@ -37,6 +42,7 @@
struct transition_recurse : dfa_state<mpl::true_> {};
struct transition_post_action : dfa_state<mpl::true_> {};
struct transition_pre_action : dfa_state<mpl::true_> {};
+ struct transition_record : dfa_state<mpl::true_> {};
struct transition_done : dfa_state<mpl::true_> {};
// there are two horrible thing about building at DFA this way:
@@ -107,28 +113,28 @@
struct state_finish_transition : state_transition {};
struct transition_name_trans :
dfa_transition<mpl::always<mpl::true_>,
- void,
- mpl::vector1<mpl::_2> > {};
+ void,
+ mpl::vector1<mpl::_2> > {};
struct transition_target_trans :
dfa_transition<mpl::always<mpl::true_>,
- void,
- mpl::push_back<mpl::_1,mpl::_2> > {};
+ void,
+ mpl::push_back<mpl::_1,mpl::_2> > {};
struct transition_match_trans :
dfa_transition<mpl::always<mpl::true_>,
- void,
- mpl::push_back<mpl::_1,mpl::_2> > {};
+ void,
+ mpl::push_back<mpl::_1,mpl::_2> > {};
struct transition_recurse_trans :
dfa_transition<mpl::always<mpl::true_>,
- void,
- mpl::push_back<mpl::_1,mpl::_2> > {};
+ void,
+ mpl::push_back<mpl::_1,mpl::_2> > {};
struct transition_post_action_trans :
dfa_transition<mpl::always<mpl::true_>,
- void,
- mpl::push_back<mpl::_1,mpl::lambda<mpl::_2> > > {};
+ void,
+ mpl::push_back<mpl::_1,mpl::lambda<mpl::_2> > > {};
struct transition_pre_action_trans :
dfa_transition<mpl::always<mpl::true_>,
- void,
- mpl::push_back<mpl::_1,mpl::_2> > {};
+ void,
+ mpl::push_back<mpl::_1,mpl::lambda<mpl::_2> > > {};
typedef boost::msm::mpl_graph::adjacency_list_graph<
mpl::vector<mpl::pair<dfa_states,
Modified: sandbox/metagraph/boost/metagraph/mpl_graph/detail/incidence_list_graph.ipp
==============================================================================
--- sandbox/metagraph/boost/metagraph/mpl_graph/detail/incidence_list_graph.ipp (original)
+++ sandbox/metagraph/boost/metagraph/mpl_graph/detail/incidence_list_graph.ipp 2012-02-02 15:40:31 EST (Thu, 02 Feb 2012)
@@ -59,6 +59,7 @@
mpl::back<EST> {};
// Edge->Target map for an Source for out_*, adjacent_vertices
+// would it be more efficient to build Source->Edge->Target map-of-maps like adjacency does?
template<typename Source, typename ESTSequence>
struct produce_out_map<incidence_list_tag, Source, ESTSequence> :
mpl::fold<typename mpl::filter_view<ESTSequence, boost::is_same<fetch_source<mpl::_1>,Source> >::type,
@@ -95,6 +96,7 @@
mpl::insert<mpl::_1, fetch_source<mpl::_2> > >
{};
// Edge set for EdgeListGraph
+// wouldn't it be more efficient to adapt edge_st_map? assuming both concepts will be used
template<typename ESTSequence>
struct produce_edge_set<incidence_list_tag, ESTSequence> :
mpl::fold<ESTSequence,
Modified: sandbox/metagraph/libs/metagraph/example/depth_first_search.cpp
==============================================================================
--- sandbox/metagraph/libs/metagraph/example/depth_first_search.cpp (original)
+++ sandbox/metagraph/libs/metagraph/example/depth_first_search.cpp 2012-02-02 15:40:31 EST (Thu, 02 Feb 2012)
@@ -150,4 +150,4 @@
int main() {
return 0;
-}
\ No newline at end of file
+}
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