|
Boost-Commit : |
Subject: [Boost-commit] svn:boost r59293 - in branches/quickbook-1.5-spirit2: . detail
From: daniel_james_at_[hidden]
Date: 2010-01-27 17:00:25
Author: danieljames
Date: 2010-01-27 17:00:23 EST (Wed, 27 Jan 2010)
New Revision: 59293
URL: http://svn.boost.org/trac/boost/changeset/59293
Log:
Detemplate the grammars.
Removed:
branches/quickbook-1.5-spirit2/detail/code_snippet.cpp
Text files modified:
branches/quickbook-1.5-spirit2/Jamfile.v2 | 1
branches/quickbook-1.5-spirit2/block.hpp | 23 +++++++---------
branches/quickbook-1.5-spirit2/code_snippet.hpp | 33 +++++++++--------------
branches/quickbook-1.5-spirit2/detail/actions.cpp | 8 ++--
branches/quickbook-1.5-spirit2/detail/block.cpp | 9 ------
branches/quickbook-1.5-spirit2/detail/doc_info.cpp | 9 ------
branches/quickbook-1.5-spirit2/detail/phrase.cpp | 14 ----------
branches/quickbook-1.5-spirit2/detail/quickbook.cpp | 4 +-
branches/quickbook-1.5-spirit2/detail/syntax_highlight.cpp | 12 ++------
branches/quickbook-1.5-spirit2/doc_info.hpp | 21 ++++++--------
branches/quickbook-1.5-spirit2/grammars.hpp | 39 ++++++++++++----------------
branches/quickbook-1.5-spirit2/phrase.hpp | 55 +++++++++++++++++----------------------
branches/quickbook-1.5-spirit2/syntax_highlight.hpp | 53 ++++++++++++++++---------------------
13 files changed, 105 insertions(+), 176 deletions(-)
Modified: branches/quickbook-1.5-spirit2/Jamfile.v2
==============================================================================
--- branches/quickbook-1.5-spirit2/Jamfile.v2 (original)
+++ branches/quickbook-1.5-spirit2/Jamfile.v2 2010-01-27 17:00:23 EST (Wed, 27 Jan 2010)
@@ -30,7 +30,6 @@
detail/phrase.cpp
detail/block.cpp
detail/doc_info.cpp
- detail/code_snippet.cpp
detail/syntax_highlight.cpp
/boost//program_options
/boost//filesystem
Modified: branches/quickbook-1.5-spirit2/block.hpp
==============================================================================
--- branches/quickbook-1.5-spirit2/block.hpp (original)
+++ branches/quickbook-1.5-spirit2/block.hpp 2010-01-27 17:00:23 EST (Wed, 27 Jan 2010)
@@ -13,6 +13,7 @@
#include "./grammars.hpp"
#include "./detail/quickbook.hpp"
#include "./detail/utils.hpp"
+#include "./detail/actions_class.hpp"
#include "./parse_utils.hpp"
#include <boost/spirit/include/qi_core.hpp>
#include <boost/spirit/include/qi_eol.hpp>
@@ -27,16 +28,15 @@
namespace qi = boost::spirit::qi;
namespace ph = boost::phoenix;
- template <typename Iterator, typename Actions>
- struct block_grammar<Iterator, Actions>::rules
+ struct block_grammar::rules
{
- rules(Actions& actions_);
+ rules(quickbook::actions& actions_);
- Actions& actions;
+ quickbook::actions& actions;
bool no_eols;
- phrase_grammar<Iterator, Actions> common;
+ phrase_grammar common;
qi::symbols<> paragraph_end_markups;
- qi::rule<Iterator>
+ qi::rule<iterator>
start_, blocks, block_markup, code, code_line,
paragraph, space, blank, comment, headings, h, h1, h2,
h3, h4, h5, h6, hr, blurb, blockquote, admonition,
@@ -48,20 +48,17 @@
template_, template_id, template_formal_arg,
template_body, identifier, dummy_block, import,
inside_paragraph;
- qi::rule<Iterator, boost::optional<std::string>()> element_id, element_id_1_5;
+ qi::rule<iterator, boost::optional<std::string>()> element_id, element_id_1_5;
};
- template <typename Iterator, typename Actions>
- block_grammar<Iterator, Actions>::block_grammar(Actions& actions_)
+ block_grammar::block_grammar(quickbook::actions& actions_)
: block_grammar::base_type(start, "block")
, rules_pimpl(new rules(actions_))
, start(rules_pimpl->start_) {}
- template <typename Iterator, typename Actions>
- block_grammar<Iterator, Actions>::~block_grammar() {}
+ block_grammar::~block_grammar() {}
- template <typename Iterator, typename Actions>
- block_grammar<Iterator, Actions>::rules::rules(Actions& actions_)
+ block_grammar::rules::rules(quickbook::actions& actions_)
: actions(actions_), no_eols(true), common(actions, no_eols)
{
start_ =
Modified: branches/quickbook-1.5-spirit2/code_snippet.hpp
==============================================================================
--- branches/quickbook-1.5-spirit2/code_snippet.hpp (original)
+++ branches/quickbook-1.5-spirit2/code_snippet.hpp 2010-01-27 17:00:23 EST (Wed, 27 Jan 2010)
@@ -17,13 +17,13 @@
#include "./grammars.hpp"
#include "./parse_utils.hpp"
#include "./detail/actions.hpp"
+#include "./detail/actions_class.hpp"
namespace quickbook
{
namespace ph = boost::phoenix;
- template <typename Iterator>
- struct python_code_snippet_grammar<Iterator>::rules
+ struct python_code_snippet_grammar::rules
{
typedef code_snippet_actions actions_type;
@@ -31,24 +31,21 @@
actions_type& actions;
- qi::rule<Iterator>
+ qi::rule<iterator>
start_, snippet, code_elements, escaped_comment,
inline_callout, line_callout, ignore;
- qi::rule<Iterator, std::string()>
+ qi::rule<iterator, std::string()>
identifier;
};
- template <typename Iterator>
- python_code_snippet_grammar<Iterator>::python_code_snippet_grammar(actions_type & actions)
+ python_code_snippet_grammar::python_code_snippet_grammar(actions_type & actions)
: python_code_snippet_grammar::base_type(start)
, rules_pimpl(new rules(actions))
, start(rules_pimpl->start_) {}
- template <typename Iterator>
- python_code_snippet_grammar<Iterator>::~python_code_snippet_grammar() {}
+ python_code_snippet_grammar::~python_code_snippet_grammar() {}
- template <typename Iterator>
- python_code_snippet_grammar<Iterator>::rules::rules(actions_type& actions)
+ python_code_snippet_grammar::rules::rules(actions_type& actions)
: actions(actions)
{
start_ =
@@ -98,8 +95,7 @@
;
}
- template <typename Iterator>
- struct cpp_code_snippet_grammar<Iterator>::rules
+ struct cpp_code_snippet_grammar::rules
{
typedef code_snippet_actions actions_type;
@@ -107,24 +103,21 @@
actions_type& actions;
- qi::rule<Iterator>
+ qi::rule<iterator>
start_, snippet, code_elements, escaped_comment,
inline_callout, line_callout, ignore;
- qi::rule<Iterator, std::string()>
+ qi::rule<iterator, std::string()>
identifier;
};
- template <typename Iterator>
- cpp_code_snippet_grammar<Iterator>::cpp_code_snippet_grammar(actions_type & actions)
+ cpp_code_snippet_grammar::cpp_code_snippet_grammar(actions_type & actions)
: cpp_code_snippet_grammar::base_type(start)
, rules_pimpl(new rules(actions))
, start(rules_pimpl->start_) {}
- template <typename Iterator>
- cpp_code_snippet_grammar<Iterator>::~cpp_code_snippet_grammar() {}
+ cpp_code_snippet_grammar::~cpp_code_snippet_grammar() {}
- template <typename Iterator>
- cpp_code_snippet_grammar<Iterator>::rules::rules(actions_type & actions)
+ cpp_code_snippet_grammar::rules::rules(actions_type & actions)
: actions(actions)
{
start_ =
Modified: branches/quickbook-1.5-spirit2/detail/actions.cpp
==============================================================================
--- branches/quickbook-1.5-spirit2/detail/actions.cpp (original)
+++ branches/quickbook-1.5-spirit2/detail/actions.cpp 2010-01-27 17:00:23 EST (Wed, 27 Jan 2010)
@@ -728,7 +728,7 @@
}
else if (!is_block)
{
- simple_phrase_grammar<iterator, quickbook::actions> phrase_p(actions);
+ simple_phrase_grammar phrase_p(actions);
// do a phrase level parse
iterator first(body.begin(), body.end(), actions.filename.native_file_string().c_str());
@@ -739,7 +739,7 @@
}
else
{
- block_grammar<iterator, quickbook::actions> block_p(actions);
+ block_grammar block_p(actions);
// do a block level parse
// ensure that we have enough trailing newlines to eliminate
@@ -1233,11 +1233,11 @@
code_snippet_actions a(storage, doc_id, is_python ? "[python]" : "[c++]");
// TODO: Should I check that parse succeeded?
if(is_python) {
- python_code_snippet_grammar<iterator> g(a);
+ python_code_snippet_grammar g(a);
boost::spirit::qi::parse(first, last, g);
}
else {
- cpp_code_snippet_grammar<iterator> g(a);
+ cpp_code_snippet_grammar g(a);
boost::spirit::qi::parse(first, last, g);
}
Modified: branches/quickbook-1.5-spirit2/detail/block.cpp
==============================================================================
--- branches/quickbook-1.5-spirit2/detail/block.cpp (original)
+++ branches/quickbook-1.5-spirit2/detail/block.cpp 2010-01-27 17:00:23 EST (Wed, 27 Jan 2010)
@@ -1,10 +1 @@
#include "../block.hpp"
-#include "./actions_class.hpp"
-
-namespace quickbook
-{
- void instantiate_phrase(actions& a)
- {
- block_grammar<iterator, quickbook::actions> bg1(a);
- }
-}
\ No newline at end of file
Deleted: branches/quickbook-1.5-spirit2/detail/code_snippet.cpp
==============================================================================
--- branches/quickbook-1.5-spirit2/detail/code_snippet.cpp 2010-01-27 17:00:23 EST (Wed, 27 Jan 2010)
+++ (empty file)
@@ -1,10 +0,0 @@
-#include "../code_snippet.hpp"
-
-namespace quickbook
-{
- void instantiate_code_snippet(code_snippet_actions& actions)
- {
- python_code_snippet_grammar<iterator> python(actions);
- cpp_code_snippet_grammar<iterator> cpp(actions);
- }
-}
\ No newline at end of file
Modified: branches/quickbook-1.5-spirit2/detail/doc_info.cpp
==============================================================================
--- branches/quickbook-1.5-spirit2/detail/doc_info.cpp (original)
+++ branches/quickbook-1.5-spirit2/detail/doc_info.cpp 2010-01-27 17:00:23 EST (Wed, 27 Jan 2010)
@@ -1,10 +1 @@
#include "../doc_info.hpp"
-#include "./actions_class.hpp"
-
-namespace quickbook
-{
- void instantiate_doc_info(quickbook::actions& a)
- {
- doc_info_grammar<iterator, quickbook::actions> grammar(a);
- }
-}
\ No newline at end of file
Modified: branches/quickbook-1.5-spirit2/detail/phrase.cpp
==============================================================================
--- branches/quickbook-1.5-spirit2/detail/phrase.cpp (original)
+++ branches/quickbook-1.5-spirit2/detail/phrase.cpp 2010-01-27 17:00:23 EST (Wed, 27 Jan 2010)
@@ -1,15 +1 @@
#include "../phrase.hpp"
-#include "./actions_class.hpp"
-
-namespace quickbook
-{
- void instantiate_simple_phrase(actions& a)
- {
- simple_phrase_grammar<iterator, actions> spgd(a);
- }
-
- void instantiate_phrase(actions& a, bool& b)
- {
- phrase_grammar<iterator, actions> pgd(a, b);
- }
-}
\ No newline at end of file
Modified: branches/quickbook-1.5-spirit2/detail/quickbook.cpp
==============================================================================
--- branches/quickbook-1.5-spirit2/detail/quickbook.cpp (original)
+++ branches/quickbook-1.5-spirit2/detail/quickbook.cpp 2010-01-27 17:00:23 EST (Wed, 27 Jan 2010)
@@ -62,7 +62,7 @@
iterator last(storage.end(), storage.end());
iterator start = first;
- doc_info_grammar<iterator, actions> l(actor);
+ doc_info_grammar l(actor);
bool success = parse(first, last, l);
if (success || ignore_docinfo)
@@ -71,7 +71,7 @@
pre(actor.out, actor, ignore_docinfo);
- block_grammar<iterator, actions> g(actor);
+ block_grammar g(actor);
success = parse(first, last, g);
if (success && first == last)
{
Modified: branches/quickbook-1.5-spirit2/detail/syntax_highlight.cpp
==============================================================================
--- branches/quickbook-1.5-spirit2/detail/syntax_highlight.cpp (original)
+++ branches/quickbook-1.5-spirit2/detail/syntax_highlight.cpp 2010-01-27 17:00:23 EST (Wed, 27 Jan 2010)
@@ -10,10 +10,8 @@
, do_macro_action
, pre_escape_back
, post_escape_back
- , actions
, unexpected_char
- , collector
- , iterator>
+ , collector>
cpp_p_type;
typedef python_highlight<
@@ -23,10 +21,8 @@
, do_macro_action
, pre_escape_back
, post_escape_back
- , actions
, unexpected_char
- , collector
- , iterator>
+ , collector>
python_p_type;
typedef teletype_highlight<
@@ -35,9 +31,7 @@
, do_macro_action
, pre_escape_back
, post_escape_back
- , actions
- , collector
- , iterator>
+ , collector>
teletype_p_type;
std::string syntax_highlight::operator()(iterator first, iterator last) const
Modified: branches/quickbook-1.5-spirit2/doc_info.hpp
==============================================================================
--- branches/quickbook-1.5-spirit2/doc_info.hpp (original)
+++ branches/quickbook-1.5-spirit2/doc_info.hpp 2010-01-27 17:00:23 EST (Wed, 27 Jan 2010)
@@ -12,6 +12,7 @@
#include "./grammars.hpp"
#include "./detail/quickbook.hpp"
+#include "./detail/actions_class.hpp"
#include "./parse_utils.hpp"
#include <boost/spirit/include/qi_core.hpp>
#include <boost/spirit/include/qi_uint.hpp>
@@ -26,36 +27,32 @@
namespace qi = boost::spirit::qi;
namespace ph = boost::phoenix;
- template <typename Iterator, typename Actions>
- struct doc_info_grammar<Iterator, Actions>::rules
+ struct doc_info_grammar::rules
{
- rules(Actions& actions);
+ rules(quickbook::actions& actions);
- Actions& actions;
+ quickbook::actions& actions;
bool unused;
std::pair<std::string, std::string> name;
std::pair<std::vector<std::string>, std::string> copyright;
- phrase_grammar<Iterator, Actions> common;
+ phrase_grammar common;
qi::symbols<char> doc_types;
- qi::rule<Iterator>
+ qi::rule<iterator>
doc_info, doc_title, doc_version, doc_id, doc_dirname,
doc_copyright, doc_purpose,doc_category, doc_authors,
doc_author, comment, space, hard_space, doc_license,
doc_last_revision, doc_source_mode, phrase, quickbook_version;
};
- template <typename Iterator, typename Actions>
- doc_info_grammar<Iterator, Actions>::doc_info_grammar(Actions& actions)
+ doc_info_grammar::doc_info_grammar(quickbook::actions& actions)
: doc_info_grammar::base_type(start)
, rules_pimpl(new rules(actions))
, start(rules_pimpl->doc_info) {}
- template <typename Iterator, typename Actions>
- doc_info_grammar<Iterator, Actions>::~doc_info_grammar() {}
+ doc_info_grammar::~doc_info_grammar() {}
- template <typename Iterator, typename Actions>
- doc_info_grammar<Iterator, Actions>::rules::rules(Actions& actions)
+ doc_info_grammar::rules::rules(quickbook::actions& actions)
: actions(actions), unused(false), common(actions, unused)
{
typedef qi::uint_parser<int, 10, 1, 2> uint2_t;
Modified: branches/quickbook-1.5-spirit2/grammars.hpp
==============================================================================
--- branches/quickbook-1.5-spirit2/grammars.hpp (original)
+++ branches/quickbook-1.5-spirit2/grammars.hpp 2010-01-27 17:00:23 EST (Wed, 27 Jan 2010)
@@ -13,62 +13,59 @@
#include <boost/spirit/include/qi_core.hpp>
#include <boost/spirit/include/qi_symbols.hpp>
#include <boost/scoped_ptr.hpp>
+#include "./detail/actions_class.hpp"
namespace quickbook
{
namespace qi = boost::spirit::qi;
- template <typename Iterator, typename Actions>
- struct phrase_grammar : qi::grammar<Iterator>
+ struct phrase_grammar : qi::grammar<iterator>
{
- phrase_grammar(Actions& actions, bool& no_eols);
+ phrase_grammar(quickbook::actions& actions, bool& no_eols);
~phrase_grammar();
struct rules;
boost::scoped_ptr<rules> rules_pimpl;
- qi::rule<Iterator> start;
+ qi::rule<iterator> start;
private:
phrase_grammar(phrase_grammar const&);
phrase_grammar& operator=(phrase_grammar const&);
};
- template <typename Iterator, typename Actions>
- struct simple_phrase_grammar : qi::grammar<Iterator>
+ struct simple_phrase_grammar : qi::grammar<iterator>
{
- simple_phrase_grammar(Actions& actions);
+ simple_phrase_grammar(quickbook::actions& actions);
~simple_phrase_grammar();
struct rules;
boost::scoped_ptr<rules> rules_pimpl;
- qi::rule<Iterator> start;
+ qi::rule<iterator> start;
private:
simple_phrase_grammar(simple_phrase_grammar const&);
simple_phrase_grammar& operator=(simple_phrase_grammar const&);
};
- template <typename Iterator, typename Actions>
- struct block_grammar : qi::grammar<Iterator>
+ struct block_grammar : qi::grammar<iterator>
{
- block_grammar(Actions& actions);
+ block_grammar(quickbook::actions& actions);
~block_grammar();
struct rules;
boost::scoped_ptr<rules> rules_pimpl;
- qi::rule<Iterator> start;
+ qi::rule<iterator> start;
private:
block_grammar(block_grammar const&);
block_grammar& operator=(block_grammar const&);
};
- template <typename Iterator, typename Actions>
- struct doc_info_grammar : qi::grammar<Iterator>
+ struct doc_info_grammar : qi::grammar<iterator>
{
- doc_info_grammar(Actions& actions);
+ doc_info_grammar(quickbook::actions& actions);
~doc_info_grammar();
struct rules;
boost::scoped_ptr<rules> rules_pimpl;
- qi::rule<Iterator> start;
+ qi::rule<iterator> start;
private:
doc_info_grammar(doc_info_grammar const&);
doc_info_grammar& operator=(doc_info_grammar const&);
@@ -78,9 +75,8 @@
struct code_snippet_actions;
- template <typename Iterator>
struct python_code_snippet_grammar
- : qi::grammar<Iterator>
+ : qi::grammar<iterator>
{
typedef code_snippet_actions actions_type;
@@ -89,15 +85,14 @@
struct rules;
boost::scoped_ptr<rules> rules_pimpl;
- qi::rule<Iterator> start;
+ qi::rule<iterator> start;
private:
python_code_snippet_grammar(python_code_snippet_grammar const&);
python_code_snippet_grammar& operator=(python_code_snippet_grammar const&);
};
- template <typename Iterator>
struct cpp_code_snippet_grammar
- : qi::grammar<Iterator>
+ : qi::grammar<iterator>
{
typedef code_snippet_actions actions_type;
@@ -106,7 +101,7 @@
struct rules;
boost::scoped_ptr<rules> rules_pimpl;
- qi::rule<Iterator> start;
+ qi::rule<iterator> start;
private:
cpp_code_snippet_grammar(cpp_code_snippet_grammar const&);
cpp_code_snippet_grammar& operator=(cpp_code_snippet_grammar const&);
Modified: branches/quickbook-1.5-spirit2/phrase.hpp
==============================================================================
--- branches/quickbook-1.5-spirit2/phrase.hpp (original)
+++ branches/quickbook-1.5-spirit2/phrase.hpp 2010-01-27 17:00:23 EST (Wed, 27 Jan 2010)
@@ -14,6 +14,7 @@
#include "./detail/quickbook.hpp"
#include "./detail/utils.hpp"
#include "./detail/markups.hpp"
+#include "./detail/actions_class.hpp"
#include "./parse_utils.hpp"
#include <map>
#include <boost/spirit/include/qi_core.hpp>
@@ -32,15 +33,14 @@
namespace qi = boost::spirit::qi;
namespace ph = boost::phoenix;
- template <typename Iterator, typename Actions>
- struct phrase_grammar<Iterator, Actions>::rules
+ struct phrase_grammar::rules
{
- rules(Actions& actions, bool& no_eols);
+ rules(quickbook::actions& actions, bool& no_eols);
- Actions& actions;
+ quickbook::actions& actions;
bool& no_eols;
- qi::rule<Iterator>
+ qi::rule<iterator>
space, blank, comment, phrase, phrase_markup,
phrase_end, bold, italic, underline, teletype,
strikethrough, escape, url, common, funcref, classref,
@@ -52,31 +52,28 @@
brackets_1_4, template_inner_arg_1_5, brackets_1_5
;
- qi::rule<Iterator, std::string()> template_arg_1_4, template_arg_1_5;
- qi::rule<Iterator, std::vector<std::string>() > template_args;
+ qi::rule<iterator, std::string()> template_arg_1_4, template_arg_1_5;
+ qi::rule<iterator, std::vector<std::string>() > template_args;
- qi::rule<Iterator> image, image_1_4, image_1_5;
- qi::rule<Iterator, std::string()> image_filename, image_attribute_key, image_attribute_value;
- qi::rule<Iterator, std::multimap<std::string, std::string>()> image_attributes;
- qi::rule<Iterator, std::pair<std::string, std::string>()> image_attribute;
+ qi::rule<iterator> image, image_1_4, image_1_5;
+ qi::rule<iterator, std::string()> image_filename, image_attribute_key, image_attribute_value;
+ qi::rule<iterator, std::multimap<std::string, std::string>()> image_attributes;
+ qi::rule<iterator, std::pair<std::string, std::string>()> image_attribute;
- qi::rule<Iterator, boost::iterator_range<Iterator>(char)> simple_markup;
- qi::rule<Iterator, void(char const*, char const*, char const*)> generic_link;
+ qi::rule<iterator, boost::iterator_range<iterator>(char)> simple_markup;
+ qi::rule<iterator, void(char const*, char const*, char const*)> generic_link;
};
- template <typename Iterator, typename Actions>
- phrase_grammar<Iterator, Actions>::phrase_grammar(Actions& actions, bool& no_eols)
+ phrase_grammar::phrase_grammar(quickbook::actions& actions, bool& no_eols)
: phrase_grammar::base_type(start, "phrase")
, rules_pimpl(new rules(actions, no_eols))
{
start = rules_pimpl->common;
}
- template <typename Iterator, typename Actions>
- phrase_grammar<Iterator, Actions>::~phrase_grammar() {}
+ phrase_grammar::~phrase_grammar() {}
- template <typename Iterator, typename Actions>
- phrase_grammar<Iterator, Actions>::rules::rules(Actions& actions, bool& no_eols)
+ phrase_grammar::rules::rules(quickbook::actions& actions, bool& no_eols)
: actions(actions), no_eols(no_eols)
{
space =
@@ -411,28 +408,24 @@
;
}
- template <typename Iterator, typename Actions>
- struct simple_phrase_grammar<Iterator, Actions>::rules
+ struct simple_phrase_grammar::rules
{
- rules(Actions& actions);
+ rules(quickbook::actions& actions);
- Actions& actions;
+ quickbook::actions& actions;
bool unused;
- phrase_grammar<Iterator, Actions> common;
- qi::rule<Iterator> phrase, comment, dummy_block;
+ phrase_grammar common;
+ qi::rule<iterator> phrase, comment, dummy_block;
};
- template <typename Iterator, typename Actions>
- simple_phrase_grammar<Iterator, Actions>::simple_phrase_grammar(Actions& actions)
+ simple_phrase_grammar::simple_phrase_grammar(quickbook::actions& actions)
: simple_phrase_grammar::base_type(start, "simple_phrase")
, rules_pimpl(new rules(actions))
, start(rules_pimpl->phrase) {}
- template <typename Iterator, typename Actions>
- simple_phrase_grammar<Iterator, Actions>::~simple_phrase_grammar() {}
+ simple_phrase_grammar::~simple_phrase_grammar() {}
- template <typename Iterator, typename Actions>
- simple_phrase_grammar<Iterator, Actions>::rules::rules(Actions& actions)
+ simple_phrase_grammar::rules::rules(quickbook::actions& actions)
: actions(actions), unused(false), common(actions, unused)
{
phrase =
Modified: branches/quickbook-1.5-spirit2/syntax_highlight.hpp
==============================================================================
--- branches/quickbook-1.5-spirit2/syntax_highlight.hpp (original)
+++ branches/quickbook-1.5-spirit2/syntax_highlight.hpp 2010-01-27 17:00:23 EST (Wed, 27 Jan 2010)
@@ -21,16 +21,15 @@
namespace qi = boost::spirit::qi;
using boost::spirit::unused_type;
- template <class Iterator, class EscapeActions>
struct parse_escaped_impl
{
- parse_escaped_impl(EscapeActions& escape_actions)
+ parse_escaped_impl(quickbook::actions& escape_actions)
: actions(escape_actions) {}
- void operator()(boost::iterator_range<Iterator> escaped, unused_type, unused_type) const {
+ void operator()(boost::iterator_range<iterator> escaped, unused_type, unused_type) const {
bool unused;
- phrase_grammar<Iterator, EscapeActions> common(actions, unused);
- Iterator first = escaped.begin(), last = escaped.end();
+ phrase_grammar common(actions, unused);
+ iterator first = escaped.begin(), last = escaped.end();
while(first != last) {
if(!qi::parse(first, last, common)) {
actions.plain_char(*first, 0, 0);
@@ -39,7 +38,7 @@
}
}
- EscapeActions& actions;
+ quickbook::actions& actions;
};
// Grammar for C++ highlighting
@@ -50,14 +49,12 @@
, typename DoMacro
, typename PreEscape
, typename PostEscape
- , typename EscapeActions
, typename Unexpected
- , typename Out
- , typename Iterator>
+ , typename Out>
struct cpp_highlight
- : public qi::grammar<Iterator>
+ : public qi::grammar<iterator>
{
- cpp_highlight(Out& out, Macro const& macro_symbols, DoMacro do_macro, EscapeActions& escape_actions)
+ cpp_highlight(Out& out, Macro const& macro_symbols, DoMacro do_macro, quickbook::actions& escape_actions)
: cpp_highlight::base_type(program), out(out), macro_symbols(macro_symbols), do_macro(do_macro), escape_actions(escape_actions)
, parse_escaped(escape_actions)
{
@@ -162,7 +159,7 @@
;
}
- qi::rule<Iterator>
+ qi::rule<iterator>
program, macro, preprocessor, comment, special, string_,
char_, number, identifier, keyword, escape,
string_char;
@@ -170,10 +167,10 @@
Out& out;
Macro const& macro_symbols;
DoMacro do_macro;
- EscapeActions& escape_actions;
+ quickbook::actions& escape_actions;
qi::symbols<> keyword_;
- parse_escaped_impl<Iterator, EscapeActions> parse_escaped;
+ parse_escaped_impl parse_escaped;
std::string save;
};
@@ -187,14 +184,12 @@
, typename DoMacro
, typename PreEscape
, typename PostEscape
- , typename EscapeActions
, typename Unexpected
- , typename Out
- , typename Iterator>
+ , typename Out>
struct python_highlight
- : public qi::grammar<Iterator>
+ : public qi::grammar<iterator>
{
- python_highlight(Out& out, Macro const& macro_symbols, DoMacro do_macro, EscapeActions& escape_actions)
+ python_highlight(Out& out, Macro const& macro_symbols, DoMacro do_macro, quickbook::actions& escape_actions)
: python_highlight::base_type(program), out(out), macro_symbols(macro_symbols), do_macro(do_macro), escape_actions(escape_actions)
, parse_escaped(escape_actions)
{
@@ -300,7 +295,7 @@
;
}
- qi::rule<Iterator>
+ qi::rule<iterator>
program, macro, comment, special, string_, string_prefix,
short_string, long_string, number, identifier, keyword,
escape, string_char;
@@ -308,10 +303,10 @@
Out& out;
Macro const& macro_symbols;
DoMacro do_macro;
- EscapeActions& escape_actions;
+ quickbook::actions& escape_actions;
qi::symbols<> keyword_;
- parse_escaped_impl<Iterator, EscapeActions> parse_escaped;
+ parse_escaped_impl parse_escaped;
std::string save;
};
@@ -322,13 +317,11 @@
, typename DoMacro
, typename PreEscape
, typename PostEscape
- , typename EscapeActions
- , typename Out
- , typename Iterator>
+ , typename Out>
struct teletype_highlight
- : public qi::grammar<Iterator>
+ : public qi::grammar<iterator>
{
- teletype_highlight(Out& out, Macro const& macro_symbols, DoMacro do_macro, EscapeActions& escape_actions)
+ teletype_highlight(Out& out, Macro const& macro_symbols, DoMacro do_macro, quickbook::actions& escape_actions)
: teletype_highlight::base_type(program), out(out), macro_symbols(macro_symbols), do_macro(do_macro), escape_actions(escape_actions)
, parse_escaped(escape_actions)
{
@@ -366,14 +359,14 @@
;
}
- qi::rule<Iterator> program, macro, escape;
+ qi::rule<iterator> program, macro, escape;
Out& out;
Macro const& macro_symbols;
DoMacro do_macro;
- EscapeActions& escape_actions;
+ quickbook::actions& escape_actions;
- parse_escaped_impl<Iterator, EscapeActions> parse_escaped;
+ parse_escaped_impl parse_escaped;
std::string save;
};
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