Boost logo

Boost-Commit :

Subject: [Boost-commit] svn:boost r59294 - in branches/quickbook-1.5-spirit2: . detail
From: daniel_james_at_[hidden]
Date: 2010-01-27 17:00:43


Author: danieljames
Date: 2010-01-27 17:00:39 EST (Wed, 27 Jan 2010)
New Revision: 59294
URL: http://svn.boost.org/trac/boost/changeset/59294

Log:
Turn the old template headers into cpp files.
Added:
   branches/quickbook-1.5-spirit2/block.cpp (contents, props changed)
      - copied, changed from r59293, /branches/quickbook-1.5-spirit2/block.hpp
   branches/quickbook-1.5-spirit2/doc_info.cpp (contents, props changed)
      - copied, changed from r59293, /branches/quickbook-1.5-spirit2/doc_info.hpp
   branches/quickbook-1.5-spirit2/phrase.cpp (contents, props changed)
      - copied, changed from r59293, /branches/quickbook-1.5-spirit2/phrase.hpp
Removed:
   branches/quickbook-1.5-spirit2/block.hpp
   branches/quickbook-1.5-spirit2/detail/block.cpp
   branches/quickbook-1.5-spirit2/detail/doc_info.cpp
   branches/quickbook-1.5-spirit2/detail/phrase.cpp
   branches/quickbook-1.5-spirit2/doc_info.hpp
   branches/quickbook-1.5-spirit2/phrase.hpp
Text files modified:
   branches/quickbook-1.5-spirit2/Jamfile.v2 | 6 +++---
   1 files changed, 3 insertions(+), 3 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:39 EST (Wed, 27 Jan 2010)
@@ -27,9 +27,9 @@
     detail/collector.cpp
     detail/template_stack.cpp
     detail/markups.cpp
- detail/phrase.cpp
- detail/block.cpp
- detail/doc_info.cpp
+ phrase.cpp
+ block.cpp
+ doc_info.cpp
     detail/syntax_highlight.cpp
     /boost//program_options
     /boost//filesystem

Copied: branches/quickbook-1.5-spirit2/block.cpp (from r59293, /branches/quickbook-1.5-spirit2/block.hpp)
==============================================================================

