summaryrefslogtreecommitdiff
path: root/cli/traversal
diff options
context:
space:
mode:
authorKaren Arutyunov <karen@codesynthesis.com>2020-04-08 14:51:57 +0300
committerKaren Arutyunov <karen@codesynthesis.com>2020-04-27 11:38:53 +0300
commit720c5a33b6a49cf328fdd7611f49153cf8f60247 (patch)
tree9725f3d1f42ec90fde84520f49647edea013ce5e /cli/traversal
parent3183f3bb927a90783ae0aeaf190a0919377aabe4 (diff)
Separate tests and examples into individual packages
Also make cli module to be explicitly enabled via the config.cli configuration variable.
Diffstat (limited to 'cli/traversal')
-rw-r--r--cli/traversal/class.cxx49
-rw-r--r--cli/traversal/class.hxx41
-rw-r--r--cli/traversal/doc.hxx16
-rw-r--r--cli/traversal/elements.cxx14
-rw-r--r--cli/traversal/elements.hxx142
-rw-r--r--cli/traversal/expression.hxx16
-rw-r--r--cli/traversal/namespace.cxx26
-rw-r--r--cli/traversal/namespace.hxx26
-rw-r--r--cli/traversal/option.cxx59
-rw-r--r--cli/traversal/option.hxx74
-rw-r--r--cli/traversal/unit.cxx46
-rw-r--r--cli/traversal/unit.hxx58
12 files changed, 0 insertions, 567 deletions
diff --git a/cli/traversal/class.cxx b/cli/traversal/class.cxx
deleted file mode 100644
index b920f1f..0000000
--- a/cli/traversal/class.cxx
+++ /dev/null
@@ -1,49 +0,0 @@
-// file : cli/traversal/class.cxx
-// author : Boris Kolpackov <boris@codesynthesis.com>
-// license : MIT; see accompanying LICENSE file
-
-#include <cli/traversal/class.hxx>
-
-namespace traversal
-{
- // inherits
- //
- void inherits::
- traverse (type& i)
- {
- dispatch (i.base ());
- }
-
- // class_
- //
- void class_::
- traverse (type& c)
- {
- pre (c);
- inherits (c);
- names (c);
- post (c);
- }
-
- void class_::
- inherits (type& c)
- {
- inherits (c, *this);
- }
-
- void class_::
- inherits (type& c, edge_dispatcher& d)
- {
- iterate_and_dispatch (c.inherits_begin (), c.inherits_end (), d);
- }
-
- void class_::
- pre (type&)
- {
- }
-
- void class_::
- post (type&)
- {
- }
-}
diff --git a/cli/traversal/class.hxx b/cli/traversal/class.hxx
deleted file mode 100644
index 38cbefc..0000000
--- a/cli/traversal/class.hxx
+++ /dev/null
@@ -1,41 +0,0 @@
-// file : cli/traversal/class.hxx
-// author : Boris Kolpackov <boris@codesynthesis.com>
-// license : MIT; see accompanying LICENSE file
-
-#ifndef CLI_TRAVERSAL_CLASS_HXX
-#define CLI_TRAVERSAL_CLASS_HXX
-
-#include <cli/traversal/elements.hxx>
-#include <cli/semantics/class.hxx>
-
-namespace traversal
-{
- struct inherits: edge<semantics::inherits>
- {
- inherits () {}
- inherits (node_dispatcher& n) {node_traverser (n);}
-
- virtual void
- traverse (type&);
- };
-
- struct class_: scope_template<semantics::class_>
- {
- virtual void
- traverse (type&);
-
- virtual void
- pre (type&);
-
- virtual void
- inherits (type&);
-
- virtual void
- inherits (type&, edge_dispatcher&);
-
- virtual void
- post (type&);
- };
-}
-
-#endif // CLI_TRAVERSAL_CLASS_HXX
diff --git a/cli/traversal/doc.hxx b/cli/traversal/doc.hxx
deleted file mode 100644
index 70a6dfd..0000000
--- a/cli/traversal/doc.hxx
+++ /dev/null
@@ -1,16 +0,0 @@
-// file : cli/traversal/doc.hxx
-// author : Boris Kolpackov <boris@codesynthesis.com>
-// license : MIT; see accompanying LICENSE file
-
-#ifndef CLI_TRAVERSAL_DOC_HXX
-#define CLI_TRAVERSAL_DOC_HXX
-
-#include <cli/traversal/elements.hxx>
-#include <cli/semantics/doc.hxx>
-
-namespace traversal
-{
- struct doc: node<semantics::doc> {};
-}
-
-#endif // CLI_TRAVERSAL_DOC_HXX
diff --git a/cli/traversal/elements.cxx b/cli/traversal/elements.cxx
deleted file mode 100644
index f3353f2..0000000
--- a/cli/traversal/elements.cxx
+++ /dev/null
@@ -1,14 +0,0 @@
-// file : cli/traversal/elements.cxx
-// author : Boris Kolpackov <boris@codesynthesis.com>
-// license : MIT; see accompanying LICENSE file
-
-#include <cli/traversal/elements.hxx>
-
-namespace traversal
-{
- void names::
- traverse (type& e)
- {
- dispatch (e.named ());
- }
-}
diff --git a/cli/traversal/elements.hxx b/cli/traversal/elements.hxx
deleted file mode 100644
index a2ada23..0000000
--- a/cli/traversal/elements.hxx
+++ /dev/null
@@ -1,142 +0,0 @@
-// file : cli/traversal/elements.hxx
-// author : Boris Kolpackov <boris@codesynthesis.com>
-// license : MIT; see accompanying LICENSE file
-
-#ifndef CLI_TRAVERSAL_ELEMENTS_HXX
-#define CLI_TRAVERSAL_ELEMENTS_HXX
-
-#include <cutl/compiler/traversal.hxx>
-
-#include <cli/semantics/elements.hxx>
-
-namespace traversal
-{
- using namespace cutl;
-
- //
- //
- typedef compiler::dispatcher<semantics::node> node_dispatcher;
- typedef compiler::dispatcher<semantics::edge> edge_dispatcher;
-
- //
- //
- struct node_base: node_dispatcher, edge_dispatcher
- {
- void
- edge_traverser (edge_dispatcher& d)
- {
- edge_dispatcher::traverser (d);
- }
-
- edge_dispatcher&
- edge_traverser ()
- {
- return *this;
- }
-
- using node_dispatcher::dispatch;
- using edge_dispatcher::dispatch;
-
- using edge_dispatcher::iterate_and_dispatch;
- };
-
- struct edge_base: edge_dispatcher, node_dispatcher
- {
- void
- node_traverser (node_dispatcher& d)
- {
- node_dispatcher::traverser (d);
- }
-
- node_dispatcher&
- node_traverser ()
- {
- return *this;
- }
-
- using edge_dispatcher::dispatch;
- using node_dispatcher::dispatch;
-
- using node_dispatcher::iterate_and_dispatch;
- };
-
- inline edge_base&
- operator>> (node_base& n, edge_base& e)
- {
- n.edge_traverser (e);
- return e;
- }
-
- inline node_base&
- operator>> (edge_base& e, node_base& n)
- {
- e.node_traverser (n);
- return n;
- }
-
- //
- //
- template <typename X>
- struct node: compiler::traverser_impl<X, semantics::node>,
- virtual node_base
- {
- };
-
- template <typename X>
- struct edge: compiler::traverser_impl<X, semantics::edge>,
- virtual edge_base
- {
- };
-
- // Edges
- //
-
- struct names: edge<semantics::names>
- {
- names ()
- {
- }
-
- names (node_dispatcher& n)
- {
- node_traverser (n);
- }
-
- virtual void
- traverse (type&);
- };
-
- // Nodes
- //
-
- struct nameable: node<semantics::nameable> {};
-
- template <typename T>
- struct scope_template: node<T>
- {
- public:
- virtual void
- traverse (T& s)
- {
- names (s);
- }
-
- virtual void
- names (T& s)
- {
- names (s, *this);
- }
-
- virtual void
- names (T& s, edge_dispatcher& d)
- {
- this->iterate_and_dispatch (s.names_begin (), s.names_end (), d);
- }
- };
-
- typedef scope_template<semantics::scope> scope;
-
- struct type: node<semantics::type> {};
-}
-
-#endif // CLI_TRAVERSAL_ELEMENTS_HXX
diff --git a/cli/traversal/expression.hxx b/cli/traversal/expression.hxx
deleted file mode 100644
index 0888455..0000000
--- a/cli/traversal/expression.hxx
+++ /dev/null
@@ -1,16 +0,0 @@
-// file : cli/traversal/expression.hxx
-// author : Boris Kolpackov <boris@codesynthesis.com>
-// license : MIT; see accompanying LICENSE file
-
-#ifndef CLI_TRAVERSAL_EXPRESSION_HXX
-#define CLI_TRAVERSAL_EXPRESSION_HXX
-
-#include <cli/traversal/elements.hxx>
-#include <cli/semantics/expression.hxx>
-
-namespace traversal
-{
- struct expression: node<semantics::expression> {};
-}
-
-#endif // CLI_TRAVERSAL_EXPRESSION_HXX
diff --git a/cli/traversal/namespace.cxx b/cli/traversal/namespace.cxx
deleted file mode 100644
index c938f77..0000000
--- a/cli/traversal/namespace.cxx
+++ /dev/null
@@ -1,26 +0,0 @@
-// file : cli/traversal/namespace.cxx
-// author : Boris Kolpackov <boris@codesynthesis.com>
-// license : MIT; see accompanying LICENSE file
-
-#include <cli/traversal/namespace.hxx>
-
-namespace traversal
-{
- void namespace_::
- traverse (type& n)
- {
- pre (n);
- names (n);
- post (n);
- }
-
- void namespace_::
- pre (type&)
- {
- }
-
- void namespace_::
- post (type&)
- {
- }
-}
diff --git a/cli/traversal/namespace.hxx b/cli/traversal/namespace.hxx
deleted file mode 100644
index 5709f2a..0000000
--- a/cli/traversal/namespace.hxx
+++ /dev/null
@@ -1,26 +0,0 @@
-// file : cli/traversal/namespace.hxx
-// author : Boris Kolpackov <boris@codesynthesis.com>
-// license : MIT; see accompanying LICENSE file
-
-#ifndef CLI_TRAVERSAL_NAMESPACE_HXX
-#define CLI_TRAVERSAL_NAMESPACE_HXX
-
-#include <cli/traversal/elements.hxx>
-#include <cli/semantics/namespace.hxx>
-
-namespace traversal
-{
- struct namespace_: scope_template<semantics::namespace_>
- {
- virtual void
- traverse (type&);
-
- virtual void
- pre (type&);
-
- virtual void
- post (type&);
- };
-}
-
-#endif // CLI_TRAVERSAL_NAMESPACE_HXX
diff --git a/cli/traversal/option.cxx b/cli/traversal/option.cxx
deleted file mode 100644
index ff5dcce..0000000
--- a/cli/traversal/option.cxx
+++ /dev/null
@@ -1,59 +0,0 @@
-// file : cli/traversal/option.cxx
-// author : Boris Kolpackov <boris@codesynthesis.com>
-// license : MIT; see accompanying LICENSE file
-
-#include <cli/traversal/option.hxx>
-#include <cli/traversal/expression.hxx>
-
-namespace traversal
-{
- // belongs
- //
- void belongs::
- traverse (type& e)
- {
- dispatch (e.type ());
- }
-
- // initialized
- //
- void initialized::
- traverse (type& e)
- {
- dispatch (e.expression ());
- }
-
- // option
- //
- void option::
- traverse (type& o)
- {
- pre (o);
- belongs (o);
- if (o.initialized_p ())
- initialized (o);
- post (o);
- }
-
- void option::
- pre (type&)
- {
- }
-
- void option::
- belongs (type& o)
- {
- belongs (o, edge_traverser ());
- }
-
- void option::
- initialized (type& o)
- {
- initialized (o, edge_traverser ());
- }
-
- void option::
- post (type&)
- {
- }
-}
diff --git a/cli/traversal/option.hxx b/cli/traversal/option.hxx
deleted file mode 100644
index e11fa21..0000000
--- a/cli/traversal/option.hxx
+++ /dev/null
@@ -1,74 +0,0 @@
-// file : cli/traversal/option.hxx
-// author : Boris Kolpackov <boris@codesynthesis.com>
-// license : MIT; see accompanying LICENSE file
-
-#ifndef CLI_TRAVERSAL_OPTION_HXX
-#define CLI_TRAVERSAL_OPTION_HXX
-
-#include <cli/traversal/elements.hxx>
-#include <cli/semantics/option.hxx>
-
-namespace traversal
-{
- struct belongs: edge<semantics::belongs>
- {
- belongs ()
- {
- }
-
- belongs (node_dispatcher& n)
- {
- node_traverser (n);
- }
-
- virtual void
- traverse (type&);
- };
-
- struct initialized: edge<semantics::initialized>
- {
- initialized ()
- {
- }
-
- initialized (node_dispatcher& n)
- {
- node_traverser (n);
- }
-
- virtual void
- traverse (type&);
- };
-
- struct option: node<semantics::option>
- {
- virtual void
- traverse (type&);
-
- virtual void
- pre (type&);
-
- virtual void
- belongs (type&);
-
- virtual void
- initialized (type&);
-
- virtual void
- post (type&);
-
- void
- belongs (type& o, edge_dispatcher& d)
- {
- d.dispatch (o.belongs ());
- }
-
- void
- initialized (type& o, edge_dispatcher& d)
- {
- d.dispatch (o.initialized ());
- }
- };
-}
-
-#endif // CLI_TRAVERSAL_OPTION_HXX
diff --git a/cli/traversal/unit.cxx b/cli/traversal/unit.cxx
deleted file mode 100644
index cf10d1d..0000000
--- a/cli/traversal/unit.cxx
+++ /dev/null
@@ -1,46 +0,0 @@
-// file : cli/traversal/unit.cxx
-// author : Boris Kolpackov <boris@codesynthesis.com>
-// license : MIT; see accompanying LICENSE file
-
-#include <cli/traversal/unit.hxx>
-
-namespace traversal
-{
- // cxx_includes
- //
- void cxx_includes::
- traverse (type& e)
- {
- dispatch (e.includee ());
- }
-
- // cli_includes
- //
- void cli_includes::
- traverse (type& e)
- {
- dispatch (e.includee ());
- }
-
- // cli_unit
- //
- void cli_unit::
- traverse (type& u)
- {
- pre (u);
- iterate_and_dispatch (
- u.includes_begin (), u.includes_end (), edge_traverser ());
- names (u);
- post (u);
- }
-
- void cli_unit::
- pre (type&)
- {
- }
-
- void cli_unit::
- post (type&)
- {
- }
-}
diff --git a/cli/traversal/unit.hxx b/cli/traversal/unit.hxx
deleted file mode 100644
index eab42aa..0000000
--- a/cli/traversal/unit.hxx
+++ /dev/null
@@ -1,58 +0,0 @@
-// file : cli/traversal/unit.hxx
-// author : Boris Kolpackov <boris@codesynthesis.com>
-// license : MIT; see accompanying LICENSE file
-
-#ifndef CLI_TRAVERSAL_UNIT_HXX
-#define CLI_TRAVERSAL_UNIT_HXX
-
-#include <cli/traversal/elements.hxx>
-#include <cli/semantics/unit.hxx>
-
-namespace traversal
-{
- struct cxx_includes: edge<semantics::cxx_includes>
- {
- cxx_includes ()
- {
- }
-
- cxx_includes (node_dispatcher& n)
- {
- node_traverser (n);
- }
-
- virtual void
- traverse (type&);
- };
-
- struct cli_includes: edge<semantics::cli_includes>
- {
- cli_includes ()
- {
- }
-
- cli_includes (node_dispatcher& n)
- {
- node_traverser (n);
- }
-
- virtual void
- traverse (type&);
- };
-
- struct cxx_unit: node<semantics::cxx_unit> {};
-
- struct cli_unit: scope_template<semantics::cli_unit>
- {
- virtual void
- traverse (type&);
-
- virtual void
- pre (type&);
-
- virtual void
- post (type&);
- };
-}
-
-#endif // CLI_TRAVERSAL_UNIT_HXX