Boost logo

Boost-Commit :

Subject: [Boost-commit] svn:boost r59318 - branches/quickbook-1.5-spirit2
From: daniel_james_at_[hidden]
Date: 2010-01-27 17:06:05


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

Log:
Make the code snippet grammar a cpp file.
Added:
   branches/quickbook-1.5-spirit2/code_snippet_grammar.cpp (contents, props changed)
      - copied, changed from r59317, /branches/quickbook-1.5-spirit2/code_snippet.hpp
Removed:
   branches/quickbook-1.5-spirit2/code_snippet.hpp
Text files modified:
   branches/quickbook-1.5-spirit2/Jamfile.v2 | 1 +
   branches/quickbook-1.5-spirit2/code_snippet.cpp | 2 +-
   branches/quickbook-1.5-spirit2/code_snippet_grammar.cpp | 5 -----
   3 files changed, 2 insertions(+), 6 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:06:04 EST (Wed, 27 Jan 2010)
@@ -37,6 +37,7 @@
     block_list.cpp
     doc_info.cpp
     code_snippet.cpp
+ code_snippet_grammar.cpp
     syntax_highlight.cpp
     /boost//program_options
     /boost//filesystem

Modified: branches/quickbook-1.5-spirit2/code_snippet.cpp
==============================================================================
--- branches/quickbook-1.5-spirit2/code_snippet.cpp (original)
+++ branches/quickbook-1.5-spirit2/code_snippet.cpp 2010-01-27 17:06:04 EST (Wed, 27 Jan 2010)
@@ -19,7 +19,7 @@
 #include "markups.hpp"
 #include "actions_class.hpp"
 #include "grammars.hpp"
