Boost logo

Boost-Commit :

Subject: [Boost-commit] svn:boost r67637 - in trunk/tools/quickbook: src test
From: dnljms_at_[hidden]
Date: 2011-01-03 17:15:49


Author: danieljames
Date: 2011-01-03 17:15:41 EST (Mon, 03 Jan 2011)
New Revision: 67637
URL: http://svn.boost.org/trac/boost/changeset/67637

Log:
Allow include, import and xinclude in conditional macros.
Text files modified:
   trunk/tools/quickbook/src/block_markup_grammar.cpp | 6 ++++++
   trunk/tools/quickbook/src/grammar_impl.hpp | 3 +++
   trunk/tools/quickbook/src/main_grammar.cpp | 24 +++++++++++++++++++++++-
   trunk/tools/quickbook/src/phrase_markup_grammar.cpp | 2 +-
   trunk/tools/quickbook/test/include_1_5.gold | 12 ++++++++++++
   trunk/tools/quickbook/test/include_1_5.quickbook | 6 ++++++
   trunk/tools/quickbook/test/include_1_6.gold | 12 ++++++++++++
   trunk/tools/quickbook/test/include_1_6.quickbook | 7 +++++++
   8 files changed, 70 insertions(+), 2 deletions(-)

Modified: trunk/tools/quickbook/src/block_markup_grammar.cpp
==============================================================================
--- trunk/tools/quickbook/src/block_markup_grammar.cpp (original)
+++ trunk/tools/quickbook/src/block_markup_grammar.cpp 2011-01-03 17:15:41 EST (Mon, 03 Jan 2011)
@@ -318,6 +318,12 @@
             ("include", &local.include)
             ;
 
+ extended_phrase_keyword_rules.add
+ ("xinclude", &local.xinclude)
+ ("import", &local.import)
+ ("include", &local.include)
+ ;
+
         local.xinclude =
                space
>> (*(cl::anychar_p - phrase_end))

Modified: trunk/tools/quickbook/src/grammar_impl.hpp
==============================================================================
--- trunk/tools/quickbook/src/grammar_impl.hpp (original)
+++ trunk/tools/quickbook/src/grammar_impl.hpp 2011-01-03 17:15:41 EST (Mon, 03 Jan 2011)
@@ -30,6 +30,7 @@
         cl::rule<scanner> common;
         cl::rule<scanner> simple_phrase;
         cl::rule<scanner> phrase;
+ cl::rule<scanner> extended_phrase;
         cl::rule<scanner> inside_paragraph;
         cl::rule<scanner> command_line;
 
@@ -49,6 +50,8 @@
         cl::symbols<cl::rule<scanner>*> block_keyword_rules;
         cl::symbols<cl::rule<scanner>*> block_symbol_rules;
         
+ cl::symbols<cl::rule<scanner>*> extended_phrase_keyword_rules;
+
         // Doc Info
         cl::rule<scanner> doc_info_details;
         

Modified: trunk/tools/quickbook/src/main_grammar.cpp
==============================================================================
--- trunk/tools/quickbook/src/main_grammar.cpp (original)
+++ trunk/tools/quickbook/src/main_grammar.cpp 2011-01-03 17:15:41 EST (Mon, 03 Jan 2011)
@@ -63,7 +63,7 @@
                         block_markup, block_markup_start,
                         code, code_line, blank_line, hr,
                         list, ordered_list, list_item,
- phrase_markup,
+ phrase_markup, extended_phrase_markup,
                         simple_phrase_end,
                         escape,
                         inline_code, simple_format,
@@ -327,6 +327,13 @@
             )
             ;
 