Deleted: branches/quickbook-1.5-spirit2/block.hpp
==============================================================================
--- branches/quickbook-1.5-spirit2/block.hpp 2010-01-27 17:00:39 EST (Wed, 27 Jan 2010)
+++ (empty file)
@@ -1,443 +0,0 @@
-/*=============================================================================
- Copyright (c) 2002 2004 2006Joel de Guzman
- Copyright (c) 2004 Eric Niebler
- http://spirit.sourceforge.net/
-
- Use, modification and distribution is subject to the Boost Software
- License, Version 1.0. (See accompanying file LICENSE_1_0.txt or copy at
- http://www.boost.org/LICENSE_1_0.txt)
-=============================================================================*/
-#if !defined(BOOST_SPIRIT_QUICKBOOK_BLOCK_HPP)
-#define BOOST_SPIRIT_QUICKBOOK_BLOCK_HPP
-
-#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>
-#include <boost/spirit/include/qi_eps.hpp>
-#include <boost/spirit/include/phoenix_core.hpp>
-#include <boost/spirit/include/phoenix_operator.hpp>
-#include <boost/spirit/include/phoenix_container.hpp>
-#include <boost/spirit/include/phoenix_bind.hpp>
-
-namespace quickbook
-{
- namespace qi = boost::spirit::qi;
- namespace ph = boost::phoenix;
-
- struct block_grammar::rules
- {
- rules(quickbook::actions& actions_);
-
- quickbook::actions& actions;
- bool no_eols;
- phrase_grammar common;
- qi::symbols<> paragraph_end_markups;
- 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,
- phrase, list, phrase_end, ordered_list, def_macro,
- macro_identifier, table, table_row, variablelist,
- varlistentry, varlistterm, varlistitem, table_cell,
- preformatted, list_item, begin_section, end_section,
- xinclude, include, hard_space, eol, paragraph_end,
- 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;
- };
-
- block_grammar::block_grammar(quickbook::actions& actions_)
- : block_grammar::base_type(start, "block")
- , rules_pimpl(new rules(actions_))
- , start(rules_pimpl->start_) {}
-
- block_grammar::~block_grammar() {}
-
- block_grammar::rules::rules(quickbook::actions& actions_)
- : actions(actions_), no_eols(true), common(actions, no_eols)
- {
- start_ =
- blocks >> blank
- ;
-
- blocks =
- +( block_markup
- | code
- | list [actions.list]
- | hr [actions.hr]
- | comment >> *eol
- | paragraph [actions.paragraph]
- | eol
- )
- ;
-
- space =
- *(qi::space | comment)
- ;
-
- blank =
- *(qi::blank | comment)
- ;
-
- eol = blank >> qi::eol
- ;
-
- phrase_end =
- ']' |
- qi::eps(ph::ref(no_eols)) >>
- eol >> eol // Make sure that we don't go
- // past a single block, except
- ; // when preformatted.
-
- hard_space =
- (qi::eps - (qi::alnum | '_')) >> space // must not be preceded by
- ; // alpha-numeric or underscore
-
- comment =
- "[/" >> *(dummy_block | (qi::char_ - ']')) >> ']'
- ;
-
- dummy_block =
- '[' >> *(dummy_block | (qi::char_ - ']')) >> ']'
- ;
-
- hr =
- qi::lit("----")
- >> *(qi::char_ - eol)
- >> +eol
- ;
-
- block_markup =
- '[' >> space
- >> ( begin_section
- | end_section
- | headings
- | blurb
- | blockquote
- | admonition
- | preformatted
- | def_macro
- | table
- | variablelist
- | xinclude
- | include
- | import
- | template_
- )
- >> ( (space >> ']' >> +eol)
- | qi::raw[qi::eps] [actions.error]
- )
- ;
-
- element_id =
- -(
- ':'
- >> -(qi::eps(qbk_since(105u)) >> space)
- >> (
- (+(qi::alnum | qi::char_('_'))) [qi::_val = as_string(qi::_1)]
- | qi::raw[qi::eps] [actions.element_id_warning]
- )
- );
-
-
- element_id_1_5 =
- -(qi::eps(qbk_since(105u)) >> element_id [qi::_val = qi::_1]);
-
- begin_section = (
- "section"
- >> hard_space
- >> element_id
- >> qi::raw[phrase]) [ph::bind(actions.begin_section, qi::_1, qi::_2)]
- ;
-
- end_section =
- qi::raw["endsect"] [actions.end_section]
- ;
-
- headings =
- h1 | h2 | h3 | h4 | h5 | h6 | h
- ;
-
- h = "heading" >> hard_space >> qi::raw[phrase] [actions.h];
- h1 = "h1" >> hard_space >> qi::raw[phrase] [actions.h1];
- h2 = "h2" >> hard_space >> qi::raw[phrase] [actions.h2];
- h3 = "h3" >> hard_space >> qi::raw[phrase] [actions.h3];
- h4 = "h4" >> hard_space >> qi::raw[phrase] [actions.h4];
- h5 = "h5" >> hard_space >> qi::raw[phrase] [actions.h5];
- h6 = "h6" >> hard_space >> qi::raw[phrase] [actions.h6];
-
- static const bool true_ = true;
- static const bool false_ = false;
-
- inside_paragraph =
- phrase [actions.inside_paragraph]
- >> *(
- eol >> eol >> phrase [actions.inside_paragraph]
- )
- ;
-
- blurb =
- "blurb" >> hard_space
- >> inside_paragraph [actions.blurb]
- >> qi::eps
- ;
-
- blockquote =
- ':' >> blank >>
- inside_paragraph [actions.blockquote]
- ;
-
- admonition =
- "warning" >> blank >>
- inside_paragraph [actions.warning]
- |
- "caution" >> blank >>
- inside_paragraph [actions.caution]
- |
- "important" >> blank >>
- inside_paragraph [actions.important]
- |
- "note" >> blank >>
- inside_paragraph [actions.note]
- |
- "tip" >> blank >>
- inside_paragraph [actions.tip]
- ;
-
- preformatted =
- "pre" >> hard_space [ph::ref(no_eols) = false_]
- >> -eol >> phrase [actions.preformatted]
- >> qi::eps [ph::ref(no_eols) = true_]
- ;
-
- macro_identifier =
- +(qi::char_ - (qi::space | ']'))
- ;
-
- def_macro =
- "def" >> hard_space
- >> qi::raw[macro_identifier] [actions.macro_identifier]
- >> blank >> phrase [actions.macro_definition]
- ;
-
- identifier =
- (qi::alpha | '_') >> *(qi::alnum | '_')
- ;
-
- template_id =
- identifier | (qi::punct - (qi::char_('[') | ']'))
- ;
-
- template_ =
- "template"
- >> hard_space >> qi::raw[template_id]
- [ph::push_back(ph::ref(actions.template_info), as_string(qi::_1))]
- >>
- -(
- space >> '['
- >> *(
- space >> qi::raw[template_id]
- [ph::push_back(ph::ref(actions.template_info), as_string(qi::_1))]
- )
- >> space >> ']'
- )
- >> qi::raw[template_body] [actions.template_body]
- ;
-
- template_body =
- *(('[' >> template_body >> ']') | (qi::char_ - ']'))
- >> space >> &qi::lit(']')
- ;
-
- variablelist = (
- "variablelist"
- >> qi::omit[&(*qi::blank >> qi::eol) | hard_space]
- >> *(qi::char_ - eol)
- >> +eol
- >> *varlistentry
- ) [ph::bind(actions.variablelist, as_string(qi::_1))]
- ;
-
- varlistentry =
- space
- >> qi::char_('[') [actions.start_varlistentry]
- >>
- (
- (
- varlistterm
- >> +varlistitem
- >> qi::char_(']') [actions.end_varlistentry]
- >> space
- )
- | qi::raw[qi::eps] [actions.error]
- )
- ;
-
- varlistterm =
- space
- >> qi::char_('[') [actions.start_varlistterm]
- >>
- (
- (
- phrase
- >> qi::char_(']') [actions.end_varlistterm]
- >> space
- )
- | qi::raw[qi::eps] [actions.error]
- )
- ;
-
- varlistitem =
- space
- >> qi::char_('[') [actions.start_varlistitem]
- >>
- (
- (
- inside_paragraph
- >> qi::char_(']') [actions.end_varlistitem]
- >> space
- )
- | qi::raw[qi::eps] [actions.error]
- )
- ;
-
- table = (
- "table"
- >> (&(*qi::blank >> qi::eol) | hard_space)
- >> element_id_1_5
- >> (&(*qi::blank >> qi::eol) | space)
- >> *(qi::char_ - eol)
- >> +eol
- >> *table_row
- ) [ph::bind(actions.table, qi::_1, as_string(qi::_2))]
- ;
-
- table_row =
- space
- >> qi::char_('[') [actions.start_row]
- >>
- (
- (
- *table_cell
- >> qi::char_(']') [actions.end_row]
- >> space
- )
- | qi::raw[qi::eps] [actions.error]
- )
- ;
-
- table_cell =
- space
- >> qi::char_('[') [actions.start_cell]
- >>
- (
- (
- inside_paragraph
- >> qi::char_(']') [actions.end_cell]
- >> space
- )
- | qi::raw[qi::eps] [actions.error]
- )
- ;
-
- xinclude =
- "xinclude"
- >> hard_space
- >> qi::raw[*(qi::char_ -
- phrase_end)] [actions.xinclude]
- ;
-
- import =
- "import"
- >> hard_space
- >> qi::raw[*(qi::char_ -
- phrase_end)] [actions.import]
- ;
-
- include =
- "include"
- >> hard_space
- >>
- -(
- ':'
- >> qi::raw[*((qi::alnum | '_') - qi::space)]
- [ph::ref(actions.include_doc_id) = as_string(qi::_1)]
- >> space
- )
- >> qi::raw[*(qi::char_ -
- phrase_end)] [actions.include]
- ;
-
- code =
- qi::raw[
- code_line
- >> *(*eol >> code_line)
- ] [actions.code]
- >> +eol
- ;
-
- code_line =
- ((qi::char_(' ') | '\t'))
- >> *(qi::char_ - eol) >> eol
- ;
-
- list =
- &(qi::char_('*') | '#') >>
- +qi::raw[
- qi::raw[*qi::blank
- >> (qi::char_('*') | '#')]
- [actions.list_format]
- >> *qi::blank
- >> list_item
- ] [actions.list_item]
- ;
-
- list_item =
- *( common
- | (qi::char_ -
- ( qi::eol >> *qi::blank >> &(qi::char_('*') | '#')
- | (eol >> eol)
- )
- ) [actions.plain_char]
- )
- >> +eol
- ;
-
- paragraph_end_markups =
- "section", "endsect", "h1", "h2", "h3", "h4", "h5", "h6",
- "blurb", ":", "pre", "def", "table", "include", "xinclude",
- "variablelist", "import", "template", "warning", "caution",
- "important", "note", "tip", ":"
- ;
-
- paragraph_end =
- '[' >> space >> paragraph_end_markups >> hard_space | eol >> eol
- ;
-
- paragraph =
- *( common
- | (qi::char_ - // Make sure we don't go past
- paragraph_end // a single block.
- ) [actions.plain_char]
- )
- >> (&qi::lit('[') | +eol)
- ;
-
- phrase =
- *( common
- | comment
- | (qi::char_ -
- phrase_end) [actions.plain_char]
- )
- ;
- }
-}
-
-#endif // BOOST_SPIRIT_QUICKBOOK_BLOCK_HPP
-
-

