Boost logo

Boost-Commit :

Subject: [Boost-commit] svn:boost r63609 - in trunk/tools/quickbook: . test
From: daniel_james_at_[hidden]
Date: 2010-07-04 12:54:45


Author: danieljames
Date: 2010-07-04 12:54:44 EDT (Sun, 04 Jul 2010)
New Revision: 63609
URL: http://svn.boost.org/trac/boost/changeset/63609

Log:
Clear template_info before parsing a template.

Sometimes template_info contains values from a previous failed parse. I
think this makes the last change unnecessary, but I'm going to leave it
in as I feel like it improved the grammar.
Added:
   trunk/tools/quickbook/test/mismatched-brackets-1.gold (contents, props changed)
   trunk/tools/quickbook/test/mismatched-brackets-1.quickbook (contents, props changed)
   trunk/tools/quickbook/test/mismatched-brackets-2.gold (contents, props changed)
   trunk/tools/quickbook/test/mismatched-brackets-2.quickbook (contents, props changed)
   trunk/tools/quickbook/test/mismatched-brackets-3.quickbook (contents, props changed)
Text files modified:
   trunk/tools/quickbook/block.hpp | 6 ++++--
   trunk/tools/quickbook/phrase.hpp | 2 +-
   trunk/tools/quickbook/test/Jamfile.v2 | 3 +++
   trunk/tools/quickbook/test/templates_1_4.gold | 2 +-
   trunk/tools/quickbook/test/templates_1_4.quickbook | 3 +--
   5 files changed, 10 insertions(+), 6 deletions(-)

Modified: trunk/tools/quickbook/block.hpp
==============================================================================
--- trunk/tools/quickbook/block.hpp (original)
+++ trunk/tools/quickbook/block.hpp 2010-07-04 12:54:44 EDT (Sun, 04 Jul 2010)
@@ -232,7 +232,8 @@
 
                 template_ =
                     "template"
