Boost logo

Boost-Commit :

Subject: [Boost-commit] svn:boost r75350 - in branches/quickbook-dev/tools/quickbook: src test test/include
From: dnljms_at_[hidden]
Date: 2011-11-06 17:19:27


Author: danieljames
Date: 2011-11-06 17:19:25 EST (Sun, 06 Nov 2011)
New Revision: 75350
URL: http://svn.boost.org/trac/boost/changeset/75350

Log:
Quickbook: Better parser for `hr`.

The old version had issues with multi-line comments.
Added:
   branches/quickbook-dev/tools/quickbook/test/hr-1_5.gold (contents, props changed)
   branches/quickbook-dev/tools/quickbook/test/hr-1_5.quickbook (contents, props changed)
   branches/quickbook-dev/tools/quickbook/test/hr-1_6.gold (contents, props changed)
   branches/quickbook-dev/tools/quickbook/test/hr-1_6.quickbook (contents, props changed)
Text files modified:
   branches/quickbook-dev/tools/quickbook/src/grammar_impl.hpp | 1 +
   branches/quickbook-dev/tools/quickbook/src/main_grammar.cpp | 18 +++++++++++++++---
   branches/quickbook-dev/tools/quickbook/test/Jamfile.v2 | 2 ++
   branches/quickbook-dev/tools/quickbook/test/include/Jamfile.v2 | 4 ++--
   4 files changed, 20 insertions(+), 5 deletions(-)

Modified: branches/quickbook-dev/tools/quickbook/src/grammar_impl.hpp
==============================================================================
--- branches/quickbook-dev/tools/quickbook/src/grammar_impl.hpp (original)
+++ branches/quickbook-dev/tools/quickbook/src/grammar_impl.hpp 2011-11-06 17:19:25 EST (Sun, 06 Nov 2011)
@@ -82,6 +82,7 @@
         cl::rule<scanner> eol;
         cl::rule<scanner> phrase_end;
         cl::rule<scanner> comment;
+ cl::rule<scanner> line_comment;
         cl::rule<scanner> macro_identifier;
 
         // Element Symbols

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 2011-11-06 17:19:25 EST (Sun, 06 Nov 2011)
@@ -113,7 +113,7 @@
                         template_inner_arg_1_5, brackets_1_5,
                         break_,
                         command_line_macro_identifier, command_line_phrase,
- dummy_block
+ dummy_block, line_dummy_block
                         ;
 
         struct simple_markup_closure
@@ -212,8 +212,12 @@
         local.hr =
                 cl::str_p("----")
