Boost logo

Boost-Commit :

Subject: [Boost-commit] svn:boost r85113 - trunk/tools/quickbook/src
From: dnljms_at_[hidden]
Date: 2013-07-22 15:33:05


Author: danieljames
Date: 2013-07-22 15:33:05 EDT (Mon, 22 Jul 2013)
New Revision: 85113
URL: http://svn.boost.org/trac/boost/changeset/85113

Log:
Rename a few grammar wide variables.

Partly for clarity, and partly because there are too many things called
'block' and 'phrase'. The grammar names aren't great, but at least they
match. Might rething once I've done a lot of the 1.7 things.

Text files modified:
   trunk/tools/quickbook/src/actions.cpp | 2 +-
   trunk/tools/quickbook/src/block_element_grammar.cpp | 4 ++--
   trunk/tools/quickbook/src/grammar.cpp | 4 ++--
   trunk/tools/quickbook/src/grammar.hpp | 4 ++--
   trunk/tools/quickbook/src/grammar_impl.hpp | 23 +++++++++++++++--------
   trunk/tools/quickbook/src/main_grammar.cpp | 7 ++++---
   trunk/tools/quickbook/src/quickbook.cpp | 2 +-
   trunk/tools/quickbook/src/syntax_highlight.cpp | 6 +++---
   8 files changed, 30 insertions(+), 22 deletions(-)

Modified: trunk/tools/quickbook/src/actions.cpp
==============================================================================
--- trunk/tools/quickbook/src/actions.cpp Mon Jul 22 15:32:43 2013 (r85112)
+++ trunk/tools/quickbook/src/actions.cpp 2013-07-22 15:33:05 EDT (Mon, 22 Jul 2013) (r85113)
@@ -1217,7 +1217,7 @@
             bool r = cl::parse(first, last,
                     content.get_tag() == template_tags::phrase ?
                         state.grammar().inline_phrase :
- state.grammar().block
+ state.grammar().block_start
                 ).full;
 
             boost::swap(state.current_file, saved_current_file);

Modified: trunk/tools/quickbook/src/block_element_grammar.cpp
==============================================================================
--- trunk/tools/quickbook/src/block_element_grammar.cpp Mon Jul 22 15:32:43 2013 (r85112)
+++ trunk/tools/quickbook/src/block_element_grammar.cpp 2013-07-22 15:33:05 EDT (Mon, 22 Jul 2013) (r85113)
@@ -66,8 +66,8 @@
                 !(qbk_ver(106u) >> local.element_id);
 
         elements.add
- ("section", element_info(element_info::block, &local.begin_section, block_tags::begin_section))
- ("endsect", element_info(element_info::block, &local.end_section, block_tags::end_section))
+ ("section", element_info(element_info::section_block, &local.begin_section, block_tags::begin_section))
+ ("endsect", element_info(element_info::section_block, &local.end_section, block_tags::end_section))
             ;
 
         local.begin_section =

Modified: trunk/tools/quickbook/src/grammar.cpp
==============================================================================
--- trunk/tools/quickbook/src/grammar.cpp Mon Jul 22 15:32:43 2013 (r85112)
+++ trunk/tools/quickbook/src/grammar.cpp 2013-07-22 15:33:05 EDT (Mon, 22 Jul 2013) (r85113)
@@ -17,8 +17,8 @@
         : impl_(new impl(s))
         , command_line_macro(impl_->command_line, "command_line_macro")
         , inline_phrase(impl_->inline_phrase, "inline_phrase")
- , phrase(impl_->phrase_start, "phrase")
- , block(impl_->block_start, "block")
+ , phrase_start(impl_->phrase_start, "phrase")
+ , block_start(impl_->block_start, "block")
         , doc_info(impl_->doc_info_details, "doc_info")
     {
     }

Modified: trunk/tools/quickbook/src/grammar.hpp
==============================================================================
--- trunk/tools/quickbook/src/grammar.hpp Mon Jul 22 15:32:43 2013 (r85112)
+++ trunk/tools/quickbook/src/grammar.hpp 2013-07-22 15:33:05 EDT (Mon, 22 Jul 2013) (r85113)
@@ -58,8 +58,8 @@
     public:
         grammar command_line_macro;
         grammar inline_phrase;
- grammar phrase;
- grammar block;
+ grammar phrase_start;
+ grammar block_start;
         grammar doc_info;
 
         quickbook_grammar(quickbook::state&);