- >> hard_space >> template_id [push_back_a(actions.template_info)]
+ >> hard_space [clear_a(actions.template_info)]
+ >> template_id [push_back_a(actions.template_info)]
>>
                     !(
                         space >> '['
@@ -246,7 +247,8 @@
 
                 template_body =
                    *(('[' >> template_body >> ']') | (anychar_p - ']'))
- >> space >> eps_p(']')
+ >> eps_p(space >> ']')
+ >> space
                     ;
 
                 variablelist =

Modified: trunk/tools/quickbook/phrase.hpp
==============================================================================
--- trunk/tools/quickbook/phrase.hpp (original)
+++ trunk/tools/quickbook/phrase.hpp 2010-07-04 12:54:44 EDT (Sun, 04 Jul 2010)
@@ -126,7 +126,7 @@
                         ch_p('`') [assign_a(actions.template_escape,true_)]
                         |
                         eps_p [assign_a(actions.template_escape,false_)]
- )
+ ) [clear_a(actions.template_info)]
>>
                     ( (
                         (eps_p(punct_p)

Modified: trunk/tools/quickbook/test/Jamfile.v2
==============================================================================
--- trunk/tools/quickbook/test/Jamfile.v2 (original)
+++ trunk/tools/quickbook/test/Jamfile.v2 2010-07-04 12:54:44 EDT (Sun, 04 Jul 2010)
@@ -24,6 +24,9 @@
     [ quickbook-test templates_1_4 ]
     [ quickbook-test templates_1_5 ]
     [ quickbook-test template-section ]
+ [ quickbook-test mismatched-brackets-1 ]
+ [ quickbook-test mismatched-brackets-2 ]
+ [ quickbook-fail-test mismatched-brackets-3 ]
     #[ quickbook-test xinclude ]
     [ quickbook-test import ]
     [ quickbook-test include_1_5 ]

Added: trunk/tools/quickbook/test/mismatched-brackets-1.gold
==============================================================================
--- (empty file)
+++ trunk/tools/quickbook/test/mismatched-brackets-1.gold 2010-07-04 12:54:44 EDT (Sun, 04 Jul 2010)
@@ -0,0 +1,14 @@
+<?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="mismatched_brackets" last-revision="DEBUG MODE Date: 2000/12/20 12:00:00 $"
+ xmlns:xi="http://www.w3.org/2001/XInclude">
+ <title>Mismatched brackets</title>
+ <articleinfo>
+ </articleinfo>
+ <para>
+ [foo
+ </para>
+ <para>
+ Eek
+ </para>
+</article>

Added: trunk/tools/quickbook/test/mismatched-brackets-1.quickbook
==============================================================================
--- (empty file)
+++ trunk/tools/quickbook/test/mismatched-brackets-1.quickbook 2010-07-04 12:54:44 EDT (Sun, 04 Jul 2010)
@@ -0,0 +1,7 @@
+[article Mismatched brackets]
+
+[template foo Oops]
+
+[foo
+[template blah Eek]
+[blah]
\ No newline at end of file

Added: trunk/tools/quickbook/test/mismatched-brackets-2.gold
==============================================================================
--- (empty file)
+++ trunk/tools/quickbook/test/mismatched-brackets-2.gold 2010-07-04 12:54:44 EDT (Sun, 04 Jul 2010)
@@ -0,0 +1,11 @@
+<?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="mismatched_brackets" last-revision="DEBUG MODE Date: 2000/12/20 12:00:00 $"
+ xmlns:xi="http://www.w3.org/2001/XInclude">
+ <title>Mismatched brackets</title>
+ <articleinfo>
+ </articleinfo>
+ <para>
+ [foo Eek
+ </para>
+</article>

Added: trunk/tools/quickbook/test/mismatched-brackets-2.quickbook
==============================================================================
--- (empty file)
+++ trunk/tools/quickbook/test/mismatched-brackets-2.quickbook 2010-07-04 12:54:44 EDT (Sun, 04 Jul 2010)
@@ -0,0 +1,7 @@
+[article Mismatched brackets]
+
+[template foo Oops]
+[template blah Eek]
+
+[foo
+[blah]
\ No newline at end of file

Added: trunk/tools/quickbook/test/mismatched-brackets-3.quickbook
==============================================================================
--- (empty file)
+++ trunk/tools/quickbook/test/mismatched-brackets-3.quickbook 2010-07-04 12:54:44 EDT (Sun, 04 Jul 2010)
@@ -0,0 +1,5 @@
+[article Mismatched brackets]
+
+[template foo Oops]
+[template blah Eek
+[foo]

Modified: trunk/tools/quickbook/test/templates_1_4.gold
==============================================================================
--- trunk/tools/quickbook/test/templates_1_4.gold (original)
+++ trunk/tools/quickbook/test/templates_1_4.gold 2010-07-04 12:54:44 EDT (Sun, 04 Jul 2010)
@@ -15,7 +15,7 @@
     {1-2} {1-2} {1-2 3 4} {1 2-3 4} {1 2 3-4} {[1-2} {1..2-3} {1..2-3}
   </para>
   <para>
- {[binary 1 2- {1 2-y}} 4]
+ {[binary 1 2-3} 4]
   </para>
   <para>
     {1-2-3} {1-2-3} {1-2-3 4} {1 2-3-4} {[1-2-3}

Modified: trunk/tools/quickbook/test/templates_1_4.quickbook
==============================================================================
--- trunk/tools/quickbook/test/templates_1_4.quickbook (original)
+++ trunk/tools/quickbook/test/templates_1_4.quickbook 2010-07-04 12:54:44 EDT (Sun, 04 Jul 2010)
@@ -27,8 +27,7 @@
 [binary 1.\.2..3] [/ {1..2-3} ]
 [binary 1.\.2 3] [/ {1..2-3} ]
 
-[binary [binary 1 2..3] 4] [/ {[binary 1 2- {1 2-y}} 4] ]
-[/ This is obviously wrong, but I don't feel up to fixing it at the moment.]
+[binary [binary 1 2..3] 4] [/ {[binary 1 2-3} 4] ]
 
 [template ternary[x y z] {[x]-[y]-[z]}]
 [ternary 1..2..3] [/ {1-2-3} ]


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