Boost logo

Boost-Commit :

Subject: [Boost-commit] svn:boost r59309 - branches/quickbook-1.5-spirit2
From: daniel_james_at_[hidden]
Date: 2010-01-27 17:03:42


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

Log:
Code in block.cpp
Added:
   branches/quickbook-1.5-spirit2/code.hpp (contents, props changed)
Text files modified:
   branches/quickbook-1.5-spirit2/block.cpp | 24 +++++++++++++++---------
   branches/quickbook-1.5-spirit2/block.hpp | 1 +
   branches/quickbook-1.5-spirit2/phrase.cpp | 7 -------
   branches/quickbook-1.5-spirit2/phrase.hpp | 8 +-------
   4 files changed, 17 insertions(+), 23 deletions(-)

Modified: branches/quickbook-1.5-spirit2/block.cpp
==============================================================================
--- branches/quickbook-1.5-spirit2/block.cpp (original)
+++ branches/quickbook-1.5-spirit2/block.cpp 2010-01-27 17:03:41 EST (Wed, 27 Jan 2010)
@@ -106,7 +106,7 @@
         bool no_eols;
         phrase_grammar common;
         qi::rule<iterator>
- start_, blocks, block_markup, code, code_line,
+ start_, blocks, block_markup,
                         space, blank, comment,
                         phrase, phrase_end, ordered_list,
                         xinclude, include, hard_space, eol, paragraph_end,
@@ -158,6 +158,9 @@
         qi::rule<iterator, quickbook::table_cell()> table_cell;
         qi::rule<iterator, quickbook::formatted()> table_cell_body;
         
+ qi::rule<iterator, quickbook::code()> code;
+ qi::rule<iterator> code_line;
+
         qi::rule<iterator, quickbook::title()> title_phrase;
         qi::rule<iterator, std::string()> phrase_attr;
         
@@ -181,7 +184,7 @@
 
         blocks =
            +( block_markup
- | code
+ | code [actions.process][actions.output]
             | list [actions.process][actions.output]
             | hr [actions.process][actions.output]
             | comment >> *eol
@@ -492,16 +495,19 @@
             ;
 
         code =
- qi::raw[
- code_line
- >> *(*eol >> code_line)
- ] [actions.code]
- >> +eol
+ position
+ >> qi::raw[
+ code_line
+ >> *(*eol >> code_line)
+ ]
+ >> +eol
+ >> qi::attr(true)
             ;
 
         code_line =
- ((qi::char_(' ') | '\t'))
- >> *(qi::char_ - eol) >> eol
+ qi::char_(" \t")
+ >> *(qi::char_ - eol)
+ >> eol
             ;
 
         list =

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:03:41 EST (Wed, 27 Jan 2010)
@@ -15,6 +15,7 @@
 #include <boost/optional.hpp>
 #include <boost/spirit/include/classic_position_iterator.hpp>
 #include "./parse_types.hpp"
+#include "./code.hpp"
 
 namespace quickbook
 {

Added: branches/quickbook-1.5-spirit2/code.hpp
==============================================================================
--- (empty file)
+++ branches/quickbook-1.5-spirit2/code.hpp 2010-01-27 17:03:41 EST (Wed, 27 Jan 2010)
@@ -0,0 +1,31 @@
+/*=============================================================================
+ 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_CODE_HPP)
+#define BOOST_SPIRIT_QUICKBOOK_CODE_HPP
+
+namespace quickbook
+{
+ struct code {
+ bool block;
+ file_position position;
+ std::string code;
+ };
+
+ void process(quickbook::actions&, code const&);
+}
+
+BOOST_FUSION_ADAPT_STRUCT(
+ quickbook::code,
+ (quickbook::file_position, position)
+ (std::string, code)
+ (bool, block)
+)
+
+#endif
\ No newline at end of file

Modified: branches/quickbook-1.5-spirit2/phrase.cpp
==============================================================================
--- branches/quickbook-1.5-spirit2/phrase.cpp (original)
+++ branches/quickbook-1.5-spirit2/phrase.cpp 2010-01-27 17:03:41 EST (Wed, 27 Jan 2010)
@@ -49,13 +49,6 @@
 )
 
 BOOST_FUSION_ADAPT_STRUCT(
- quickbook::code,
- (quickbook::file_position, position)
- (std::string, code)
- (bool, block)
-)
-
-BOOST_FUSION_ADAPT_STRUCT(
     quickbook::break_,
     (quickbook::file_position, position)
     (char const*, dummy)

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:03:41 EST (Wed, 27 Jan 2010)
@@ -13,6 +13,7 @@
 #include <string>
 #include <map>
 #include "./parse_types.hpp"
+#include "./code.hpp"
 #include "./detail/template_stack.hpp"
 
 namespace quickbook
@@ -47,12 +48,6 @@
         std::string raw_content;
     };
     
- struct code {
- bool block;
- file_position position;
- std::string code;
- };
-
     struct cond_phrase {
         std::string macro_id;
         std::string content;
@@ -77,7 +72,6 @@
     void process(quickbook::actions&, anchor const&);
     void process(quickbook::actions&, link const&);
     void process(quickbook::actions&, simple_markup const&);
- void process(quickbook::actions&, code const&);
     void process(quickbook::actions&, cond_phrase const&);
     void process(quickbook::actions&, break_ const&);
     void process(quickbook::actions&, image const&);


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