+ extended_phrase =
+ *( local.extended_phrase_markup
+ | common
+ | (cl::anychar_p - phrase_end) [actions.plain_char]
+ )
+ ;
+
         inside_paragraph =
             (*( common
             | (cl::anychar_p - phrase_end) [actions.plain_char]
@@ -336,6 +343,7 @@
 
         local.phrase_markup
             = '['
+ >> space
>> ( phrase_keyword_rules [detail::assign_rule(local.phrase_keyword_rule)]
>> (cl::eps_p - (cl::alnum_p | '_'))
>> local.phrase_keyword_rule
@@ -347,6 +355,20 @@
>> ']'
             ;
 
+ local.extended_phrase_markup
+ = '['
+ >> space
+ >> extended_phrase_keyword_rules [detail::assign_rule(local.block_keyword_rule)]
+ >> (cl::eps_p - (cl::alnum_p | '_'))
+ [actions.inside_paragraph]
+ >> ( local.block_keyword_rule
+ >> ( (space >> ']')
+ | cl::eps_p [actions.error]
+ )
+ | cl::eps_p [actions.error]
+ )
+ ;
+
         local.escape =
                 cl::str_p("\\n") [actions.break_]
             | cl::str_p("\\ ") // ignore an escaped space

Modified: trunk/tools/quickbook/src/phrase_markup_grammar.cpp
==============================================================================
--- trunk/tools/quickbook/src/phrase_markup_grammar.cpp (original)
+++ trunk/tools/quickbook/src/phrase_markup_grammar.cpp 2011-01-03 17:15:41 EST (Mon, 03 Jan 2011)
@@ -47,7 +47,7 @@
         local.cond_phrase =
                 blank
>> macro_identifier [actions.cond_phrase_pre]
- >> actions.scoped_cond_phrase[phrase]
+ >> actions.scoped_cond_phrase[extended_phrase]
             ;
 
         phrase_symbol_rules.add

Modified: trunk/tools/quickbook/test/include_1_5.gold
==============================================================================
--- trunk/tools/quickbook/test/include_1_5.gold (original)
+++ trunk/tools/quickbook/test/include_1_5.gold 2011-01-03 17:15:41 EST (Mon, 03 Jan 2011)
@@ -15,4 +15,16 @@
       Just testing.
     </para>
   </section>
+ <para>
+ Just trying including in a conditional macro.
+ </para>
+ <section id="foo2.test">
+ <title><link linkend="foo2.test">Test</link></title>
+ <para>
+ Just testing.
+ </para>
+ </section>
+ <para>
+ With some text around it.
+ </para>
 </article>

Modified: trunk/tools/quickbook/test/include_1_5.quickbook
==============================================================================
--- trunk/tools/quickbook/test/include_1_5.quickbook (original)
+++ trunk/tools/quickbook/test/include_1_5.quickbook 2011-01-03 17:15:41 EST (Mon, 03 Jan 2011)
@@ -8,3 +8,9 @@
 [include:foo include-sub2.quickbook]
 [include empty.quickbook]
 
+[def __defined__]
+
+[? __undefined__ [include:foo1 include-sub2.quickbook] ]
+[? __defined__
+ Just trying including in a conditional macro. [include:foo2 include-sub2.quickbook]
+ With some text around it.]

Modified: trunk/tools/quickbook/test/include_1_6.gold
==============================================================================
--- trunk/tools/quickbook/test/include_1_6.gold (original)
+++ trunk/tools/quickbook/test/include_1_6.gold 2011-01-03 17:15:41 EST (Mon, 03 Jan 2011)
@@ -15,4 +15,16 @@
       Just testing.
     </para>
   </section>
+ <para>
+ Just trying including in a conditional macro.
+ </para>
+ <section id="foo2.test">
+ <title><link linkend="foo2.test">Test</link></title>
+ <para>
+ Just testing.
+ </para>
+ </section>
+ <para>
+ With some text around it.
+ </para>
 </article>

Modified: trunk/tools/quickbook/test/include_1_6.quickbook
==============================================================================
--- trunk/tools/quickbook/test/include_1_6.quickbook (original)
+++ trunk/tools/quickbook/test/include_1_6.quickbook 2011-01-03 17:15:41 EST (Mon, 03 Jan 2011)
@@ -5,3 +5,10 @@
 
 [include include-sub2.quickbook]
 [include:foo include-sub2.quickbook]
+
+[def __defined__]
+
+[? __undefined__ [include:foo1 include-sub2.quickbook] ]
+[? __defined__
+ Just trying including in a conditional macro. [include:foo2 include-sub2.quickbook]
+ With some text around it.]


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