Boost logo

Boost-Commit :

Subject: [Boost-commit] svn:boost r76646 - branches/quickbook-dev/tools/quickbook/src
From: dnljms_at_[hidden]
Date: 2012-01-22 18:07:55


Author: danieljames
Date: 2012-01-22 18:07:54 EST (Sun, 22 Jan 2012)
New Revision: 76646
URL: http://svn.boost.org/trac/boost/changeset/76646

Log:
Quickbook: Use half-open ranges for version checks.
Text files modified:
   branches/quickbook-dev/tools/quickbook/src/actions.cpp | 2 +-
   branches/quickbook-dev/tools/quickbook/src/actions.hpp | 14 +++++---------
   branches/quickbook-dev/tools/quickbook/src/block_element_grammar.cpp | 18 +++++++++---------
   branches/quickbook-dev/tools/quickbook/src/doc_info_grammar.cpp | 2 +-
   branches/quickbook-dev/tools/quickbook/src/main_grammar.cpp | 16 ++++++++--------
   branches/quickbook-dev/tools/quickbook/src/phrase_element_grammar.cpp | 20 ++++++++++----------
   6 files changed, 34 insertions(+), 38 deletions(-)

Modified: branches/quickbook-dev/tools/quickbook/src/actions.cpp
==============================================================================
--- branches/quickbook-dev/tools/quickbook/src/actions.cpp (original)
+++ branches/quickbook-dev/tools/quickbook/src/actions.cpp 2012-01-22 18:07:54 EST (Sun, 22 Jan 2012)
@@ -75,7 +75,7 @@
     }
 
     bool quickbook_range::in_range() const {
- return qbk_version_n >= min_ && qbk_version_n < max_;
+ return qbk_version_n >= lower && qbk_version_n < upper;
     }
 
     void explicit_list_action(quickbook::state&, value);

Modified: branches/quickbook-dev/tools/quickbook/src/actions.hpp
==============================================================================
--- branches/quickbook-dev/tools/quickbook/src/actions.hpp (original)
+++ branches/quickbook-dev/tools/quickbook/src/actions.hpp 2012-01-22 18:07:54 EST (Sun, 22 Jan 2012)
@@ -23,8 +23,8 @@
     namespace cl = boost::spirit::classic;
 
     struct quickbook_range : cl::parser<quickbook_range> {
- quickbook_range(unsigned min_, unsigned max_)
- : min_(min_), max_(max_) {}
+ quickbook_range(unsigned lower, unsigned upper)
+ : lower(lower), upper(upper) {}
 
         bool in_range() const;
         
@@ -35,15 +35,11 @@
             return in_range() ? scan.empty_match() : scan.no_match();
         }
 
- unsigned min_, max_;
+ unsigned lower, upper;
     };
     
