|
Boost-Commit : |
Subject: [Boost-commit] svn:boost r75624 - in branches/quickbook-dev/tools/quickbook: src test
From: dnljms_at_[hidden]
Date: 2011-11-22 18:48:26
Author: danieljames
Date: 2011-11-22 18:48:25 EST (Tue, 22 Nov 2011)
New Revision: 75624
URL: http://svn.boost.org/trac/boost/changeset/75624
Log:
Quickbook: Deal with invalid command line macros.
Text files modified:
branches/quickbook-dev/tools/quickbook/src/main_grammar.cpp | 4 ++--
branches/quickbook-dev/tools/quickbook/src/quickbook.cpp | 29 ++++++++++++++++++++---------
branches/quickbook-dev/tools/quickbook/test/Jamfile.v2 | 6 +++++-
3 files changed, 27 insertions(+), 12 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:48:25 EST (Tue, 22 Nov 2011)
@@ -659,12 +659,12 @@
>> local.command_line_macro_identifier
[actions.values.entry(ph::arg1, ph::arg2)]
>> *cl::space_p
- >> ( '='
+ >> !( '='
>> *cl::space_p
>> actions.to_value() [ inline_phrase ]
>> *cl::space_p
- | cl::eps_p
)
+ >> cl::end_p
] [actions.element]
;
Modified: branches/quickbook-dev/tools/quickbook/src/quickbook.cpp
==============================================================================
--- branches/quickbook-dev/tools/quickbook/src/quickbook.cpp (original)
+++ branches/quickbook-dev/tools/quickbook/src/quickbook.cpp 2011-11-22 18:48:25 EST (Tue, 22 Nov 2011)
@@ -59,12 +59,20 @@
end = preset_defines.end();
it != end; ++it)
{
- // TODO: Set filename in actor???
parse_iterator first(it->begin());
parse_iterator last(it->end());
- cl::parse(first, last, actor.grammar().command_line_macro);
- // TODO: Check result?
+ cl::parse_info<parse_iterator> info =
+ cl::parse(first, last, actor.grammar().command_line_macro);
+
+ if (!info.full) {
+ detail::outerr()
+ << "Error parsing command line definition: '"
+ << *it
+ << "'"
+ << std::endl;
+ ++actor.error_count;
+ }
}
}
@@ -118,16 +126,18 @@
actions actor(filein_, xinclude_base_, buffer, ids);
set_macros(actor);
- actor.current_file = load(filein_); // Throws load_error
+ if (actor.error_count == 0) {
+ actor.current_file = load(filein_); // Throws load_error
- parse_file(actor);
+ parse_file(actor);
- if(actor.error_count) {
- detail::outerr()
- << "Error count: " << actor.error_count << ".\n";
+ if(actor.error_count) {
+ detail::outerr()
+ << "Error count: " << actor.error_count << ".\n";
+ }
}
- result = !!actor.error_count;
+ result = actor.error_count ? 1 : 0;
}
catch (load_error& e) {
detail::outerr(filein_) << detail::utf8(e.what()) << std::endl;
@@ -161,6 +171,7 @@
fileout << stage2;
}
}
+
return result;
}
}
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-22 18:48:25 EST (Tue, 22 Nov 2011)
@@ -33,7 +33,11 @@
[ quickbook-error-test code_python_mismatched_escape-1_4-fail ]
[ quickbook-test code_snippet-1_1 ]
[ quickbook-test code_teletype-1_5 ]
- [ quickbook-test command_line_macro-1_1 : : : <quickbook-test-define>__macro__=*bold* ]
+ [ quickbook-test command_line_macro-1_1 : : :
+ <quickbook-test-define>__macro__=*bold* ]
+ [ quickbook-error-test command_line_macro-1_1-invalid :
+ command_line_macro-1_1.quickbook :
+ <testing.arg>'-Dsomething[]' ]
[ quickbook-test cond_phrase-1_5 ]
[ quickbook-test elements-1_5 ]
[ quickbook-test elements-1_6 ]
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