|
Boost-Commit : |
Subject: [Boost-commit] svn:boost r75630 - in branches/quickbook-dev/tools/quickbook: src test/versions
From: dnljms_at_[hidden]
Date: 2011-11-22 18:50:18
Author: danieljames
Date: 2011-11-22 18:50:17 EST (Tue, 22 Nov 2011)
New Revision: 75630
URL: http://svn.boost.org/trac/boost/changeset/75630
Log:
Quickbook: Avoid expanding macros that are now invalid.
The macro syntax has been tightened up in 1.6, so that fewer characters
are available for macro identifiers. But macros can still be defined
using the older quickbook versions When such macros are defined, prevent
them from expanding in a quickbook 1.6 document.
Added:
branches/quickbook-dev/tools/quickbook/test/versions/invalid_macro-1_6.gold (contents, props changed)
branches/quickbook-dev/tools/quickbook/test/versions/invalid_macro-1_6.quickbook (contents, props changed)
branches/quickbook-dev/tools/quickbook/test/versions/invalid_macro-inc-1_1.qbk (contents, props changed)
Text files modified:
branches/quickbook-dev/tools/quickbook/src/main_grammar.cpp | 15 +++++++++------
branches/quickbook-dev/tools/quickbook/test/versions/Jamfile.v2 | 1 +
2 files changed, 10 insertions(+), 6 deletions(-)
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-22 18:50:17 EST (Tue, 22 Nov 2011)
@@ -461,10 +461,14 @@
;
local.macro =
- // must not be followed by alpha or underscore
- cl::eps_p(actions.macro
- >> (cl::eps_p - (cl::alpha_p | '_')))
- >> actions.macro [actions.do_macro]
+ cl::eps_p
+ ( ( actions.macro
+ >> ~cl::eps_p(cl::alpha_p | '_')
+ // must not be followed by alpha or underscore
+ )
+ & macro_identifier // must be a valid macro for the current version
+ )
+ >> actions.macro [actions.do_macro]
;
local.template_ =
@@ -585,7 +589,7 @@
[
actions.to_value()
[
- cl::eps_p(actions.macro >> local.simple_markup_end)
+ cl::eps_p((actions.macro & macro_identifier) >> local.simple_markup_end)
>> actions.macro [actions.do_macro]
| ~cl::eps_p(cl::f_ch_p(local.simple_markup.mark))
>> +( ~cl::eps_p
@@ -717,7 +721,6 @@
'[' >> *(local.line_dummy_block | (cl::anychar_p - (cl::eol_p | ']'))) >> ']'
;
- // TODO: Prevent an old macro from being used in a 1.6 file.
macro_identifier =
qbk_since(106u)
>> +(cl::anychar_p - (cl::space_p | '[' | '\\' | ']'))
Modified: branches/quickbook-dev/tools/quickbook/test/versions/Jamfile.v2
==============================================================================
--- branches/quickbook-dev/tools/quickbook/test/versions/Jamfile.v2 (original)
+++ branches/quickbook-dev/tools/quickbook/test/versions/Jamfile.v2 2011-11-22 18:50:17 EST (Tue, 22 Nov 2011)
@@ -15,4 +15,5 @@
test-suite quickbook.test :
[ quickbook-test versions-1_6 ]
+ [ quickbook-test invalid_macro-1_6 ]
;
Added: branches/quickbook-dev/tools/quickbook/test/versions/invalid_macro-1_6.gold
==============================================================================
--- (empty file)
+++ branches/quickbook-dev/tools/quickbook/test/versions/invalid_macro-1_6.gold 2011-11-22 18:50:17 EST (Tue, 22 Nov 2011)
@@ -0,0 +1,36 @@
+<?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="invalid_macro_test" last-revision="DEBUG MODE Date: 2000/12/20 12:00:00 $"
+ xmlns:xi="http://www.w3.org/2001/XInclude">
+ <title>Invalid macro test</title>
+ <para>
+ Import:
+ </para>
+ <itemizedlist>
+ <listitem>
+ <simpara>
+ okay
+ </simpara>
+ </listitem>
+ <listitem>
+ <simpara>
+ __invalid\macro__
+ </simpara>
+ </listitem>
+ </itemizedlist>
+ <para>
+ Include:
+ </para>
+ <itemizedlist>
+ <listitem>
+ <simpara>
+ okay
+ </simpara>
+ </listitem>
+ <listitem>
+ <simpara>
+ bad
+ </simpara>
+ </listitem>
+ </itemizedlist>
+</article>
Added: branches/quickbook-dev/tools/quickbook/test/versions/invalid_macro-1_6.quickbook
==============================================================================
--- (empty file)
+++ branches/quickbook-dev/tools/quickbook/test/versions/invalid_macro-1_6.quickbook 2011-11-22 18:50:17 EST (Tue, 22 Nov 2011)
@@ -0,0 +1,14 @@
+[article Invalid macro test
+[quickbook 1.6]
+]
+
+Import:
+
+[import invalid_macro-inc-1_1.qbk]
+
+* __valid__
+* __invalid\macro__
+
+Include:
+
+[include invalid_macro-inc-1_1.qbk]
Added: branches/quickbook-dev/tools/quickbook/test/versions/invalid_macro-inc-1_1.qbk
==============================================================================
--- (empty file)
+++ branches/quickbook-dev/tools/quickbook/test/versions/invalid_macro-inc-1_1.qbk 2011-11-22 18:50:17 EST (Tue, 22 Nov 2011)
@@ -0,0 +1,7 @@
+[quickbook 1.1]
+
+[def __valid__ okay]
+[def __invalid\macro__ bad]
+
+* __valid__
+* __invalid\macro__
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