Boost logo

Boost-Commit :

Subject: [Boost-commit] svn:boost r75625 - branches/quickbook-dev/tools/quickbook/src
From: dnljms_at_[hidden]
Date: 2011-11-22 18:48:41


Author: danieljames
Date: 2011-11-22 18:48:39 EST (Tue, 22 Nov 2011)
New Revision: 75625
URL: http://svn.boost.org/trac/boost/changeset/75625

Log:
Quickbook: Check that code snippet grammars always succeed.
Text files modified:
   branches/quickbook-dev/tools/quickbook/src/code_snippet.cpp | 10 ++++++----
   1 files changed, 6 insertions(+), 4 deletions(-)

Modified: branches/quickbook-dev/tools/quickbook/src/code_snippet.cpp
==============================================================================
--- branches/quickbook-dev/tools/quickbook/src/code_snippet.cpp (original)
+++ branches/quickbook-dev/tools/quickbook/src/code_snippet.cpp 2011-11-22 18:48:39 EST (Tue, 22 Nov 2011)
@@ -368,18 +368,20 @@
         bool is_python = extension == ".py";
         code_snippet_actions a(storage, load(filename, qbk_version_n), is_python ? "[python]" : "[c++]");
 
- // TODO: Should I check that parse succeeded?
-
         string_iterator first(a.source_file->source.begin());
         string_iterator last(a.source_file->source.end());
 
+ cl::parse_info<string_iterator> info;
+
         if(is_python) {
- boost::spirit::classic::parse(first, last, python_code_snippet_grammar(a));
+ info = boost::spirit::classic::parse(first, last, python_code_snippet_grammar(a));
         }
         else {
- boost::spirit::classic::parse(first, last, cpp_code_snippet_grammar(a));
+ info = boost::spirit::classic::parse(first, last, cpp_code_snippet_grammar(a));
         }
 
+ assert(info.full);
+
         return 0;
     }
 


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