Deleted: branches/quickbook-1.5-spirit2/detail/block.cpp
==============================================================================
--- branches/quickbook-1.5-spirit2/detail/block.cpp 2010-01-27 17:00:39 EST (Wed, 27 Jan 2010)
+++ (empty file)
@@ -1 +0,0 @@
-#include "../block.hpp"

Deleted: branches/quickbook-1.5-spirit2/detail/doc_info.cpp
==============================================================================
--- branches/quickbook-1.5-spirit2/detail/doc_info.cpp 2010-01-27 17:00:39 EST (Wed, 27 Jan 2010)
+++ (empty file)
@@ -1 +0,0 @@
-#include "../doc_info.hpp"

Deleted: branches/quickbook-1.5-spirit2/detail/phrase.cpp
==============================================================================
--- branches/quickbook-1.5-spirit2/detail/phrase.cpp 2010-01-27 17:00:39 EST (Wed, 27 Jan 2010)
+++ (empty file)
@@ -1 +0,0 @@
-#include "../phrase.hpp"

Copied: branches/quickbook-1.5-spirit2/doc_info.cpp (from r59293, /branches/quickbook-1.5-spirit2/doc_info.hpp)
==============================================================================

Deleted: branches/quickbook-1.5-spirit2/doc_info.hpp
==============================================================================
--- branches/quickbook-1.5-spirit2/doc_info.hpp 2010-01-27 17:00:39 EST (Wed, 27 Jan 2010)
+++ (empty file)
@@ -1,200 +0,0 @@
-/*=============================================================================
- Copyright (c) 2002 2004 2006 Joel de Guzman
- Copyright (c) 2004 Eric Niebler
- http://spirit.sourceforge.net/
-
- Use, modification and distribution is subject to the Boost Software
- License, Version 1.0. (See accompanying file LICENSE_1_0.txt or copy at
- http://www.boost.org/LICENSE_1_0.txt)
-=============================================================================*/
-#if !defined(BOOST_SPIRIT_QUICKBOOK_DOC_INFO_HPP)
-#define BOOST_SPIRIT_QUICKBOOK_DOC_INFO_HPP
-
-#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>
-#include <boost/spirit/include/qi_eol.hpp>
-#include <boost/spirit/include/qi_eps.hpp>
-#include <boost/spirit/include/phoenix_core.hpp>
-#include <boost/spirit/include/phoenix_container.hpp>
-#include <boost/spirit/include/phoenix_operator.hpp>
-
-namespace quickbook
-{
- namespace qi = boost::spirit::qi;
- namespace ph = boost::phoenix;
-
- struct doc_info_grammar::rules
- {
- rules(quickbook::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 common;
- qi::symbols<char> doc_types;
- 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;
- };
-
- 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) {}
-
- doc_info_grammar::~doc_info_grammar() {}
-
-
- 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;
-
- doc_types =
- "book", "article", "library", "chapter", "part"
- , "appendix", "preface", "qandadiv", "qandaset"
- , "reference", "set"
- ;
-
- doc_info =
- space
- >> '[' >> space
- >> qi::raw[doc_types] [ph::ref(actions.doc_type) = as_string(qi::_1)]
- >> hard_space
- >> ( *(qi::char_ -
- (qi::char_('[') | ']' | qi::eol)
- )
- ) [ph::ref(actions.doc_title) = as_string(qi::_1)]
- >> -(
- space >> '[' >>
- quickbook_version
- >> space >> ']'
- )
- >>
- *(
- space >> '[' >>
- (
- doc_version
- | doc_id
- | doc_dirname
- | doc_copyright [ph::push_back(ph::ref(actions.doc_copyrights), ph::ref(copyright))]
- | doc_purpose [actions.extract_doc_purpose]
- | doc_category
- | doc_authors
- | doc_license [actions.extract_doc_license]
- | doc_last_revision
- | doc_source_mode
- )
- >> space >> ']' >> +qi::eol
- )
- >> space >> ']' >> +qi::eol
- ;
-
- quickbook_version =
- "quickbook" >> hard_space
- >> ( qi::uint_ [ph::ref(qbk_major_version) = qi::_1]
- >> '.'
- >> uint2_t() [ph::ref(qbk_minor_version) = qi::_1]
- )
- ;
-
- doc_version =
- "version" >> hard_space
- >> qi::raw[*(qi::char_ - ']')] [ph::ref(actions.doc_version) = as_string(qi::_1)]
- ;
-
- doc_id =
- "id" >> hard_space
- >> qi::raw[*(qi::char_ - ']')] [ph::ref(actions.doc_id) = as_string(qi::_1)]
- ;
-
- doc_dirname =
- "dirname" >> hard_space
- >> qi::raw[*(qi::char_ - ']')] [ph::ref(actions.doc_dirname) = as_string(qi::_1)]
- ;
-
- doc_copyright =
- "copyright" >> hard_space [ph::clear(ph::ref(copyright.first))]
- >> +( qi::repeat(4)[qi::digit] [ph::push_back(ph::ref(copyright.first), as_string(qi::_1))]
- >> space
- )
- >> space
- >> (*(qi::char_ - ']')) [ph::ref(copyright.second) = as_string(qi::_1)]
- ;
-
- doc_purpose =
- "purpose" >> hard_space
- >> qi::raw[phrase] [ph::ref(actions.doc_purpose_1_1) = as_string(qi::_1)]
- ;
-
- doc_category =
- "category" >> hard_space
- >> (*(qi::char_ - ']')) [ph::ref(actions.doc_category) = as_string(qi::_1)]
- ;
-
- doc_author =
- space
- >> '[' >> space
- >> (*(qi::char_ - ',')) [ph::ref(name.second) = as_string(qi::_1)] // surname
- >> ',' >> space
- >> (*(qi::char_ - ']')) [ph::ref(name.first) = as_string(qi::_1)] // firstname
- >> ']'
- ;
-
- doc_authors =
- "authors" >> hard_space
- >> doc_author [ph::push_back(ph::ref(actions.doc_authors), ph::ref(name))]
- >> *( ','
- >> doc_author [ph::push_back(ph::ref(actions.doc_authors), ph::ref(name))]
- )
- ;
-
- doc_license =
- "license" >> hard_space
- >> qi::raw[phrase] [ph::ref(actions.doc_license_1_1) = as_string(qi::_1)]
- ;
-
- doc_last_revision =
- "last-revision" >> hard_space
- >> (*(qi::char_ - ']')) [ph::ref(actions.doc_last_revision) = as_string(qi::_1)]
- ;
-
- doc_source_mode =
- "source-mode" >> hard_space
- >> (
- qi::string("c++")
- | qi::string("python")
- | qi::string("teletype")
- ) [ph::ref(actions.source_mode) = qi::_1]
- ;
-
- comment =
- "[/" >> *(qi::char_ - ']') >> ']'
- ;
-
- space =
- *(qi::space | comment)
- ;
-
- hard_space =
- (qi::eps - (qi::alnum | '_')) >> space // must not be preceded by
- ; // alpha-numeric or underscore
-
- phrase =
- *( common
- | comment
- | (qi::char_ - ']') [actions.plain_char]
- )
- ;
- }
-}
-
-#endif // BOOST_SPIRIT_QUICKBOOK_DOC_INFO_HPP
-