Modified: trunk/tools/quickbook/src/grammar_impl.hpp
==============================================================================
--- trunk/tools/quickbook/src/grammar_impl.hpp Mon Jul 22 15:32:43 2013 (r85112)
+++ trunk/tools/quickbook/src/grammar_impl.hpp 2013-07-22 15:33:05 EDT (Mon, 22 Jul 2013) (r85113)
@@ -24,7 +24,7 @@
     {
         enum type_enum {
             nothing = 0,
- block = 1,
+ section_block = 1,
             conditional_or_block = 2,
             nested_block = 4,
             phrase = 8,
@@ -32,14 +32,21 @@
         };
 
         enum context {
- in_phrase = phrase | maybe_block,
- in_nested_block = phrase | maybe_block | nested_block,
+ // At the top level we allow everything.
+ in_top_level = phrase | maybe_block | nested_block | conditional_or_block | section_block,
+ // In conditional phrases we everything but section elements.
             in_conditional = phrase | maybe_block | nested_block | conditional_or_block,
- in_block = phrase | maybe_block | nested_block | conditional_or_block | block,
- only_nested_block = nested_block,
- only_block = nested_block | conditional_or_block | block,
- only_list_block = nested_block | conditional_or_block,
- only_contextual_block = maybe_block | nested_block | conditional_or_block | block
+ // In nested blocks we allow a much more limited range of elements.
+ in_nested_block = phrase | maybe_block | nested_block,
+ // In a phrase we only allow phrase elements, ('maybe_block'
+ // elements are treated as phrase elements in this context)
+ in_phrase = phrase | maybe_block,
+ // At the start of a block these are all block elements.
+ only_contextual_block = maybe_block | nested_block | conditional_or_block | section_block,
+ // These are all block elements in all other contexts.
+ only_block = nested_block | conditional_or_block | section_block,
+ // Block elements that are allowed in a list item
+ only_list_block = nested_block | conditional_or_block
         };
 
         element_info()

Modified: trunk/tools/quickbook/src/main_grammar.cpp
==============================================================================
--- trunk/tools/quickbook/src/main_grammar.cpp Mon Jul 22 15:32:43 2013 (r85112)
+++ trunk/tools/quickbook/src/main_grammar.cpp 2013-07-22 15:33:05 EDT (Mon, 22 Jul 2013) (r85113)
@@ -143,7 +143,7 @@
             : list_stack()
             , list_indent(0)
             , no_eols(true)
- , context(element_info::in_block)
+ , context(element_info::in_top_level)
             , mark('\0')
             , state_(state)
             {}
@@ -162,9 +162,10 @@
             info_ = l.info;
 
             if (!l.list_stack.empty() && !l.list_stack.top().root &&
- info_.type == element_info::block)
+ info_.type == element_info::section_block)
             {
- // If in a list and the element is a block, end the list.
+ // If in a list and the element is a section block, end the
+ // list.
                 list_item_action list_item(l.state_);
                 list_item();
                 l.clear_stack();

Modified: trunk/tools/quickbook/src/quickbook.cpp
==============================================================================
--- trunk/tools/quickbook/src/quickbook.cpp Mon Jul 22 15:32:43 2013 (r85112)
+++ trunk/tools/quickbook/src/quickbook.cpp 2013-07-22 15:33:05 EDT (Mon, 22 Jul 2013) (r85113)
@@ -99,7 +99,7 @@
             parse_iterator pos = info.stop;
             std::string doc_type = pre(state, pos, include_doc_id, nested_file);
 
- info = cl::parse(info.hit ? info.stop : first, last, state.grammar().block);
+ info = cl::parse(info.hit ? info.stop : first, last, state.grammar().block_start);
 
             post(state, doc_type);
 

Modified: trunk/tools/quickbook/src/syntax_highlight.cpp
==============================================================================
--- trunk/tools/quickbook/src/syntax_highlight.cpp Mon Jul 22 15:32:43 2013 (r85112)
+++ trunk/tools/quickbook/src/syntax_highlight.cpp 2013-07-22 15:33:05 EDT (Mon, 22 Jul 2013) (r85113)
@@ -318,7 +318,7 @@
                         (
                             (
                                 (+(cl::anychar_p - "``") >> cl::eps_p("``"))
- & g.phrase
+ & g.phrase_start
                             )
>> cl::str_p("``")
                         )
@@ -473,7 +473,7 @@
                         (
                             (
                                 (+(cl::anychar_p - "``") >> cl::eps_p("``"))
- & g.phrase
+ & g.phrase_start
                             )
>> cl::str_p("``")
                         )
@@ -595,7 +595,7 @@
                         (
                             (
                                 (+(cl::anychar_p - "``") >> cl::eps_p("``"))
- & g.phrase
+ & g.phrase_start
                             )
>> cl::str_p("``")
                         )


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