|
Boost-Commit : |
Subject: [Boost-commit] svn:boost r73115 - in trunk/libs/spirit/example/qi/compiler_tutorial: conjure1 conjure2
From: joel_at_[hidden]
Date: 2011-07-14 20:38:21
Author: djowel
Date: 2011-07-14 20:38:20 EDT (Thu, 14 Jul 2011)
New Revision: 73115
URL: http://svn.boost.org/trac/boost/changeset/73115
Log:
fixed ID annotation
Text files modified:
trunk/libs/spirit/example/qi/compiler_tutorial/conjure1/annotation.hpp | 16 ++++++----------
trunk/libs/spirit/example/qi/compiler_tutorial/conjure2/annotation.hpp | 16 ++++++----------
2 files changed, 12 insertions(+), 20 deletions(-)
Modified: trunk/libs/spirit/example/qi/compiler_tutorial/conjure1/annotation.hpp
==============================================================================
--- trunk/libs/spirit/example/qi/compiler_tutorial/conjure1/annotation.hpp (original)
+++ trunk/libs/spirit/example/qi/compiler_tutorial/conjure1/annotation.hpp 2011-07-14 20:38:20 EDT (Thu, 14 Jul 2011)
@@ -37,24 +37,20 @@
int id;
set_id(int id) : id(id) {}
- template <typename T>
- void operator()(T& x) const
+ void operator()(ast::function_call& x) const
{
- this->dispatch(x, boost::is_base_of<ast::tagged, T>());
+ x.function_name.id = id;
}
- // This will catch all nodes except those inheriting from ast::tagged
- template <typename T>
- void dispatch(T& x, boost::mpl::false_) const
+ void operator()(ast::identifier& x) const
{
- // (no-op) no need for tags
+ x.id = id;
}
- // This will catch all nodes inheriting from ast::tagged
template <typename T>
- void dispatch(T& x, boost::mpl::true_) const
+ void operator()(T& x) const
{
- x.id = id;
+ // no-op
}
};
Modified: trunk/libs/spirit/example/qi/compiler_tutorial/conjure2/annotation.hpp
==============================================================================
--- trunk/libs/spirit/example/qi/compiler_tutorial/conjure2/annotation.hpp (original)
+++ trunk/libs/spirit/example/qi/compiler_tutorial/conjure2/annotation.hpp 2011-07-14 20:38:20 EDT (Thu, 14 Jul 2011)
@@ -37,24 +37,20 @@
int id;
set_id(int id) : id(id) {}
- template <typename T>
- void operator()(T& x) const
+ void operator()(ast::function_call& x) const
{
- this->dispatch(x, boost::is_base_of<ast::tagged, T>());
+ x.function_name.id = id;
}
- // This will catch all nodes except those inheriting from ast::tagged
- template <typename T>
- void dispatch(T& x, boost::mpl::false_) const
+ void operator()(ast::identifier& x) const
{
- // (no-op) no need for tags
+ x.id = id;
}
- // This will catch all nodes inheriting from ast::tagged
template <typename T>
- void dispatch(T& x, boost::mpl::true_) const
+ void operator()(T& x) const
{
- x.id = id;
+ // no-op
}
};
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