|
Boost-Commit : |
From: hartmut.kaiser_at_[hidden]
Date: 2008-07-12 22:52:09
Author: hkaiser
Date: 2008-07-12 22:52:08 EDT (Sat, 12 Jul 2008)
New Revision: 47375
URL: http://svn.boost.org/trac/boost/changeset/47375
Log:
Spirit: More adjustments for new qi::grammar type
Text files modified:
trunk/libs/spirit/example/karma/calc2_ast_dump.cpp | 9 ++++-----
trunk/libs/spirit/example/karma/calc2_ast_rpn.cpp | 7 +++----
trunk/libs/spirit/example/karma/calc2_ast_vm.cpp | 7 +++----
trunk/libs/spirit/example/karma/mini_xml_karma.cpp | 7 +++----
trunk/libs/spirit/example/lex/example6.cpp | 6 +-----
5 files changed, 14 insertions(+), 22 deletions(-)
Modified: trunk/libs/spirit/example/karma/calc2_ast_dump.cpp
==============================================================================
--- trunk/libs/spirit/example/karma/calc2_ast_dump.cpp (original)
+++ trunk/libs/spirit/example/karma/calc2_ast_dump.cpp 2008-07-12 22:52:08 EDT (Sat, 12 Jul 2008)
@@ -32,9 +32,9 @@
// Our calculator parser grammar
///////////////////////////////////////////////////////////////////////////////
template <typename Iterator>
-struct calculator : qi::grammar_def<Iterator, expression_ast(), space_type>
+struct calculator : qi::grammar<Iterator, expression_ast(), space_type>
{
- calculator()
+ calculator() : calculator::base_type(expression)
{
expression =
term [_val = _1]
@@ -111,13 +111,12 @@
typedef std::string::const_iterator iterator_type;
typedef calculator<iterator_type> calculator;
- calculator def;
- qi::grammar<calculator> calc(def, def.expression);
+ calculator calc;
// Our generator grammar definitions
typedef std::back_insert_iterator<std::string> output_iterator_type;
typedef dump_ast<output_iterator_type> dump_ast;
-
+
dump_ast dump_ast_def;
karma::grammar<dump_ast> ast_grammar(dump_ast_def, dump_ast_def.ast_node);
Modified: trunk/libs/spirit/example/karma/calc2_ast_rpn.cpp
==============================================================================
--- trunk/libs/spirit/example/karma/calc2_ast_rpn.cpp (original)
+++ trunk/libs/spirit/example/karma/calc2_ast_rpn.cpp 2008-07-12 22:52:08 EDT (Sat, 12 Jul 2008)
@@ -32,9 +32,9 @@
// Our calculator parser grammar
///////////////////////////////////////////////////////////////////////////////
template <typename Iterator>
-struct calculator : qi::grammar_def<Iterator, expression_ast(), space_type>
+struct calculator : qi::grammar<Iterator, expression_ast(), space_type>
{
- calculator()
+ calculator() : calculator::base_type(expression)
{
expression =
term [_val = _1]
@@ -114,8 +114,7 @@
typedef std::string::const_iterator iterator_type;
typedef calculator<iterator_type> calculator;
- calculator def;
- qi::grammar<calculator> calc(def, def.expression);
+ calculator calc;
// Our generator grammar definitions
typedef std::back_insert_iterator<std::string> output_iterator_type;
Modified: trunk/libs/spirit/example/karma/calc2_ast_vm.cpp
==============================================================================
--- trunk/libs/spirit/example/karma/calc2_ast_vm.cpp (original)
+++ trunk/libs/spirit/example/karma/calc2_ast_vm.cpp 2008-07-12 22:52:08 EDT (Sat, 12 Jul 2008)
@@ -34,9 +34,9 @@
// Our calculator parser grammar
///////////////////////////////////////////////////////////////////////////////
template <typename Iterator>
-struct calculator : qi::grammar_def<Iterator, expression_ast(), space_type>
+struct calculator : qi::grammar<Iterator, expression_ast(), space_type>
{
- calculator()
+ calculator() : calculator::base_type(expression)
{
expression =
term [_val = _1]
@@ -195,8 +195,7 @@
typedef std::string::const_iterator iterator_type;
typedef calculator<iterator_type> calculator;
- calculator def;
- qi::grammar<calculator> calc(def, def.expression);
+ calculator calc;
std::string str;
while (std::getline(std::cin, str))
Modified: trunk/libs/spirit/example/karma/mini_xml_karma.cpp
==============================================================================
--- trunk/libs/spirit/example/karma/mini_xml_karma.cpp (original)
+++ trunk/libs/spirit/example/karma/mini_xml_karma.cpp 2008-07-12 22:52:08 EDT (Sat, 12 Jul 2008)
@@ -71,9 +71,9 @@
///////////////////////////////////////////////////////////////////////////////
template <typename Iterator>
struct mini_xml_parser :
- qi::grammar_def<Iterator, mini_xml(), space_type>
+ qi::grammar<Iterator, mini_xml(), space_type>
{
- mini_xml_parser()
+ mini_xml_parser() : mini_xml_parser::base_type(xml)
{
text = lexeme[+(char_ - '<') [_val += _1]];
node = (xml | text) [_val = _1];
@@ -180,8 +180,7 @@
std::back_inserter(storage));
typedef mini_xml_parser<std::string::const_iterator> mini_xml_parser;
- mini_xml_parser def; // Our grammar definition
- qi::grammar<mini_xml_parser> xmlin(def, def.xml); // Our grammar
+ mini_xml_parser xmlin; // Our grammar definition
mini_xml ast; // our tree
std::string::const_iterator iter = storage.begin();
Modified: trunk/libs/spirit/example/lex/example6.cpp
==============================================================================
--- trunk/libs/spirit/example/lex/example6.cpp (original)
+++ trunk/libs/spirit/example/lex/example6.cpp 2008-07-12 22:52:08 EDT (Sat, 12 Jul 2008)
@@ -124,13 +124,9 @@
struct example6_grammar
: grammar<Iterator, in_state_skipper<typename Lexer::token_set> >
{
- typedef
- grammar<Iterator, in_state_skipper<typename Lexer::token_set> >
- base_type;
-
template <typename TokenDef>
example6_grammar(TokenDef const& tok)
- : base_type(program)
+ : example6_grammar::base_type(program)
{
program
= +block
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