|
Boost-Commit : |
Subject: [Boost-commit] svn:boost r76259 - branches/quickbook-dev/tools/quickbook/src
From: dnljms_at_[hidden]
Date: 2012-01-01 09:35:16
Author: danieljames
Date: 2012-01-01 09:35:16 EST (Sun, 01 Jan 2012)
New Revision: 76259
URL: http://svn.boost.org/trac/boost/changeset/76259
Log:
Quickbook: More sensible handling of escapes in include paths.
Text files modified:
branches/quickbook-dev/tools/quickbook/src/actions.cpp | 42 ++++++++++++++++++++++-----------------
branches/quickbook-dev/tools/quickbook/src/main_grammar.cpp | 2 +
2 files changed, 26 insertions(+), 18 deletions(-)
Modified: branches/quickbook-dev/tools/quickbook/src/actions.cpp
==============================================================================
--- branches/quickbook-dev/tools/quickbook/src/actions.cpp (original)
+++ branches/quickbook-dev/tools/quickbook/src/actions.cpp 2012-01-01 09:35:16 EST (Sun, 01 Jan 2012)
@@ -1768,29 +1768,35 @@
// isn't enforced as it's backwards compatible).
//
// Counter-intuitively: encoded == plain text here.
- if (qbk_version_n < 106u && !path.is_encoded()) {
- std::string path_text = path.get_quickbook();
- if(path_text.find('\\') != std::string::npos)
- {
- detail::outwarn(path.get_file(), path.get_position())
- << "Path isn't portable: '"
- << detail::utf8(path_text)
- << "'"
- << std::endl;
+ std::string path_text = qbk_version_n >= 106u || path.is_encoded() ?
+ path.get_encoded() : path.get_quickbook();
+
+ bool is_glob = qbk_version_n >= 107u &&
+ path_text.find_first_of("[]?*") != std::string::npos;
+
+ if(!is_glob && path_text.find('\\') != std::string::npos)
+ {
+ quickbook::detail::ostream* err;
+
+ if (qbk_version_n >= 106u) {
+ err = &detail::outerr(path.get_file(), path.get_position());
+ ++actions.error_count;
+ }
+ else {
+ err = &detail::outwarn(path.get_file(), path.get_position());
}
- boost::replace(path_text, '\\', '/');
+ *err << "Path isn't portable: '"
+ << detail::utf8(path_text)
+ << "'"
+ << std::endl;
- return path_details(path_text, path_details::path);
- }
- else {
- std::string path_text = path.get_encoded();
- return path_details(path_text,
- qbk_version_n >= 107u &&
- path_text.find_first_of("[]?*") != std::string::npos ?
- path_details::glob : path_details::path) ;
+ boost::replace(path_text, '\\', '/');
}
+
+ return path_details(path_text,
+ is_glob ? path_details::glob : path_details::path);
}
xinclude_path calculate_xinclude_path(value const& p, quickbook::actions& actions)
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 2012-01-01 09:35:16 EST (Sun, 01 Jan 2012)
@@ -689,6 +689,8 @@
[actions.escape_unicode]
| "\\U" >> cl::repeat_p(8) [cl::chset<>("0-9a-fA-F")]
[actions.escape_unicode]
+ | ('\\' >> cl::anychar_p) [actions.error("Invalid escape.")]
+ [actions.raw_char]
| ("'''" >> !eol) [actions.error("Boostbook escape invalid here.")]
>> (*(cl::anychar_p - "'''"))
>> ( cl::str_p("'''")
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