Boost logo

Boost-Commit :

Subject: [Boost-commit] svn:boost r84063 - in trunk/tools/quickbook: doc src test
From: dnljms_at_[hidden]
Date: 2013-04-28 07:16:11


Author: danieljames
Date: 2013-04-28 07:16:11 EDT (Sun, 28 Apr 2013)
New Revision: 84063
URL: http://svn.boost.org/trac/boost/changeset/84063

Log:
Support the token pasting operator in C++ code blocks. Refs #8510.
Text files modified:
   trunk/tools/quickbook/doc/change_log.qbk | 2 ++
   trunk/tools/quickbook/src/syntax_highlight.cpp | 3 ++-
   trunk/tools/quickbook/test/code_cpp-1_5.gold | 6 +++++-
   trunk/tools/quickbook/test/code_cpp-1_5.quickbook | 4 ++++
   4 files changed, 13 insertions(+), 2 deletions(-)

Modified: trunk/tools/quickbook/doc/change_log.qbk
==============================================================================
--- trunk/tools/quickbook/doc/change_log.qbk (original)
+++ trunk/tools/quickbook/doc/change_log.qbk 2013-04-28 07:16:11 EDT (Sun, 28 Apr 2013)
@@ -279,6 +279,8 @@
 
 * When code blocks are indented using a mixture of tabs and spaces,
   convert indentation to spaces.
+* Support the token pasting operator (`##`) in C++ code blocks
+ ([@https://svn.boost.org/trac/boost/ticket/8510 #8510]).
 * 1.6 changes:
   * Better template argument parsing, so that it understands things
     like escaped markup.

Modified: trunk/tools/quickbook/src/syntax_highlight.cpp
==============================================================================
--- trunk/tools/quickbook/src/syntax_highlight.cpp (original)
+++ trunk/tools/quickbook/src/syntax_highlight.cpp 2013-04-28 07:16:11 EDT (Sun, 28 Apr 2013)
@@ -359,7 +359,8 @@
                     ; // make sure we recognize whole words only
 
                 special
- = +cl::chset_p("~!%^&*()+={[}]:;,<.>?/|\\-")
+ = +cl::chset_p("~!%^&*()+={[}]:;,<.>?/|\\-") |
+ "##"
                     ;
 
                 string_char = ('\\' >> u8_codepoint_p) | (cl::anychar_p - '\\');

Modified: trunk/tools/quickbook/test/code_cpp-1_5.gold
==============================================================================
--- trunk/tools/quickbook/test/code_cpp-1_5.gold (original)
+++ trunk/tools/quickbook/test/code_cpp-1_5.gold 2013-04-28 07:16:11 EDT (Sun, 28 Apr 2013)
@@ -3,7 +3,10 @@
 <article id="c___code_blocks" last-revision="DEBUG MODE Date: 2000/12/20 12:00:00 $"
  xmlns:xi="http://www.w3.org/2001/XInclude">
   <title>C++ Code Blocks</title>
-<programlisting><phrase role="comment">// No escape</phrase>
+<programlisting><phrase role="preprocessor">#include</phrase> <phrase role="special">&lt;</phrase><phrase role="identifier">some_header</phrase><phrase role="special">&gt;</phrase>
+ <phrase role="preprocessor">#include</phrase> <phrase role="string">&quot;another_header.hpp&quot;</phrase>
+<phrase role="preprocessor"># define</phrase> <phrase role="identifier">A_MACRO</phrase> <phrase role="identifier">value</phrase>
+<phrase role="comment">// No escape</phrase>
 <phrase role="comment">/* No escape */</phrase>
 <phrase role="comment">/* No escape
  * with newlines
@@ -13,6 +16,7 @@
 <phrase role="comment">/* Multiple escapes: <emphasis>italic</emphasis>
  * <emphasis role="underline">underline</emphasis><emphasis role="bold">bold</emphasis>
  */</phrase>
+<phrase role="comment">/* Token pasting: */</phrase> <phrase role="identifier">a</phrase><phrase role="special">##</phrase><phrase role="identifier">b</phrase>
 </programlisting>
   <para>
     A badly formed comment:

Modified: trunk/tools/quickbook/test/code_cpp-1_5.quickbook
==============================================================================
--- trunk/tools/quickbook/test/code_cpp-1_5.quickbook (original)
+++ trunk/tools/quickbook/test/code_cpp-1_5.quickbook 2013-04-28 07:16:11 EDT (Sun, 28 Apr 2013)
@@ -2,6 +2,9 @@
 [quickbook 1.5]
 ]
 
+ #include <some_header>
+ #include "another_header.hpp"
+ # define A_MACRO value
     // No escape
     /* No escape */
     /* No escape
@@ -12,6 +15,7 @@
     /* Multiple escapes: ``/italic/``
      * ``_underline_````*bold*``
      */
+ /* Token pasting: */ a##b
 
 A badly formed comment:
 


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