-#include "code_snippet.hpp"
+#include "code_snippet_types.hpp"
 
 namespace quickbook
 {

Deleted: branches/quickbook-1.5-spirit2/code_snippet.hpp
==============================================================================
--- branches/quickbook-1.5-spirit2/code_snippet.hpp 2010-01-27 17:06:04 EST (Wed, 27 Jan 2010)
+++ (empty file)
@@ -1,234 +0,0 @@
-/*=============================================================================
- Copyright (c) 2006 Joel de Guzman
- 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_CODE_SNIPPET_HPP)
-#define BOOST_SPIRIT_QUICKBOOK_CODE_SNIPPET_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/qi_attr.hpp>
-#include <boost/spirit/include/phoenix_core.hpp>
-#include <boost/spirit/include/phoenix_bind.hpp>
-#include <boost/spirit/include/phoenix_operator.hpp>
-#include "code_snippet_types.hpp"
-#include "grammars.hpp"
-#include "parse_utils.hpp"
-#include "actions.hpp"
-#include "actions_class.hpp"
-
-namespace quickbook
-{
- namespace ph = boost::phoenix;
-
- namespace
- {
- // Shared rules
-
- qi::rule<iterator, file_position()>
- position = qi::raw[qi::eps] [get_position];
- }
-
- struct python_code_snippet_grammar::rules
- {
- typedef code_snippet_actions actions_type;
-
- rules(actions_type & actions);
-
- actions_type& actions;
-
- qi::rule<iterator>
- start_, ignore;
- qi::rule<iterator, quickbook::code_snippet()>
- snippet;
- qi::rule<iterator, std::string()>
- code_elements, identifier;
- qi::rule<iterator, quickbook::callout()>
- inline_callout, line_callout;
- qi::rule<iterator, quickbook::escaped_comment()>
- escaped_comment;
- };
-
- 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_) {}
-
- python_code_snippet_grammar::~python_code_snippet_grammar() {}
-
- python_code_snippet_grammar::rules::rules(actions_type& actions)
- : actions(actions)
- {
- start_ =
- +(
- snippet [actions.output]
- | qi::char_
- )
- ;
-
- identifier =
- (qi::alpha | '_') >> *(qi::alnum | '_')
- ;
-
- snippet =
- position
- >> "#["
- >> qi::omit[*qi::space]
- >> identifier
- >> qi::omit[*(code_elements - "#]")]
- >> "#]"
- ;
-
- code_elements =
- escaped_comment [actions.process]
- | ignore
- | (qi::char_ - "#]") [actions.process]
- ;
-
- ignore =
- *qi::blank >> "#<-"
- >> (*(qi::char_ - "#->"))
- >> "#->" >> *qi::blank >> qi::eol
- | "\"\"\"<-\"\"\""
- >> (*(qi::char_ - "\"\"\"->\"\"\""))
- >> "\"\"\"->\"\"\""
- | "\"\"\"<-"
- >> (*(qi::char_ - "->\"\"\""))
- >> "->\"\"\""
- ;
-
- escaped_comment =
- qi::omit[*qi::space >> "#`"]
- >> (
- *(qi::char_ - qi::eol)
- >> qi::eol
- )
- >> qi::attr("dummy")
- | qi::omit[*qi::space >> "\"\"\"`"]
- >> (
- *(qi::char_ - "\"\"\"")
- )
- >> "\"\"\""
- >> qi::attr("dummy")
- ;
- }
-
- struct cpp_code_snippet_grammar::rules
- {
- typedef code_snippet_actions actions_type;
-
- rules(actions_type & actions);
-
- actions_type& actions;
-
- qi::rule<iterator>
- start_, code_elements, ignore;
- qi::rule<iterator, quickbook::code_snippet()>
- snippet;
- qi::rule<iterator, std::string()>
- identifier;
- qi::rule<iterator, quickbook::callout()>
- inline_callout, line_callout;
- qi::rule<iterator, quickbook::escaped_comment()>
- escaped_comment;
- };
-
- 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_) {}
-
- cpp_code_snippet_grammar::~cpp_code_snippet_grammar() {}
-
- cpp_code_snippet_grammar::rules::rules(actions_type & actions)
- : actions(actions)
- {
- start_ =
- +(
- snippet [actions.output]
- | qi::char_
- )
- ;
-
- identifier =
- (qi::alpha | '_') >> *(qi::alnum | '_')
- ;
-
- snippet =
- position
- >> "//["
- >> qi::omit[*qi::space]
- >> identifier
- >> qi::omit[*(code_elements - "//]")]
- >> "//]"
- |
- position
- >> "/*["
- >> qi::omit[*qi::space]
- >> identifier
- >> qi::omit[*qi::space >> "*/"]
- >> qi::omit[*(code_elements - "/*]*")]
- >> "/*]*/"
- ;
-
- code_elements =
- escaped_comment [actions.process]
- | ignore
- | line_callout [actions.process]
- | inline_callout [actions.process]
- | (qi::char_ - "//]" - "/*]*/") [actions.process]
- ;
-
- inline_callout =
- "/*<"
- >> *(qi::char_ - ">*/")
- >> ">*/"
- >> qi::attr("callout_bug")
- ;
-
- line_callout =
- "/*<<"
- >> *(qi::char_ - ">>*/")
- >> ">>*/"
- >> qi::omit[*qi::space]
- >> qi::attr("line_callout_bug")
- ;
-
- ignore =
- *qi::blank >> "//<-"
- >> (*(qi::char_ - "//->"))
- >> "//->" >> *qi::blank >> qi::eol
- | "/*<-*/"
- >> (*(qi::char_ - "/*->*/"))
- >> "/*->*/"
- | "/*<-"
- >> (*(qi::char_ - "->*/"))
- >> "->*/"
- ;
-
- escaped_comment =
- qi::omit[*qi::space]
- >> "//`"
- >> (
- (*(qi::char_ - qi::eol))
- >> qi::eol
- )
- >> qi::attr("dummy")
- | qi::omit[*qi::space]
- >> "/*`"
- >> (
- *(qi::char_ - "*/")
- )
- >> "*/"
- >> qi::attr("dummy")
- ;
- }
-}
-
-#endif // BOOST_SPIRIT_QUICKBOOK_CODE_SNIPPET_HPP
-

Copied: branches/quickbook-1.5-spirit2/code_snippet_grammar.cpp (from r59317, /branches/quickbook-1.5-spirit2/code_snippet.hpp)
==============================================================================
--- /branches/quickbook-1.5-spirit2/code_snippet.hpp (original)
+++ branches/quickbook-1.5-spirit2/code_snippet_grammar.cpp 2010-01-27 17:06:04 EST (Wed, 27 Jan 2010)
@@ -6,8 +6,6 @@
     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_CODE_SNIPPET_HPP)
-#define BOOST_SPIRIT_QUICKBOOK_CODE_SNIPPET_HPP
 
 #include <boost/spirit/include/qi_core.hpp>
 #include <boost/spirit/include/qi_eol.hpp>
@@ -229,6 +227,3 @@
             ;
     }
 }
-
-#endif // BOOST_SPIRIT_QUICKBOOK_CODE_SNIPPET_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