Copied: branches/quickbook-1.5-spirit2/phrase.cpp (from r59293, /branches/quickbook-1.5-spirit2/phrase.hpp)
==============================================================================

Deleted: branches/quickbook-1.5-spirit2/phrase.hpp
==============================================================================
--- branches/quickbook-1.5-spirit2/phrase.hpp 2010-01-27 17:00:39 EST (Wed, 27 Jan 2010)
+++ (empty file)
@@ -1,449 +0,0 @@
-/*=============================================================================
- Copyright (c) 2002 2004 2006 Joel de Guzman
- Copyright (c) 2004 Eric Niebler
- http://spirit.sourceforge.net/
-
- Use, modification and distribution is subject to the Boost Software
- License, Version 1.0. (See accompanying file LICENSE_1_0.txt or copy at
- http://www.boost.org/LICENSE_1_0.txt)
-=============================================================================*/
-#if !defined(BOOST_SPIRIT_QUICKBOOK_PHRASE_HPP)
-#define BOOST_SPIRIT_QUICKBOOK_PHRASE_HPP
-
-#include "./grammars.hpp"
-#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>
-#include <boost/spirit/include/qi_auxiliary.hpp>
-#include <boost/spirit/repository/include/qi_confix.hpp>
-#include <boost/spirit/include/phoenix_core.hpp>
-#include <boost/spirit/include/phoenix_operator.hpp>
-#include <boost/spirit/include/phoenix_container.hpp>
-#include <boost/spirit/include/phoenix_fusion.hpp>
-#include <boost/spirit/include/phoenix_bind.hpp>
-#include <boost/spirit/include/phoenix_function.hpp>
-#include <boost/fusion/include/std_pair.hpp>
-
-namespace quickbook
-{
- namespace qi = boost::spirit::qi;
- namespace ph = boost::phoenix;
-
- struct phrase_grammar::rules
- {
- rules(quickbook::actions& actions, bool& no_eols);
-
- quickbook::actions& actions;
- bool& no_eols;
-
- qi::rule<iterator>
- space, blank, comment, phrase, phrase_markup,
- phrase_end, bold, italic, underline, teletype,
- strikethrough, escape, url, common, funcref, classref,
- memberref, enumref, macroref, headerref, conceptref, globalref,
- anchor, link, hard_space, eol, inline_code, simple_format,
- source_mode, template_,
- quote, code_block, footnote, replaceable, macro,
- dummy_block, cond_phrase, macro_identifier,
- 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> 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;
- };
-
- 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;
- }
-
- phrase_grammar::~phrase_grammar() {}
-
- phrase_grammar::rules::rules(quickbook::actions& actions, bool& no_eols)
- : actions(actions), no_eols(no_eols)
- {
- space =
- *(qi::space | comment)
- ;
-
- blank =
- *(qi::blank | comment)
- ;
-
- eol = blank >> qi::eol
- ;
-
- phrase_end =
- ']' |
- qi::eps(ph::ref(no_eols)) >>
- eol >> eol // Make sure that we don't go
- ; // past a single block, except
- // when preformatted.
-
- hard_space =
- (qi::eps - (qi::alnum | '_')) >> space
- ; // must not be preceded by
- // alpha-numeric or underscore
-
- comment =
- "[/" >> *(dummy_block | (qi::char_ - ']')) >> ']'
- ;
-
- dummy_block =
- '[' >> *(dummy_block | (qi::char_ - ']')) >> ']'
- ;
-
- common =
- macro
- | phrase_markup
- | code_block
- | inline_code
- | simple_format
- | escape
- | comment
- ;
-
- macro =
- &(actions.macro // must not be followed by
- >> (qi::eps - (qi::alpha | '_'))) // alpha or underscore
- >> actions.macro [actions.do_macro]
- ;
-
- // Template call
-
- template_ =
- ( qi::raw[qi::eps] // For the position of the template
- >> -qi::char_('`') // Attribute implicitly cast to bool
- >> ( // Lookup the template name
- (&qi::punct >> actions.templates.scope)
- | (actions.templates.scope >> hard_space)
- )
- >> template_args
- >> &qi::lit(']')
- ) [ph::bind(actions.do_template, ph::begin(qi::_1), qi::_2, qi::_3, qi::_4)]
- ;
-
- template_args =
- qi::eps(qbk_before(105u)) >> -(template_arg_1_4 % "..") |
- qi::eps(qbk_since(105u)) >> -(template_arg_1_5 % "..");
-
- template_arg_1_4 =
- qi::raw[+(brackets_1_4 | (qi::char_ - (qi::lit("..") | ']')))]
- ;
-
- brackets_1_4 =
- '[' >> +template_arg_1_4 >> ']'
- ;
-
- template_arg_1_5 =
- qi::raw[+(brackets_1_5 | ('\\' >> qi::char_) | (qi::char_ - (qi::lit("..") | '[' | ']')))]
- ;
-
- template_inner_arg_1_5 =
- +(brackets_1_5 | ('\\' >> qi::char_) | (qi::char_ - (qi::lit('[') | ']')))
- ;
-
- brackets_1_5 =
- '[' >> +template_inner_arg_1_5 >> ']'
- ;
-
- inline_code =
- '`' >>
- qi::raw[
- *(qi::char_ -
- ( '`'
- | (eol >> eol) // Make sure that we don't go
- ) // past a single block
- ) >> &qi::lit('`')
- ] [actions.inline_code]
- >> '`'
- ;
-
- code_block =
- (
- "```" >>
- qi::raw[
- *(qi::char_ - "```")
- >> &qi::lit("```")
- ] [actions.code_block]
- >> "```"
- )
- | (
- "``" >>
- qi::raw[
- *(qi::char_ - "``")
- >> &qi::lit("``")
- ] [actions.code_block]
- >> "``"
- )
- ;
-
- simple_markup =
- qi::omit[qi::char_(qi::_r1)] >>
- qi::raw[
- (
- qi::graph // A single char. e.g. *c*
- >> &(qi::char_(qi::_r1)
- >> (qi::space | qi::punct | qi::eoi))
- // space, punct or end
- ) // must follow qi::char_(qi::_r1)
- |
- ( qi::graph >> // qi::graph must follow qi::char_(qi::_r1)
- *(qi::char_ -
- ( (qi::graph >> qi::char_(qi::_r1)) // Make sure that we don't go
- | phrase_end // past a single block
- )
- ) >> qi::graph // qi::graph must precede qi::char_(qi::_r1)
- >> &(qi::char_(qi::_r1)
- >> (qi::space | qi::punct | qi::eoi))
- // space, punct or end
- ) // must follow qi::char_(qi::_r1)
- ]
- >> qi::omit[qi::char_(qi::_r1)]
- ;
-
-
- simple_format =
- simple_markup('*') [actions.simple_bold]
- | simple_markup('/') [actions.simple_italic]
- | simple_markup('_') [actions.simple_underline]
- | simple_markup('=') [actions.simple_teletype]
- ;
-
- phrase =
- *( common
- | comment
- | (qi::char_ - phrase_end) [actions.plain_char]
- )
- ;
-
- phrase_markup =
- '['
- >> ( cond_phrase
- | image
- | url
- | link
- | anchor
- | source_mode
- | funcref
- | classref
- | memberref
- | enumref
- | macroref
- | headerref
- | conceptref
- | globalref
- | bold
- | italic
- | underline
- | teletype
- | strikethrough
- | quote
- | replaceable
- | footnote
- | template_
- | qi::raw["br"] [actions.break_]
- )
- >> ']'
- ;
-
- escape =
- qi::raw["\\n"] [actions.break_]
- | "\\ " // ignore an escaped char
- | '\\' >> qi::punct [actions.raw_char]
- | (
- ("'''" >> -eol) [actions.escape_pre]
- >> *(qi::char_ - "'''") [actions.raw_char]
- >> qi::lit("'''") [actions.escape_post]
- )
- ;
-
- macro_identifier =
- +(qi::char_ - (qi::space | ']'))
- ;
-
- cond_phrase =
- '?' >> blank
- >> qi::raw[macro_identifier] [actions.cond_phrase_pre]
- >> qi::raw[-phrase] [actions.cond_phrase_post]
- ;
-
- image =
- (qi::eps(qbk_since(105u)) >> image_1_5) |
- (qi::eps(qbk_before(105u)) >> image_1_4);
-
- image_1_4 = (
- qi::raw['$']
- >> blank
- >> *(qi::char_ - phrase_end)
- >> &qi::lit(']')
- ) [ph::bind(actions.image, ph::begin(qi::_1), as_string(qi::_2))]
- ;
-
- image_1_5 = (
- qi::raw['$']
- >> blank
- >> image_filename
- >> hard_space
- >> image_attributes
- >> &qi::lit(']')
- ) [ph::bind(actions.image, ph::begin(qi::_1), qi::_2, qi::_3)]
- ;
-
- image_filename = qi::raw[
- +(qi::char_ - (qi::space | phrase_end | '['))
- >> *(
- +qi::space
- >> +(qi::char_ - (qi::space | phrase_end | '['))
- )];
-
- image_attributes = *(image_attribute >> space);
-
- image_attribute =
- '['
- >> image_attribute_key
- >> space
- >> image_attribute_value
- >> ']'
- ;
-
- image_attribute_key = *(qi::alnum | '_');
- image_attribute_value = *(qi::char_ - (phrase_end | '['));
-
- url =
- '@'
- >> qi::raw[*(qi::char_ -
- (']' | qi::space))] [ph::bind(actions.generic_link_pre, actions.url_pre, qi::_1)]
- >> ( &qi::lit(']')
- | (hard_space >> phrase)
- ) [ph::bind(actions.generic_link_post, actions.url_post)]
- ;
-
- anchor =
- '#'
- >> blank
- >> qi::raw[*(qi::char_ - phrase_end)] [actions.anchor]
- ;
-
- generic_link =
- qi::string(qi::_r1)
- >> hard_space
- >> qi::raw[*(qi::char_ -
- (']' | qi::space))] [ph::bind(actions.generic_link_pre, qi::_r2, qi::_1)]
- >> ( &qi::lit(']')
- | (hard_space >> phrase)
- ) [ph::bind(actions.generic_link_post, qi::_r3)]
- ;
-
- link = generic_link((char const*)"link", link_pre_, link_post_);
- funcref = generic_link((char const*)"funcref", funcref_pre_, funcref_post_);
- classref = generic_link((char const*)"classref", classref_pre_, classref_post_);
- memberref = generic_link((char const*)"memberref", memberref_pre_, memberref_post_);
- enumref = generic_link((char const*)"enumref", enumref_pre_, enumref_post_);
- macroref = generic_link((char const*)"macroref", macroref_pre_, macroref_post_);
- headerref = generic_link((char const*)"headerref", headerref_pre_, headerref_post_);
- conceptref = generic_link((char const*)"conceptref", conceptref_pre_, conceptref_post_);
- globalref = generic_link((char const*)"globalref", globalref_pre_, globalref_post_);
-
- bold =
- qi::char_('*') [actions.bold_pre]
- >> blank >> phrase [actions.bold_post]
- ;
-
- italic =
- qi::char_('\'') [actions.italic_pre]
- >> blank >> phrase [actions.italic_post]
- ;
-
- underline =
- qi::char_('_') [actions.underline_pre]
- >> blank >> phrase [actions.underline_post]
- ;
-
- teletype =
- qi::char_('^') [actions.teletype_pre]
- >> blank >> phrase [actions.teletype_post]
- ;
-
- strikethrough =
- qi::char_('-') [actions.strikethrough_pre]
- >> blank >> phrase [actions.strikethrough_post]
- ;
-
- quote =
- qi::char_('"') [actions.quote_pre]
- >> blank >> phrase [actions.quote_post]
- ;
-
- replaceable =
- qi::char_('~') [actions.replaceable_pre]
- >> blank >> phrase [actions.replaceable_post]
- ;
-
- source_mode =
- (
- qi::string("c++")
- | qi::string("python")
- | qi::string("teletype")
- ) [ph::ref(actions.source_mode) = qi::_1]
- ;
-
- footnote =
- qi::lit("footnote") [actions.footnote_pre]
- >> blank >> phrase [actions.footnote_post]
- ;
- }
-
- struct simple_phrase_grammar::rules
- {
- rules(quickbook::actions& actions);
-
- quickbook::actions& actions;
- bool unused;
- phrase_grammar common;
- qi::rule<iterator> phrase, comment, dummy_block;
- };
-
- 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) {}
-
- simple_phrase_grammar::~simple_phrase_grammar() {}
-
- simple_phrase_grammar::rules::rules(quickbook::actions& actions)
- : actions(actions), unused(false), common(actions, unused)
- {
- phrase =
- *( common
- | comment
- | (qi::char_ - ']') [actions.plain_char]
- )
- ;
-
- comment =
- "[/" >> *(dummy_block | (qi::char_ - ']')) >> ']'
- ;
-
- dummy_block =
- '[' >> *(dummy_block | (qi::char_ - ']')) >> ']'
- ;
- }
-}
-
-#endif // BOOST_SPIRIT_QUICKBOOK_PHRASE_HPP
-


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