- inline quickbook_range qbk_since(unsigned min_) {
- return quickbook_range(min_, 999);
- }
-
- inline quickbook_range qbk_before(unsigned max_) {
- return quickbook_range(0, max_);
+ inline quickbook_range qbk_ver(unsigned lower, unsigned upper = 999u) {
+ return quickbook_range(lower, upper);
     }
 
     // Throws load_error

Modified: branches/quickbook-dev/tools/quickbook/src/block_element_grammar.cpp
==============================================================================
--- branches/quickbook-dev/tools/quickbook/src/block_element_grammar.cpp (original)
+++ branches/quickbook-dev/tools/quickbook/src/block_element_grammar.cpp 2012-01-22 18:07:54 EST (Sun, 22 Jan 2012)
@@ -52,7 +52,7 @@
 
         local.element_id =
             !( ':'
- >> ( !(qbk_since(105u) >> space)
+ >> ( !(qbk_ver(105u) >> space)
>> (+(cl::alnum_p | '_')) [state.values.entry(ph::arg1, ph::arg2, general_tags::element_id)]
                 | cl::eps_p [element_id_warning]
                 )
@@ -60,10 +60,10 @@
             ;
         
         local.element_id_1_5 =
- !(qbk_since(105u) >> local.element_id);
+ !(qbk_ver(105u) >> local.element_id);
 
         local.element_id_1_6 =
- !(qbk_since(106u) >> local.element_id);
+ !(qbk_ver(106u) >> local.element_id);
 
         elements.add
             ("section", element_info(element_info::block, &local.begin_section, block_tags::begin_section))
@@ -117,8 +117,8 @@
             ;
 
         local.preformatted =
- ( qbk_before(106) >> space
- | qbk_since(106) >> blank >> !eol
+ ( qbk_ver(0, 106) >> space
+ | qbk_ver(106) >> blank >> !eol
                 )
>> to_value()
                 [
@@ -242,10 +242,10 @@
             ;
 
         local.table_title =
- qbk_before(106)
+ qbk_ver(0, 106)
>> (*(cl::anychar_p - eol)) [state.values.entry(ph::arg1, ph::arg2, table_tags::title)]
>> (+eol)
- | qbk_since(106)
+ | qbk_ver(106)
>> to_value(table_tags::title)
                 [
                     table_title_phrase
@@ -299,9 +299,9 @@
             ;
 
         local.include_filename =
- qbk_before(106u)
+ qbk_ver(0, 106u)
>> (*(cl::anychar_p - phrase_end)) [state.values.entry(ph::arg1, ph::arg2)]
- | qbk_since(106u)
+ | qbk_ver(106u)
>> to_value()
                 [ *( raw_escape
                     | (cl::anychar_p - phrase_end)

Modified: branches/quickbook-dev/tools/quickbook/src/doc_info_grammar.cpp
==============================================================================
--- branches/quickbook-dev/tools/quickbook/src/doc_info_grammar.cpp (original)
+++ branches/quickbook-dev/tools/quickbook/src/doc_info_grammar.cpp 2012-01-22 18:07:54 EST (Sun, 22 Jan 2012)
@@ -144,7 +144,7 @@
>> blank
                 ]
>> space
- >> !(qbk_since(106u) >> cl::eps_p(ph::var(local.source_mode_unset))
+ >> !(qbk_ver(106u) >> cl::eps_p(ph::var(local.source_mode_unset))
                                             [cl::assign_a(state.source_mode, "c++")]
                 )
>> ( *( ( local.doc_info_attribute

Modified: branches/quickbook-dev/tools/quickbook/src/main_grammar.cpp
==============================================================================
--- branches/quickbook-dev/tools/quickbook/src/main_grammar.cpp (original)
+++ branches/quickbook-dev/tools/quickbook/src/main_grammar.cpp 2012-01-22 18:07:54 EST (Sun, 22 Jan 2012)
@@ -468,9 +468,9 @@
         local.hr =
                 cl::str_p("----")
>> state.values.list(block_tags::hr)
- [ ( qbk_since(106u)
+ [ ( qbk_ver(106u)
>> *(line_comment | (cl::anychar_p - (cl::eol_p | '[' | ']')))
- | qbk_before(106u)
+ | qbk_ver(0, 106u)
>> *(line_comment | (cl::anychar_p - (cl::eol_p | "[/")))
                     )
>> *eol
@@ -525,7 +525,7 @@
             | local.simple_markup
             | escape
             | comment
- | qbk_since(106u) >> local.square_brackets
+ | qbk_ver(106u) >> local.square_brackets
             | cl::space_p [raw_char]
             | cl::anychar_p [plain_char]
             ;
@@ -570,8 +570,8 @@
             ;
 
         local.template_args =
- qbk_since(105u) >> local.template_args_1_5
- | qbk_before(105u) >> local.template_args_1_4
+ qbk_ver(105u) >> local.template_args_1_5
+ | qbk_ver(0, 105u) >> local.template_args_1_4
             ;
 
         local.template_args_1_4 = local.template_arg_1_4 >> *(".." >> local.template_arg_1_4);
@@ -773,7 +773,7 @@
             ;
 
         local.command_line_macro_identifier =
- qbk_since(106u)
+ qbk_ver(106u)
>> +(cl::anychar_p - (cl::space_p | '[' | '\\' | ']' | '='))
             | +(cl::anychar_p - (cl::space_p | ']' | '='))
             ;
@@ -822,9 +822,9 @@
             ;
 
         macro_identifier =
- qbk_since(106u)
+ qbk_ver(106u)
>> +(cl::anychar_p - (cl::space_p | '[' | '\\' | ']'))
- | qbk_before(106u)
+ | qbk_ver(0, 106u)
>> +(cl::anychar_p - (cl::space_p | ']'))
             ;
     }

Modified: branches/quickbook-dev/tools/quickbook/src/phrase_element_grammar.cpp
==============================================================================
--- branches/quickbook-dev/tools/quickbook/src/phrase_element_grammar.cpp (original)
+++ branches/quickbook-dev/tools/quickbook/src/phrase_element_grammar.cpp 2012-01-22 18:07:54 EST (Sun, 22 Jan 2012)
@@ -59,14 +59,14 @@
         // Note that the attribute values here are encoded in plain text not
         // boostbook.
         local.image =
- qbk_since(105u)
+ qbk_ver(105u)
>> blank
- >> ( qbk_before(106u)
+ >> ( qbk_ver(0, 106u)
>> (+(
                         *cl::space_p
>> +(cl::anychar_p - (cl::space_p | phrase_end | '['))
                     )) [state.values.entry(ph::arg1, ph::arg2)]
- | qbk_since(106u)
+ | qbk_ver(106u)
>> to_value()
                     [ +( raw_escape
                         | (+cl::space_p >> ~cl::eps_p(phrase_end | '['))
@@ -82,10 +82,10 @@
>> (*(cl::alnum_p | '_'))
                                         [state.values.entry(ph::arg1, ph::arg2)]
>> space
- >> ( qbk_before(106u)
+ >> ( qbk_ver(0, 106u)
>> (*(cl::anychar_p - (phrase_end | '[')))
                                         [state.values.entry(ph::arg1, ph::arg2)]
- | qbk_since(106u)
+ | qbk_ver(106u)
>> to_value()
                         [ *( raw_escape
                             | (cl::anychar_p - (phrase_end | '['))
@@ -97,7 +97,7 @@
>> space
                 ]
>> cl::eps_p(']')
- | qbk_before(105u)
+ | qbk_ver(0, 105u)
>> blank
>> (*(cl::anychar_p - phrase_end)) [state.values.entry(ph::arg1, ph::arg2)]
>> cl::eps_p(']')
@@ -118,10 +118,10 @@
 
         local.link =
                 space
- >> ( qbk_before(106u)
+ >> ( qbk_ver(0, 106u)
>> (*(cl::anychar_p - (']' | space)))
                                                 [state.values.entry(ph::arg1, ph::arg2)]
- | qbk_since(106u)
+ | qbk_ver(106u)
>> to_value()
                     [ *( raw_escape
                         | (cl::anychar_p - (cl::ch_p('[') | ']' | space))
@@ -142,9 +142,9 @@
 
         local.anchor =
                 blank
- >> ( qbk_before(106u)
+ >> ( qbk_ver(0, 106u)
>> (*(cl::anychar_p - phrase_end)) [state.values.entry(ph::arg1, ph::arg2)]
- | qbk_since(106u)
+ | qbk_ver(106u)
>> to_value()
                     [ *( raw_escape
                         | (cl::anychar_p - phrase_end)


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