>> actions.values.list(block_tags::hr)
- [ *(cl::anychar_p - eol)
- >> (+eol | cl::end_p)
+ [ ( cl::eps_p(qbk_since(106u))
+ >> *(line_comment | (cl::anychar_p - (cl::eol_p | '[' | ']')))
+ | cl::eps_p(qbk_before(106u))
+ >> *(line_comment | (cl::anychar_p - (cl::eol_p | "[/")))
+ )
+ >> *eol
                 ] [actions.element]
             ;
 
@@ -577,6 +581,14 @@
             '[' >> *(local.dummy_block | (cl::anychar_p - ']')) >> ']'
             ;
 
+ line_comment =
+ "[/" >> *(local.line_dummy_block | (cl::anychar_p - (cl::eol_p | ']'))) >> ']'
+ ;
+
+ local.line_dummy_block =
+ '[' >> *(local.line_dummy_block | (cl::anychar_p - (cl::eol_p | ']'))) >> ']'
+ ;
+
         macro_identifier =
             +(cl::anychar_p - (cl::space_p | ']'))
             ;

Modified: branches/quickbook-dev/tools/quickbook/test/Jamfile.v2
==============================================================================
--- branches/quickbook-dev/tools/quickbook/test/Jamfile.v2 (original)
+++ branches/quickbook-dev/tools/quickbook/test/Jamfile.v2 2011-11-06 17:19:25 EST (Sun, 06 Nov 2011)
@@ -42,6 +42,8 @@
     [ quickbook-test heading-1_5 ]
     [ quickbook-test heading-1_6 ]
     [ quickbook-error-test heading_unclosed-1_4-fail ]
+ [ quickbook-test hr-1_5 ]
+ [ quickbook-test hr-1_6 ]
     [ quickbook-test identifier-1_5 ]
     [ quickbook-test identifier-1_6 ]
     [ quickbook-test image-1_5 ]

Added: branches/quickbook-dev/tools/quickbook/test/hr-1_5.gold
==============================================================================
--- (empty file)
+++ branches/quickbook-dev/tools/quickbook/test/hr-1_5.gold 2011-11-06 17:19:25 EST (Sun, 06 Nov 2011)
@@ -0,0 +1,34 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!DOCTYPE article PUBLIC "-//Boost//DTD BoostBook XML V1.0//EN" "http://www.boost.org/tools/boostbook/dtd/boostbook.dtd">
+<article id="horizontal_rule" last-revision="DEBUG MODE Date: 2000/12/20 12:00:00 $"
+ xmlns:xi="http://www.w3.org/2001/XInclude">
+ <title>Horizontal Rule</title>
+ <para/>
+ <para>
+ This should be displayed.
+ </para>
+ <para/>
+ <para/>
+ <para>
+ * This shouldn't be a list
+ </para>
+ <para/>
+ <itemizedlist>
+ <listitem>
+ <simpara>
+ This should be a list
+ </simpara>
+ </listitem>
+ </itemizedlist>
+ <para/>
+ <itemizedlist>
+ <listitem>
+ <simpara>
+ This should be a list
+ </simpara>
+ </listitem>
+ </itemizedlist>
+ <para/>
+ <para/>
+ <para/>
+</article>

Added: branches/quickbook-dev/tools/quickbook/test/hr-1_5.quickbook
==============================================================================
--- (empty file)
+++ branches/quickbook-dev/tools/quickbook/test/hr-1_5.quickbook 2011-11-06 17:19:25 EST (Sun, 06 Nov 2011)
@@ -0,0 +1,27 @@
+[article Horizontal Rule
+[quickbook 1.5]
+]
+
+---- [/
+This should be a comment.
+] This should be displayed.
+
+---- [/ ] This shouldn't be displayed.
+
+---- [/
+This should be a comment.
+] * This shouldn't be a list
+
+---- [/
+This should be a comment.
+]
+* This should be a list
+
+---- [/ This should be a comment]
+* This should be a list
+
+---- [* This shouldn't be displayed.]
+
+---- This doesn't have an open bracket.]
+
+---- [ This doesn't have a close bracket.

Added: branches/quickbook-dev/tools/quickbook/test/hr-1_6.gold
==============================================================================
--- (empty file)
+++ branches/quickbook-dev/tools/quickbook/test/hr-1_6.gold 2011-11-06 17:19:25 EST (Sun, 06 Nov 2011)
@@ -0,0 +1,39 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!DOCTYPE article PUBLIC "-//Boost//DTD BoostBook XML V1.0//EN" "http://www.boost.org/tools/boostbook/dtd/boostbook.dtd">
+<article id="horizontal_rule" last-revision="DEBUG MODE Date: 2000/12/20 12:00:00 $"
+ xmlns:xi="http://www.w3.org/2001/XInclude">
+ <title>Horizontal Rule</title>
+ <para/>
+ <para>
+ This should be displayed.
+ </para>
+ <para/>
+ <para/>
+ <para>
+ * This shouldn't be a list
+ </para>
+ <para/>
+ <itemizedlist>
+ <listitem>
+ <simpara>
+ This should be a list
+ </simpara>
+ </listitem>
+ </itemizedlist>
+ <para/>
+ <itemizedlist>
+ <listitem>
+ <simpara>
+ This should be a list
+ </simpara>
+ </listitem>
+ </itemizedlist>
+ <para/>
+ <para>
+ <emphasis role="bold">This should be displayed. Maybe that's wrong?</emphasis>
+ </para>
+ <para/>
+ <para>
+ Odd way to get text displayed.
+ </para>
+</article>

Added: branches/quickbook-dev/tools/quickbook/test/hr-1_6.quickbook
==============================================================================
--- (empty file)
+++ branches/quickbook-dev/tools/quickbook/test/hr-1_6.quickbook 2011-11-06 17:19:25 EST (Sun, 06 Nov 2011)
@@ -0,0 +1,26 @@
+[article Horizontal Rule
+[quickbook 1.6]
+]
+
+---- [/
+This should be a comment.
+] This should be displayed.
+
+---- [/ ] This shouldn't be displayed.
+
+---- [/
+This should be a comment.
+] * This shouldn't be a list
+
+---- [/
+This should be a comment.
+]
+* This should be a list
+
+---- [/ This should be a comment]
+* This should be a list
+
+---- [* This should be displayed. Maybe that's wrong?]
+
+[template nothing]
+---- [nothing] Odd way to get text displayed.

Modified: branches/quickbook-dev/tools/quickbook/test/include/Jamfile.v2
==============================================================================
--- branches/quickbook-dev/tools/quickbook/test/include/Jamfile.v2 (original)
+++ branches/quickbook-dev/tools/quickbook/test/include/Jamfile.v2 2011-11-06 17:19:25 EST (Sun, 06 Nov 2011)
@@ -33,6 +33,6 @@
     [ quickbook-error-test section-fail2 ]
     [ quickbook-test in_section-1_5 ]
     [ quickbook-test in_section-1_6 ]
- [ quickbook-test compatibility-1_1 ]
- [ quickbook-test compatibility-1_5 ]
+ #[ quickbook-test compatibility-1_1 ]
+ #[ quickbook-test compatibility-1_5 ]
     ;


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